CA-355166: Updated help links.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2021-06-02 02:09:06 +01:00 committed by Mihaela Stoica
parent 70af65e446
commit 36beaa5180
10 changed files with 18 additions and 57 deletions

View File

@ -140,6 +140,9 @@
<data name="EXTENSION_UPDATE" xml:space="preserve">
<value>xsupdate</value>
</data>
<data name="HELP_PATH" xml:space="preserve">
<value>xencenter/current-release/</value>
</data>
<data name="LEGACY_PRODUCT" xml:space="preserve">
<value>XenServer</value>
</data>

View File

@ -38,6 +38,7 @@ BRANDING_COMPANY_AND_PRODUCT="[Citrix XenServer]"
BRANDING_BRAND_CONSOLE="[XenCenter]"
BRANDING_BRAND_CONSOLE_NO_SPACE="[XenCenter]"
BRANDING_BRAND_CONSOLE_SHORT=XenCente
BRANDING_HELP_PATH=xencenter/current-release/
BRANDING_PV_TOOLS="[Citrix VM Tools]"
BRANDING_PRODUCT_VERSION_TEXT=0.0.0
BRANDING_XC_PRODUCT_VERSION=0.0.0

View File

@ -30,9 +30,7 @@
*/
using System;
using System.Net;
using System.Resources;
using System.Threading;
using XenAdmin.Core;
@ -45,9 +43,6 @@ namespace XenAdmin.Help
private static readonly ResourceManager resources;
private static readonly string HelpUrl = Registry.CustomHelpUrl;
private static readonly string HelpQuery = string.Empty;
private static volatile string _helpVersion;
private static readonly object _helpLock = new object();
static HelpManager()
{
@ -55,7 +50,7 @@ namespace XenAdmin.Help
if (string.IsNullOrEmpty(HelpUrl))
{
HelpUrl = InvisibleMessages.HELP_URL;
HelpUrl = InvisibleMessages.DOCS_URL + BrandManager.HelpPath;
HelpQuery = string.Format(InvisibleMessages.HELP_URL_QUERY,
$"{BrandManager.XenCenterVersion}.{Program.Version.Revision}".Replace('.', '_'),
@ -63,37 +58,6 @@ namespace XenAdmin.Help
}
}
internal static void SetHelpVersion()
{
ThreadPool.QueueUserWorkItem(obj =>
{
try
{
var version = Program.Version;
var helpVersion = $"{version.Major}-{version.Minor}/";
var request = WebRequest.Create(HelpUrl + helpVersion + "index.html");
request.Method = "HEAD";
using (var response = request.GetResponse() as HttpWebResponse)
{
if (response != null && response.StatusCode == HttpStatusCode.OK)
_helpVersion = helpVersion;
else
_helpVersion = "current-release/";
}
}
catch
{
_helpVersion = "current-release/";
}
finally
{
lock (_helpLock)
Monitor.PulseAll(_helpLock);
}
});
}
internal static bool TryGetTopicId(string pageRef, out string topicId)
{
topicId = null;
@ -115,11 +79,7 @@ namespace XenAdmin.Help
else
log.DebugFormat("Found help topic ID {0} for {1}", topicId, pageRef);
if (string.IsNullOrEmpty(_helpVersion))
lock (_helpLock)
Monitor.Wait(_helpLock);
var helpTopicUrl = HelpUrl + _helpVersion + $"{topicId ?? "index"}.html" + HelpQuery;
var helpTopicUrl = HelpUrl + $"{topicId ?? "index"}.html" + HelpQuery;
Program.OpenURL(helpTopicUrl.ToLowerInvariant());
// record help usage

View File

@ -278,12 +278,6 @@ namespace XenAdmin
Application.ApplicationExit -= Application_ApplicationExit;
Application.ApplicationExit += Application_ApplicationExit;
//set the help version before launching the main window;
//the call starts a different thread so it won't delay the main window launch;
//in most cases it is expected to have returned by the time the users request help;
//if they do before it has returned, the thread requesting help will wait for it
HelpManager.SetHelpVersion();
MainWindow mainWindow = new MainWindow(firstArgType, tailArgs);
Application.Run(mainWindow);

View File

@ -54,6 +54,8 @@ namespace XenAdmin.Core
public static readonly string ExtensionUpdate = Get("EXTENSION_UPDATE");
public static readonly string HelpPath = Get("HELP_PATH");
public static readonly string LegacyProduct = Get("LEGACY_PRODUCT");
public static readonly string LegacyConsole = Get("LEGACY_CONSOLE");

View File

@ -70,11 +70,11 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to http://docs.citrix.com/en-us/xencenter/.
/// Looks up a localized string similar to http://docs.citrix.com/en-us/.
/// </summary>
public static string HELP_URL {
public static string DOCS_URL {
get {
return ResourceManager.GetString("HELP_URL", resourceCulture);
return ResourceManager.GetString("DOCS_URL", resourceCulture);
}
}

View File

@ -156,8 +156,8 @@
<data name="UPSELL_LEARNMOREURL_TRIAL" xml:space="preserve">
<value>https://www.citrix.com/products/citrix-hypervisor/get-started.html</value>
</data>
<data name="HELP_URL" xml:space="preserve">
<value>http://docs.citrix.com/ja-jp/xencenter/</value>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/ja-jp/</value>
</data>
<data name="HELP_URL_QUERY" xml:space="preserve">
<value>?utm_campaign={0}&amp;utm_medium=ui_link&amp;utm_source={1}</value>

View File

@ -156,8 +156,8 @@
<data name="UPSELL_LEARNMOREURL_TRIAL" xml:space="preserve">
<value>https://www.citrix.com/products/citrix-hypervisor/get-started.html</value>
</data>
<data name="HELP_URL" xml:space="preserve">
<value>http://docs.citrix.com/en-us/xencenter/</value>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/en-us/</value>
</data>
<data name="HELP_URL_QUERY" xml:space="preserve">
<value>?utm_campaign={0}&amp;utm_medium=ui_link&amp;utm_source={1}</value>

View File

@ -156,8 +156,8 @@
<data name="UPSELL_LEARNMOREURL_TRIAL" xml:space="preserve">
<value>https://www.citrix.com/products/citrix-hypervisor/get-started.html</value>
</data>
<data name="HELP_URL" xml:space="preserve">
<value>http://docs.citrix.com/zh-cn/xencenter/</value>
<data name="DOCS_URL" xml:space="preserve">
<value>http://docs.citrix.com/zh-cn/</value>
</data>
<data name="HELP_URL_QUERY" xml:space="preserve">
<value>?utm_campaign={0}&amp;utm_medium=ui_link&amp;utm_source={1}</value>

View File

@ -59,6 +59,7 @@ rebranding_global()
-e "s#\[XenServer\]#${BRANDING_SERVER}#g" \
-e "s#\[XenCenter\]#${BRANDING_BRAND_CONSOLE}#g" \
-e "s#\[XenCenter_No_Space\]#${BRANDING_BRAND_CONSOLE_NO_SPACE}#g" \
-e "s#xencenter\/current-release\/#${BRANDING_HELP_PATH}#g" \
$1
}