From 7a35bf371574a169e43b8ee87c9609db1cea1e1f Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Thu, 21 Jun 2007 22:19:13 +0000 Subject: [PATCH] - Links management UI - Made AJAX polling frequency configurable - Made connection and read timeout values configurable - Added panel around summary area - Removed use of shadowed panels for staging area and user sandboxes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6061 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/web-client-config-wcm.xml | 5 ++ .../org/alfresco/web/bean/wcm/AVMUtil.java | 61 ++++++++++++++++++- .../component/UILinkValidationProgress.java | 8 +++ .../component/UILinkValidationSummary.java | 21 +++++-- .../web/ui/wcm/component/UIUserSandboxes.java | 4 +- source/web/jsp/wcm/browse-website.jsp | 4 +- .../scripts/ajax/link-validation-progress.js | 6 +- 7 files changed, 93 insertions(+), 16 deletions(-) diff --git a/config/alfresco/web-client-config-wcm.xml b/config/alfresco/web-client-config-wcm.xml index 1331e828c4..2c3b3d68be 100644 --- a/config/alfresco/web-client-config-wcm.xml +++ b/config/alfresco/web-client-config-wcm.xml @@ -26,6 +26,11 @@ 30 + + + + 2 + * * @return Number of seconds between each call to the server (in seconds). - * The default is 5. + * The default is 2. */ public static int getRemoteDeploymentPollingFrequency() { - int pollFreq = 5; + int pollFreq = 2; ConfigElement deploymentConfig = getDeploymentConfig(); if (deploymentConfig != null) @@ -443,6 +443,45 @@ public final class AVMUtil return delay; } + /** + * Returns the number of seconds between each call back to the server to + * obtain the latest status of a link validation check. + *

+ * This value is read from the <wcm> config section in + * web-client-config-wcm.xml + *

+ * + * @return Number of seconds between each call to the server (in seconds). + * The default is 2. + */ + public static int getLinkValidationPollingFrequency() + { + int pollFreq = 2; + + ConfigElement linkMngmtConfig = getLinksManagementConfig(); + if (linkMngmtConfig != null) + { + ConfigElement elem = linkMngmtConfig.getChild("progress-polling-frequency"); + if (elem != null) + { + try + { + int value = Integer.parseInt(elem.getValue()); + if (value > 0) + { + pollFreq = value; + } + } + catch (NumberFormatException nfe) + { + // do nothing, just use the default + } + } + } + + return pollFreq; + } + /** * Returns the main staging store name for the specified store id. * @@ -969,6 +1008,21 @@ public final class AVMUtil return deploymentConfig; } + private static ConfigElement getLinksManagementConfig() + { + if (linksManagementConfig == null) + { + ConfigService cfgService = Application.getConfigService(FacesContext.getCurrentInstance()); + ConfigElement wcmCfg = cfgService.getGlobalConfig().getConfigElement("wcm"); + if (wcmCfg != null) + { + linksManagementConfig = wcmCfg.getChild("links-management"); + } + } + + return linksManagementConfig; + } + // Component Separator. private static final String STORE_SEPARATOR = "--"; @@ -999,5 +1053,6 @@ public final class AVMUtil Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW + "/" + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)"); - private static ConfigElement deploymentConfig = null; + private static ConfigElement deploymentConfig = null; + private static ConfigElement linksManagementConfig = null; } diff --git a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationProgress.java b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationProgress.java index 9c87a4011f..850ff25a5a 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationProgress.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationProgress.java @@ -33,6 +33,7 @@ import javax.faces.context.ResponseWriter; import javax.faces.el.MethodBinding; import org.alfresco.web.app.Application; +import org.alfresco.web.bean.wcm.AVMUtil; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.SelfRenderingComponent; import org.alfresco.web.ui.common.component.UIActionLink; @@ -85,7 +86,14 @@ public class UILinkValidationProgress extends SelfRenderingComponent UIActionLink action = findOrCreateHiddenAction(context); Utils.encodeRecursive(context, action); + // determine the polling frequency value + int pollFreq = AVMUtil.getLinkValidationPollingFrequency(); + // output the script + out.write("\n"); out.write("\n"); diff --git a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java index 71374a51da..239fd47abd 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java @@ -38,6 +38,7 @@ import javax.faces.el.MethodBinding; import org.alfresco.web.app.Application; import org.alfresco.web.bean.wcm.LinkValidationState; +import org.alfresco.web.ui.common.PanelGenerator; import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.component.UIActionLink; import org.apache.commons.logging.Log; @@ -101,10 +102,16 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone // get the action to update the current status UICommand updateStatusAction = aquireAction(context, "update_status_" + linkState.getStore()); - // render the summary area - out.write("
"); + + out.write("
"); + + // render the summary area with a surrounding panel + PanelGenerator.generatePanelStart(out, context.getExternalContext().getRequestContextPath(), + "innerwhite", "white"); + + out.write("
"); out.write(bundle.getString("summary")); - out.write("
"); + out.write("
"); out.write(""); - out.write("
"); out.write(bundle.getString("initial_check")); out.write(":"); @@ -122,7 +129,13 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone out.write("  "); Utils.encodeRecursive(context, updateStatusAction); out.write("
"); + out.write(""); + + // finish the surrounding panel + PanelGenerator.generatePanelEnd(out, context.getExternalContext().getRequestContextPath(), + "innerwhite"); + + out.write("
"); } } else diff --git a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java index 80cc5b98f9..60e5d583de 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -344,7 +344,7 @@ public class UIUserSandboxes extends SelfRenderingComponent // for each user sandbox, generate an outer panel table PanelGenerator.generatePanelStart(out, context.getExternalContext().getRequestContextPath(), - "white", + "innerwhite", "white"); // components for the current username, preview, browse and modified items inner list @@ -481,7 +481,7 @@ public class UIUserSandboxes extends SelfRenderingComponent // end the outer panel for this sandbox PanelGenerator.generatePanelEnd(out, context.getExternalContext().getRequestContextPath(), - "white"); + "innerwhite"); // spacer row if (index++ < userInfoRefs.size() - 1) diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index 5610c1bb84..12235414e4 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -130,7 +130,7 @@ <%-- Staging Sandbox Info --%> - <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "lbgrey", "white"); %> + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "innerwhite", "white"); %>
@@ -213,7 +213,7 @@
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "lbgrey"); %> + <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "innerwhite"); %>
diff --git a/source/web/scripts/ajax/link-validation-progress.js b/source/web/scripts/ajax/link-validation-progress.js index a6bf7871b5..601fdf8a9f 100644 --- a/source/web/scripts/ajax/link-validation-progress.js +++ b/source/web/scripts/ajax/link-validation-progress.js @@ -1,15 +1,11 @@ Alfresco.LinkValidationMonitor = function() { this.url = getContextPath() + '/ajax/invoke/LinkValidationProgressBean.getStatus'; - this.failedMsg = ''; - this.successMsg = ''; } Alfresco.LinkValidationMonitor.prototype = { url: null, - failedMsg: null, - successMsg: null, retrieveLinkValidationStatus: function() { YAHOO.util.Connect.asyncRequest('GET', this.url, @@ -45,7 +41,7 @@ Alfresco.LinkValidationMonitor.prototype = } else { - setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', 2000); + setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', Alfresco.linkMonitorPollFreq*1000); } }, handleError: function(ajaxResponse)