From 686abca3c92d8fa662dba4a8b44906e7d2af2885 Mon Sep 17 00:00:00 2001 From: Mike Hatfield Date: Tue, 5 Oct 2010 15:24:52 +0000 Subject: [PATCH] ALF-4785: Update the Help URLs for 3.4 Enterprise Beta and Enterprise ALF-4583: Online Help URLs too hard-coded Share: Help URLs split out into separate config file, which is overridden for Enterprise deployments. Explorer: Help URL is templated and populated when first queried. Office add-in webscripts: Help URL is templated via I18N properties. Office add-in client: Not currently possible due to proprietary build and installer build steps. AWE: Also not currently possible without significant refactoring. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22892 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/messages/office-addin.properties | 2 +- config/alfresco/web-client-config.xml | 2 +- .../org/alfresco/web/bean/NavigationBean.java | 30 +++++++++++++++++-- source/web/scripts/office/navigation.js | 2 -- source/web/scripts/office/office_addin.js | 2 ++ 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/config/alfresco/messages/office-addin.properties b/config/alfresco/messages/office-addin.properties index 1181a8a1ab..ae9df10fe1 100644 --- a/config/alfresco/messages/office-addin.properties +++ b/config/alfresco/messages/office-addin.properties @@ -11,7 +11,7 @@ office.title.document_tags=Document Tags # Help office.help.title=Online Help -office.help.url=http://www.alfresco.com/help/34/community/msaddin/ +office.help.url=http://www.alfresco.com/help/{0}{1}/{2}/msaddin/ # Headers and Subheaders office.header.my_checked_out_documents=My Checked Out Documents diff --git a/config/alfresco/web-client-config.xml b/config/alfresco/web-client-config.xml index dd6c9d94a9..89d4584109 100644 --- a/config/alfresco/web-client-config.xml +++ b/config/alfresco/web-client-config.xml @@ -72,7 +72,7 @@ false - http://www.alfresco.com/help/34/community/ecmexplorerhelp/ + http://www.alfresco.com/help/{version.major}{version.minor}/{version.edition}/ecmexplorerhelp/ diff --git a/source/java/org/alfresco/web/bean/NavigationBean.java b/source/java/org/alfresco/web/bean/NavigationBean.java index 906f83f5e8..c5ba2442a6 100644 --- a/source/java/org/alfresco/web/bean/NavigationBean.java +++ b/source/java/org/alfresco/web/bean/NavigationBean.java @@ -25,6 +25,8 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; @@ -52,6 +54,7 @@ import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.MutableAuthenticationService; import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.descriptor.Descriptor; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.web.app.Application; import org.alfresco.web.app.context.UIContextService; @@ -498,7 +501,30 @@ public class NavigationBean implements Serializable */ public void setHelpUrl(String helpUrl) { - this.helpUrl = helpUrl; + if (this.helpUrl == null) + { + Descriptor serverDescriptor = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getDescriptorService().getServerDescriptor(); + // search / replace each available key occurrence in the template string + // Note: server descriptor is looking for "version.major", "version.minor", etc. + Pattern p = Pattern.compile("\\{(\\w+\\.?\\w+)\\}"); + Matcher m = p.matcher(helpUrl); + boolean result = m.find(); + if (result) + { + StringBuffer sb = new StringBuffer(); + String value = null; + do + { + value = serverDescriptor.getDescriptor(m.group(1)); + m.appendReplacement(sb, value != null ? value.toLowerCase() : m.group(1)); + result = m.find(); + } while (result); + m.appendTail(sb); + helpUrl = sb.toString(); + } + + this.helpUrl = helpUrl; + } } /** @@ -1047,7 +1073,7 @@ public class NavigationBean implements Serializable /* package */ void initFromClientConfig() { this.clientConfig = Application.getClientConfig(FacesContext.getCurrentInstance()); - this.helpUrl = clientConfig.getHelpUrl(); + this.setHelpUrl(clientConfig.getHelpUrl()); this.shelfExpanded = clientConfig.isShelfVisible(); } diff --git a/source/web/scripts/office/navigation.js b/source/web/scripts/office/navigation.js index 0904c15891..89e9b294f1 100644 --- a/source/web/scripts/office/navigation.js +++ b/source/web/scripts/office/navigation.js @@ -14,7 +14,6 @@ var OfficeNavigation = init: function() { - $('overlayPanel').setStyle('opacity', 0); OfficeNavigation.setupToggles(); OfficeNavigation.setupCreateSpace(); OfficeNavigation.getDocumentNames(); @@ -24,7 +23,6 @@ var OfficeNavigation = { OfficeNavigation.showCreateSpace(); } - }, setupToggles: function() diff --git a/source/web/scripts/office/office_addin.js b/source/web/scripts/office/office_addin.js index ceed520e51..dc3b6535a6 100644 --- a/source/web/scripts/office/office_addin.js +++ b/source/web/scripts/office/office_addin.js @@ -11,6 +11,8 @@ var OfficeAddin = init: function() { + $('overlayPanel').setStyle('opacity', 0); + window.queryObject = OfficeAddin.toQueryObject(document.location.search); window.contextPath = OfficeAddin.getContextPath(); window.serviceContextPath = OfficeAddin.getServiceContextPath();