mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-15399: Improvements to the way we handle rebranding of saved searches
- InvisibleMessages.resx contains the default value for the saved search (xensearch), which can be overwritten in Branding.cs Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
8e1493209d
commit
86ec959e26
@ -49,6 +49,14 @@ namespace XenAdmin
|
||||
public const string UPDATE = "@BRANDING_UPDATE@";
|
||||
public const string CHECK_FOR_UPDATES_URL = "@BRANDING_XENSERVER_UPDATE_URL@";
|
||||
|
||||
public static string Search
|
||||
{
|
||||
get
|
||||
{
|
||||
return SEARCH != "@BRANDING_SEARCH@" ? SEARCH : InvisibleMessages.XEN_SEARCH;
|
||||
}
|
||||
}
|
||||
|
||||
public static string Update
|
||||
{
|
||||
get
|
||||
|
@ -88,10 +88,10 @@ namespace XenAdmin.Commands
|
||||
oldDir = Directory.GetCurrentDirectory();
|
||||
OpenFileDialog dialog = new OpenFileDialog();
|
||||
dialog.AddExtension = true;
|
||||
dialog.Filter = string.Format("{0} (*." + Branding.SEARCH + ")|*." + Branding.SEARCH, Messages.XENSEARCH_SAVED_SEARCH);
|
||||
dialog.Filter = string.Format(Messages.XENSEARCH_SAVED_SEARCH, Branding.Search);
|
||||
dialog.FilterIndex = 0;
|
||||
dialog.RestoreDirectory = true;
|
||||
dialog.DefaultExt = Branding.SEARCH;
|
||||
dialog.DefaultExt = Branding.Search;
|
||||
dialog.CheckPathExists = false;
|
||||
|
||||
if (dialog.ShowDialog(Parent) == DialogResult.OK)
|
||||
@ -108,7 +108,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
log.InfoFormat("Importing search from '{0}'", filename);
|
||||
|
||||
if (filename.EndsWith("." + Branding.SEARCH) && MainWindowCommandInterface.DoSearch(filename))
|
||||
if (filename.EndsWith("." + Branding.Search) && MainWindowCommandInterface.DoSearch(filename))
|
||||
{
|
||||
log.InfoFormat("Imported search from '{0}' successfully.", filename);
|
||||
}
|
||||
@ -119,7 +119,7 @@ namespace XenAdmin.Commands
|
||||
new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
SystemIcons.Error,
|
||||
String.Format(Messages.UNABLE_TO_IMPORT_SEARCH, filename),
|
||||
String.Format(Messages.UNABLE_TO_IMPORT_SEARCH, filename, Branding.Search),
|
||||
Messages.XENCENTER)).ShowDialog(Parent);
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ namespace XenAdmin
|
||||
ConnectionsManager.XenConnections.Clear();
|
||||
ConnectionsManager.History.Clear();
|
||||
|
||||
Search.InitSearch();
|
||||
Search.InitSearch(Branding.Search);
|
||||
TreeSearch.InitSearch();
|
||||
|
||||
ArgType argType = ArgType.None;
|
||||
|
@ -290,8 +290,7 @@ namespace XenAdmin.TabPages
|
||||
using (SaveFileDialog dialog = new SaveFileDialog())
|
||||
{
|
||||
dialog.AddExtension = true;
|
||||
dialog.Filter = string.Format("{0} (*." + Branding.SEARCH + ")|*." + Branding.SEARCH,
|
||||
Messages.XENSEARCH_SAVED_SEARCH);
|
||||
dialog.Filter = string.Format(Messages.XENSEARCH_SAVED_SEARCH, Branding.Search);
|
||||
dialog.FilterIndex = 0;
|
||||
dialog.RestoreDirectory = true;
|
||||
dialog.DefaultExt = Branding.SEARCH;
|
||||
|
2
XenModel/InvisibleMessages.Designer.cs
generated
2
XenModel/InvisibleMessages.Designer.cs
generated
@ -403,7 +403,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to @BRANDING_SEARCH@.
|
||||
/// Looks up a localized string similar to xensearch.
|
||||
/// </summary>
|
||||
public static string XEN_SEARCH {
|
||||
get {
|
||||
|
@ -175,7 +175,7 @@
|
||||
<value>http://citrix.com/English/aboutCitrix/legal/privacyStatement.asp?ntref=hp_nav_US</value>
|
||||
</data>
|
||||
<data name="XEN_SEARCH" xml:space="preserve">
|
||||
<value>@BRANDING_SEARCH@</value>
|
||||
<value>xensearch</value>
|
||||
</data>
|
||||
<data name="SUPPORT_URL" xml:space="preserve">
|
||||
<value>http://support.citrix.com/</value>
|
||||
|
@ -178,7 +178,7 @@
|
||||
<value>http://citrix.com/English/aboutCitrix/legal/privacyStatement.asp?ntref=hp_nav_US</value>
|
||||
</data>
|
||||
<data name="XEN_SEARCH" xml:space="preserve">
|
||||
<value>@BRANDING_SEARCH@</value>
|
||||
<value>xensearch</value>
|
||||
</data>
|
||||
<data name="SUPPORT_URL" xml:space="preserve">
|
||||
<value>http://support.citrix.com/</value>
|
||||
|
@ -175,7 +175,7 @@
|
||||
<value>http://citrix.com/English/aboutCitrix/legal/privacyStatement.asp?ntref=hp_nav_US</value>
|
||||
</data>
|
||||
<data name="XEN_SEARCH" xml:space="preserve">
|
||||
<value>@BRANDING_SEARCH@</value>
|
||||
<value>xensearch</value>
|
||||
</data>
|
||||
<data name="SUPPORT_URL" xml:space="preserve">
|
||||
<value>http://support.citrix.com/</value>
|
||||
|
4
XenModel/Messages.Designer.cs
generated
4
XenModel/Messages.Designer.cs
generated
@ -31609,7 +31609,7 @@ namespace XenAdmin {
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to @BRANDING_BRAND_CONSOLE@ was unable to import a saved search from file '{0}'.
|
||||
///
|
||||
///Verify that the file is a valid @BRANDING_SEARCH@ export..
|
||||
///Verify that the file is a valid {1} export..
|
||||
/// </summary>
|
||||
public static string UNABLE_TO_IMPORT_SEARCH {
|
||||
get {
|
||||
@ -37026,7 +37026,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Saved Searches.
|
||||
/// Looks up a localized string similar to Saved Searches (*.{0})|*.{0}.
|
||||
/// </summary>
|
||||
public static string XENSEARCH_SAVED_SEARCH {
|
||||
get {
|
||||
|
@ -10409,7 +10409,7 @@ VM が再起動したら、[@BRANDING_PRODUCT_BRAND@ Tools のインストール
|
||||
<data name="UNABLE_TO_IMPORT_SEARCH" xml:space="preserve">
|
||||
<value>ファイル '{0}' に保存されている検索をインポートできません。
|
||||
|
||||
このファイルが有効な @BRANDING_SEARCH@ ファイルであることを確認してください。</value>
|
||||
このファイルが有効な {1} ファイルであることを確認してください。</value>
|
||||
</data>
|
||||
<data name="UNCOMPRESS_APPLIANCE_DESCRIPTION" xml:space="preserve">
|
||||
<value>ファイルが '{0}' に圧縮解除されます。元のファイル '{1}' は削除されます。続行しますか?</value>
|
||||
@ -12106,7 +12106,7 @@ VM が再起動したら、[@BRANDING_PRODUCT_BRAND@ Tools のインストール
|
||||
<value>新しい @BRANDING_BRAND_CONSOLE@ が使用可能</value>
|
||||
</data>
|
||||
<data name="XENSEARCH_SAVED_SEARCH" xml:space="preserve">
|
||||
<value>保存済みの検索</value>
|
||||
<value>保存済みの検索 (*.{0})|*.{0}</value>
|
||||
</data>
|
||||
<data name="XENSERVER" xml:space="preserve">
|
||||
<value>@BRANDING_SERVER@</value>
|
||||
|
@ -10967,7 +10967,7 @@ Refer to the "@BRANDING_PRODUCT_BRAND@ Administrator's Guide" for instructions o
|
||||
<data name="UNABLE_TO_IMPORT_SEARCH" xml:space="preserve">
|
||||
<value>@BRANDING_BRAND_CONSOLE@ was unable to import a saved search from file '{0}'.
|
||||
|
||||
Verify that the file is a valid @BRANDING_SEARCH@ export.</value>
|
||||
Verify that the file is a valid {1} export.</value>
|
||||
</data>
|
||||
<data name="UNCOMPRESS_APPLIANCE_DESCRIPTION" xml:space="preserve">
|
||||
<value>@BRANDING_BRAND_CONSOLE@ will uncompress the file to '{0}'. After uncompression the original file '{1}' will be deleted. Continue?</value>
|
||||
@ -12796,7 +12796,7 @@ Are you sure you want to enable automated power management for this Host?</value
|
||||
<value>Newer @BRANDING_BRAND_CONSOLE@ Available</value>
|
||||
</data>
|
||||
<data name="XENSEARCH_SAVED_SEARCH" xml:space="preserve">
|
||||
<value>Saved Searches</value>
|
||||
<value>Saved Searches (*.{0})|*.{0}</value>
|
||||
</data>
|
||||
<data name="XENSERVER" xml:space="preserve">
|
||||
<value>@BRANDING_SERVER@</value>
|
||||
|
@ -10412,7 +10412,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<data name="UNABLE_TO_IMPORT_SEARCH" xml:space="preserve">
|
||||
<value>@BRANDING_BRAND_CONSOLE@ 无法从文件 {0} 中导入保存的搜索。
|
||||
|
||||
请确认该文件属于有效的 @BRANDING_SEARCH@ 导出。</value>
|
||||
请确认该文件属于有效的 {1} 导出。</value>
|
||||
</data>
|
||||
<data name="UNCOMPRESS_APPLIANCE_DESCRIPTION" xml:space="preserve">
|
||||
<value>@BRANDING_BRAND_CONSOLE@ 将文件解压到“{0}”。 解压后,将删除原始文件“{1}”。是否继续?</value>
|
||||
@ -12109,7 +12109,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>更新的 @BRANDING_BRAND_CONSOLE@ 可用</value>
|
||||
</data>
|
||||
<data name="XENSEARCH_SAVED_SEARCH" xml:space="preserve">
|
||||
<value>保存的搜索</value>
|
||||
<value>保存的搜索 (*.{0})|*.{0}</value>>
|
||||
</data>
|
||||
<data name="XENSERVER" xml:space="preserve">
|
||||
<value>@BRANDING_SERVER@</value>
|
||||
|
@ -295,7 +295,7 @@ namespace XenAdmin.XenSearch
|
||||
if (uuid == null)
|
||||
uuid = System.Guid.NewGuid().ToString();
|
||||
|
||||
String key = InvisibleMessages.XEN_SEARCH + ".Search-" + uuid;
|
||||
String key = SearchPrefix + uuid;
|
||||
String value = GetXML();
|
||||
|
||||
if (connection == null)
|
||||
@ -339,7 +339,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
String key = InvisibleMessages.XEN_SEARCH + ".Search-" + uuid;
|
||||
String key = SearchPrefix + uuid;
|
||||
|
||||
foreach (IXenConnection connection in ConnectionsManager.XenConnectionsCopy)
|
||||
{
|
||||
@ -672,6 +672,7 @@ namespace XenAdmin.XenSearch
|
||||
}
|
||||
|
||||
private static Dictionary<String, Search> searches =new Dictionary<string, Search>();
|
||||
public static string BrandedSearchKey { get; private set; }
|
||||
public static event Action SearchesChanged;
|
||||
|
||||
private static void OnSearchesChanged()
|
||||
@ -693,9 +694,10 @@ namespace XenAdmin.XenSearch
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitSearch()
|
||||
public static void InitSearch(string brandedSearchKey)
|
||||
{
|
||||
searches = new Dictionary<String, Search>();
|
||||
BrandedSearchKey = brandedSearchKey;
|
||||
|
||||
InitDefaultSearches();
|
||||
|
||||
@ -714,10 +716,14 @@ namespace XenAdmin.XenSearch
|
||||
SynchroniseSearches();
|
||||
}
|
||||
|
||||
private static string SearchPrefix
|
||||
{
|
||||
get { return BrandedSearchKey + ".Search-"; }
|
||||
}
|
||||
|
||||
private static void SynchroniseSearches()
|
||||
{
|
||||
Dictionary<String, Search> localSearches = new Dictionary<String, Search>();
|
||||
string SearchPrefix = InvisibleMessages.XEN_SEARCH + ".Search-";
|
||||
foreach (IXenConnection connection in ConnectionsManager.XenConnectionsCopy)
|
||||
{
|
||||
connection.Cache.RegisterBatchCollectionChanged<Pool>(Pool_BatchCollectionChanged);
|
||||
|
@ -307,7 +307,7 @@ namespace XenAdmin.XenSearch
|
||||
document.XmlResolver = new BasicXMLResolver();
|
||||
|
||||
document.AppendChild(document.CreateXmlDeclaration("1.0", Encoding.UTF8.WebName, null));
|
||||
document.AppendChild(document.CreateDocumentType(InvisibleMessages.XEN_SEARCH, "-//" + InvisibleMessages.XEN_SEARCH.ToUpper() + "//DTD " + InvisibleMessages.XEN_SEARCH.ToUpper() + " 1//EN", InvisibleMessages.XEN_SEARCH + "-1.dtd", null));
|
||||
document.AppendChild(document.CreateDocumentType(Search.BrandedSearchKey, "-//" + Search.BrandedSearchKey.ToUpper() + "//DTD " + Search.BrandedSearchKey.ToUpper() + " 1//EN", Search.BrandedSearchKey + "-1.dtd", null));
|
||||
|
||||
XmlNode node = document.CreateElement("Searches");
|
||||
AddAttribute(document, node, "xmlns", xmlns);
|
||||
|
Loading…
Reference in New Issue
Block a user