- Added update status button to status area of links management report which now does an incremental report

- Re-Run report button now runs fresh report
- Generated files are now in a collapsable panel (closed by default)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-06-13 14:44:27 +00:00
parent 6bdd49ffc7
commit 1bbbb2b4ca
6 changed files with 128 additions and 18 deletions

View File

@@ -76,7 +76,6 @@ public class LinkValidationReportDialog extends BaseDialogBean
Map<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
params.put("rerun", "true");
Application.getDialogManager().setupParameters(params);
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
@@ -110,6 +109,24 @@ public class LinkValidationReportDialog extends BaseDialogBean
"browseWebsite";
}
// ------------------------------------------------------------------------------
// Event handlers
public String updateStatus()
{
if (logger.isDebugEnabled())
logger.debug("Updating status for link validation report for store '" + store + "'");
Map<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
params.put("rerun", "true");
Application.getDialogManager().setupParameters(params);
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
"dialog:runLinkValidation";
}
// ------------------------------------------------------------------------------
// Bean getters and setters

View File

@@ -79,6 +79,10 @@ public class UILinkValidationBrokenForms extends AbstractLinkValidationReportCom
if (logger.isDebugEnabled())
logger.debug("Rendering broken forms from state object: " + linkState);
out.write("<script type='text/javascript' src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/scripts/ajax/link-validation-report.js'></script>\n");
// render the list of broken files and their contained links
out.write("<div class='linkValidationBrokenFormsPanel'><div class='linkValidationReportTitle'>");
out.write(Application.getMessage(context, "forms_with_broken_links"));
@@ -115,6 +119,14 @@ public class UILinkValidationBrokenForms extends AbstractLinkValidationReportCom
String formName = formNamePath[0];
String formPath = formNamePath[1];
// setup the context for the actions
AVMNodeDescriptor desc = avmService.lookup(-1, file);
AVMNode node = new AVMNode(desc);
actions.setContext(node);
// generate a unique id for this form
String formId = this.getId() + "_" + desc.getId();
// render the row with the appropriate background style
out.write("<tr class='");
@@ -138,9 +150,14 @@ public class UILinkValidationBrokenForms extends AbstractLinkValidationReportCom
out.write(formName);
out.write("</div><div style='padding-top: 2px;'>");
out.write(formPath);
out.write("</div><div style='padding-top: 4px; color: #888;'>");
out.write("</div><div style='padding-top: 4px; color: #888;'><img src='/alfresco/images/icons/arrow_closed.gif' ");
out.write("onclick='Alfresco.toggleGeneratedFiles(this, \"");
out.write(formId);
out.write("\");return false;' style='vertical-align: -6px; padding-right: 2px;' class='collapsed' />");
out.write(Application.getMessage(context, "generated_files"));
out.write(":</div><div style='padding-top: 2px;'>");
out.write(":</div><div style='padding-top: 2px; display: none;' id='");
out.write(formId);
out.write("'>");
for (String brokenFile : linkState.getBrokenFilesByForm(file))
{
@@ -158,10 +175,7 @@ public class UILinkValidationBrokenForms extends AbstractLinkValidationReportCom
out.write("</td><td align='right' valign='top'><div style='white-space: nowrap; padding-top: 10px; padding-right: 20px;'>");
out.write("&nbsp;");
// setup the context for the actions
AVMNodeDescriptor desc = avmService.lookup(-1, file);
AVMNode node = new AVMNode(desc);
actions.setContext(node);
// render the actions
Utils.encodeRecursive(context, actions);

View File

@@ -27,14 +27,19 @@ package org.alfresco.web.ui.wcm.component;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
import java.util.ResourceBundle;
import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.el.MethodBinding;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.wcm.LinkValidationState;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -91,6 +96,9 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
String linksFixed = MessageFormat.format(pattern,
new Object[] {linkState.getNumberFixedLinks()});
// get the action to update the current status
UICommand updateStatusAction = aquireAction(context, "update_status_" + linkState.getStore());
// render the summary area
out.write("<div class='linkValidationSummaryPanel'><div class='linkValidationReportTitle'>");
out.write(bundle.getString("summary"));
@@ -114,7 +122,40 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/fixed_link.gif' style='vertical-align: -4px; padding-left: 6px; padding-right: 4px;' >");
out.write(linksFixed);
out.write("&nbsp;&nbsp;");
Utils.encodeRecursive(context, updateStatusAction);
out.write("</div></td></tr>");
out.write("</table></div>");
}
@SuppressWarnings("unchecked")
private UICommand aquireAction(FacesContext context, String actionId)
{
UICommand action = null;
// try find the action as a child of this component
for (UIComponent component : (List<UIComponent>)getChildren())
{
if (actionId.equals(component.getId()))
{
action = (UIActionLink)component;
break;
}
}
if (action == null)
{
// create the action and add as a child component
javax.faces.application.Application facesApp = context.getApplication();
action = (UICommand)facesApp.createComponent(UICommand.COMPONENT_TYPE);
action.setId(actionId);
action.setValue(Application.getMessage(context, "update_status"));
MethodBinding binding = facesApp.createMethodBinding("#{DialogManager.bean.updateStatus}",
new Class[] {});
action.setAction(binding);
this.getChildren().add(action);
}
return action;
}
}

