- 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
This commit is contained in:
Gavin Cornwell
2007-06-21 22:19:13 +00:00
parent 228f72296c
commit 7a35bf3715
7 changed files with 93 additions and 16 deletions

View File

@@ -27,6 +27,11 @@
<delay>30</delay> <delay>30</delay>
</deployment> </deployment>
<links-management>
<!-- frequency (in seconds) of polling checks to get latest status of a link check -->
<progress-polling-frequency>2</progress-polling-frequency>
</links-management>
<xforms> <xforms>
<widget xforms-type="xf:group" <widget xforms-type="xf:group"
appearance="minimal" appearance="minimal"

View File

@@ -335,11 +335,11 @@ public final class AVMUtil
* </p> * </p>
* *
* @return Number of seconds between each call to the server (in seconds). * @return Number of seconds between each call to the server (in seconds).
* The default is 5. * The default is 2.
*/ */
public static int getRemoteDeploymentPollingFrequency() public static int getRemoteDeploymentPollingFrequency()
{ {
int pollFreq = 5; int pollFreq = 2;
ConfigElement deploymentConfig = getDeploymentConfig(); ConfigElement deploymentConfig = getDeploymentConfig();
if (deploymentConfig != null) if (deploymentConfig != null)
@@ -443,6 +443,45 @@ public final class AVMUtil
return delay; return delay;
} }
/**
* Returns the number of seconds between each call back to the server to
* obtain the latest status of a link validation check.
* <p>
* This value is read from the &lt;wcm&gt; config section in
* web-client-config-wcm.xml
* </p>
*
* @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. * Returns the main staging store name for the specified store id.
* *
@@ -969,6 +1008,21 @@ public final class AVMUtil
return deploymentConfig; 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. // Component Separator.
private static final String STORE_SEPARATOR = "--"; private static final String STORE_SEPARATOR = "--";
@@ -1000,4 +1054,5 @@ public final class AVMUtil
"/" + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)"); "/" + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)");
private static ConfigElement deploymentConfig = null; private static ConfigElement deploymentConfig = null;
private static ConfigElement linksManagementConfig = null;
} }

View File

@@ -33,6 +33,7 @@ import javax.faces.context.ResponseWriter;
import javax.faces.el.MethodBinding; import javax.faces.el.MethodBinding;
import org.alfresco.web.app.Application; 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.Utils;
import org.alfresco.web.ui.common.component.SelfRenderingComponent; import org.alfresco.web.ui.common.component.SelfRenderingComponent;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -85,7 +86,14 @@ public class UILinkValidationProgress extends SelfRenderingComponent
UIActionLink action = findOrCreateHiddenAction(context); UIActionLink action = findOrCreateHiddenAction(context);
Utils.encodeRecursive(context, action); Utils.encodeRecursive(context, action);
// determine the polling frequency value
int pollFreq = AVMUtil.getLinkValidationPollingFrequency();
// output the script // output the script
out.write("<script type='text/javascript'>");
out.write("Alfresco.linkMonitorPollFreq = ");
out.write(Integer.toString(pollFreq));
out.write(";</script>\n");
out.write("<script type='text/javascript' src='"); out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath()); out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/link-validation-progress.js'></script>\n"); out.write("/scripts/ajax/link-validation-progress.js'></script>\n");

View File

@@ -38,6 +38,7 @@ import javax.faces.el.MethodBinding;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.wcm.LinkValidationState; 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.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@@ -101,10 +102,16 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
// get the action to update the current status // get the action to update the current status
UICommand updateStatusAction = aquireAction(context, "update_status_" + linkState.getStore()); UICommand updateStatusAction = aquireAction(context, "update_status_" + linkState.getStore());
// render the summary area
out.write("<div class='linkValidationSummaryPanel'><div class='linkValidationReportTitle'>"); out.write("<div class='linkValidationSummaryPanel'>");
// render the summary area with a surrounding panel
PanelGenerator.generatePanelStart(out, context.getExternalContext().getRequestContextPath(),
"innerwhite", "white");
out.write("<div class='linkValidationReportTitle'>");
out.write(bundle.getString("summary")); out.write(bundle.getString("summary"));
out.write("</div><table cellpadding='0' cellspacing='0'><tr>"); out.write("</div><table cellpadding='0' cellspacing='0' style='margin-bottom: 6px;'><tr>");
out.write("<td valign='top' class='linkValidationReportSubTitle'>"); out.write("<td valign='top' class='linkValidationReportSubTitle'>");
out.write(bundle.getString("initial_check")); out.write(bundle.getString("initial_check"));
out.write(":</td><td>"); out.write(":</td><td>");
@@ -122,7 +129,13 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
out.write("&nbsp;&nbsp;"); out.write("&nbsp;&nbsp;");
Utils.encodeRecursive(context, updateStatusAction); Utils.encodeRecursive(context, updateStatusAction);
out.write("</div></td></tr>"); out.write("</div></td></tr>");
out.write("</table></div>"); out.write("</table>");
// finish the surrounding panel
PanelGenerator.generatePanelEnd(out, context.getExternalContext().getRequestContextPath(),
"innerwhite");
out.write("</div>");
} }
} }
else else

View File

@@ -344,7 +344,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
// for each user sandbox, generate an outer panel table // for each user sandbox, generate an outer panel table
PanelGenerator.generatePanelStart(out, PanelGenerator.generatePanelStart(out,
context.getExternalContext().getRequestContextPath(), context.getExternalContext().getRequestContextPath(),
"white", "innerwhite",
"white"); "white");
// components for the current username, preview, browse and modified items inner list // 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 // end the outer panel for this sandbox
PanelGenerator.generatePanelEnd(out, PanelGenerator.generatePanelEnd(out,
context.getExternalContext().getRequestContextPath(), context.getExternalContext().getRequestContextPath(),
"white"); "innerwhite");
// spacer row // spacer row
if (index++ < userInfoRefs.size() - 1) if (index++ < userInfoRefs.size() - 1)

View File

@@ -130,7 +130,7 @@
<a:panel id="staging-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle" label="#{msg.staging_sandbox}"> <a:panel id="staging-panel" border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle" label="#{msg.staging_sandbox}">
<%-- Staging Sandbox Info --%> <%-- Staging Sandbox Info --%>
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "lbgrey", "white"); %> <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "innerwhite", "white"); %>
<table cellspacing=2 cellpadding=2 border=0 width=100%> <table cellspacing=2 cellpadding=2 border=0 width=100%>
<tr> <tr>
<td align=left width=32> <td align=left width=32>
@@ -213,7 +213,7 @@
</td> </td>
</tr> </tr>
</table> </table>
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "lbgrey"); %> <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "innerwhite"); %>
</a:panel> </a:panel>

View File

@@ -1,15 +1,11 @@
Alfresco.LinkValidationMonitor = function() Alfresco.LinkValidationMonitor = function()
{ {
this.url = getContextPath() + '/ajax/invoke/LinkValidationProgressBean.getStatus'; this.url = getContextPath() + '/ajax/invoke/LinkValidationProgressBean.getStatus';
this.failedMsg = '';
this.successMsg = '';
} }
Alfresco.LinkValidationMonitor.prototype = Alfresco.LinkValidationMonitor.prototype =
{ {
url: null, url: null,
failedMsg: null,
successMsg: null,
retrieveLinkValidationStatus: function() retrieveLinkValidationStatus: function()
{ {
YAHOO.util.Connect.asyncRequest('GET', this.url, YAHOO.util.Connect.asyncRequest('GET', this.url,
@@ -45,7 +41,7 @@ Alfresco.LinkValidationMonitor.prototype =
} }
else else
{ {
setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', 2000); setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', Alfresco.linkMonitorPollFreq*1000);
} }
}, },
handleError: function(ajaxResponse) handleError: function(ajaxResponse)