View File

@@ -788,7 +788,7 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
.linkValidationList
{
overflow: auto;
height: 130px;
height: 132px;
border: 1px solid #aaa;
}

View File

@@ -5,11 +5,13 @@ Alfresco.LinkValidationMonitor = function()
this.successMsg = '';
}
Alfresco.LinkValidationMonitor.prototype = {
Alfresco.LinkValidationMonitor.prototype =
{
url: null,
failedMsg: null,
successMsg: null,
retrieveLinkValidationStatus: function() {
retrieveLinkValidationStatus: function()
{
YAHOO.util.Connect.asyncRequest('GET', this.url,
{
success: this.processResults,
@@ -18,34 +20,42 @@ Alfresco.LinkValidationMonitor.prototype = {
},
null);
},
processResults: function(ajaxResponse) {
processResults: function(ajaxResponse)
{
var xml = ajaxResponse.responseXML.documentElement;
var finished = xml.getAttribute('finished');
var fileCount = xml.getAttribute('file-count');
var linkCount = xml.getAttribute('link-count');
var fileCountElem = document.getElementById('file-count');
if (fileCountElem != null) {
if (fileCountElem != null)
{
fileCountElem.innerHTML = fileCount;
}
var linkCountElem = document.getElementById('link-count');
if (linkCountElem != null) {
if (linkCountElem != null)
{
linkCountElem.innerHTML = linkCount;
}
if (finished == 'true') {
if (finished == 'true')
{
var linkOnclick = document.getElementById('validation-callback-link').onclick;
linkOnclick();
} else {
}
else
{
setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', 2000);
}
},
handleError: function(ajaxResponse) {
handleError: function(ajaxResponse)
{
handleErrorYahoo(ajaxResponse.status + ' ' + ajaxResponse.statusText);
}
}
Alfresco.initLinkValidationMonitor = function() {
Alfresco.initLinkValidationMonitor = function()
{
Alfresco.linkMonitor = new Alfresco.LinkValidationMonitor();
Alfresco.linkMonitor.retrieveLinkValidationStatus();
}

View File

@@ -0,0 +1,28 @@
Alfresco.toggleGeneratedFiles = function(icon, genFilesId)
{
var currentState = icon.className;
var genFilesDiv = document.getElementById(genFilesId);
if (currentState == "collapsed")
{
icon.src = getContextPath() + "/images/icons/arrow_open.gif";
icon.className = "expanded";
// show the div holding the generated files
if (genFilesDiv != null)
{
genFilesDiv.style.display = "block";
}
}
else
{
icon.src = getContextPath() + "/images/icons/arrow_closed.gif";
icon.className = "collapsed";
// hide the div holding the generated files
if (genFilesDiv != null)
{
genFilesDiv.style.display = "none";
}
}
}