diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 30f2193d96..afa350dbed 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1163,11 +1163,14 @@ change_expiration_date_change=Note: To change individual expiration dates click change_expiration_date_title=Change Expiration Date change_expiration_date_desc=This dialog allows you to change the expiration date for a modified item. expired_content_for_review=Expired Content For Review +link_validation=Link Validation run_link_validaton_title=Run Link Validation run_link_validaton_desc=This dialog shows the progress of the link validation check currently running. check_links=Check Links +check_links_info=If any broken links are found you will receive a task in your to do list to fix them. checking_links_progress=Generating links report, please wait... checking_links_status=Checked 0 links in 0 files. +view_link_validation_report=View Link Validation Report link_validation_unknown_error=An unknown error occurred during the link validation check link_validation_error=An error occurred during the link validation check link_validaton_report_title=Link Validation Report @@ -1175,6 +1178,7 @@ link_validaton_report_desc=This dialog shows the results of the last link valida initial_check=Initial check current_status=Current status files_links_checked=The check was completed at {0}, {1} file(s) were checked and {2} link(s) were found. +files_links_checked_error=The check was completed at {0} due to the error: files_links_broken={0} broken link(s) were found in {1} file(s). files_links_still_broken={0} link(s) still broken in {1} file(s). broken_links_fixed={0} broken link(s) have been fixed. diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml index 86db72f3ea..2b60c509db 100644 --- a/config/alfresco/web-client-config-dialogs.xml +++ b/config/alfresco/web-client-config-dialogs.xml @@ -314,6 +314,15 @@ + + + + + + + + + + + + + + + + + + diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java index 9d02151a0b..fc870acd87 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java @@ -49,6 +49,7 @@ public class LinkValidationReportDialog extends BaseDialogBean protected ActionService actionService; private String store; + private String cancelOutcome; private static final Log logger = LogFactory.getLog(LinkValidationReportDialog.class); @@ -65,6 +66,18 @@ public class LinkValidationReportDialog extends BaseDialogBean if (logger.isDebugEnabled()) logger.debug("Showing link validation report for store '" + store + "'"); + + String directView = parameters.get("directView"); + if (directView != null && directView.equals("true")) + { + this.cancelOutcome = super.getDefaultCancelOutcome(); + } + else + { + this.cancelOutcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "browseWebsite"; + } } @SuppressWarnings("unchecked") @@ -83,6 +96,12 @@ public class LinkValidationReportDialog extends BaseDialogBean "dialog:runLinkValidation"; } + @Override + public boolean getFinishButtonDisabled() + { + return false; + } + @Override public String getFinishButtonLabel() { @@ -98,9 +117,7 @@ public class LinkValidationReportDialog extends BaseDialogBean @Override protected String getDefaultCancelOutcome() { - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "browseWebsite"; + return this.cancelOutcome; } // ------------------------------------------------------------------------------ diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationRunDialog.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationRunDialog.java index 739f6ac3c6..d0bb284bd7 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationRunDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationRunDialog.java @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.Map; import javax.faces.context.FacesContext; +import javax.transaction.UserTransaction; import org.alfresco.linkvalidation.HrefValidationProgress; import org.alfresco.linkvalidation.LinkValidationAction; @@ -43,6 +44,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; import org.alfresco.web.bean.dialog.BaseDialogBean; +import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.ui.common.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -59,7 +61,7 @@ public class LinkValidationRunDialog extends BaseDialogBean protected ActionService actionService; private String store; - private NodeRef storeRef; + private NodeRef storePathRef; private boolean rerun = false; private static final Log logger = LogFactory.getLog(LinkValidationRunDialog.class); @@ -79,7 +81,7 @@ public class LinkValidationRunDialog extends BaseDialogBean store = parameters.get("store"); String storePath = this.store + ":/"; - this.storeRef = AVMNodeConverter.ToNodeRef(-1, storePath); + this.storePathRef = AVMNodeConverter.ToNodeRef(-1, storePath); this.rerun = false; String rerunParam = parameters.get("rerun"); @@ -104,7 +106,7 @@ public class LinkValidationRunDialog extends BaseDialogBean // create and execute the action in the background Action action = this.actionService.createAction(LinkValidationAction.NAME, args); - this.actionService.executeAction(action, this.storeRef, false, true); + this.actionService.executeAction(action, this.storePathRef, false, true); } @SuppressWarnings("unchecked") @@ -125,48 +127,65 @@ public class LinkValidationRunDialog extends BaseDialogBean // on the store the link check was run on, retrieve it and see if // the link check was successful. - PropertyValue val = this.avmService.getStoreProperty(this.store, - SandboxConstants.PROP_LINK_VALIDATION_REPORT); - if (val != null) + FacesContext context = FacesContext.getCurrentInstance(); + UserTransaction tx = null; + + try { - LinkValidationReport report = (LinkValidationReport)val.getSerializableValue(); - if (report != null) + tx = Repository.getUserTransaction(context, true); + tx.begin(); + + PropertyValue val = this.avmService.getStoreProperty(this.store, + SandboxConstants.PROP_LINK_VALIDATION_REPORT); + if (val != null) { - if (report.wasSuccessful()) + LinkValidationReport report = (LinkValidationReport)val.getSerializableValue(); + if (report != null) { - // setup the context required by the reporting components to display the results - if (this.rerun) + if (report.wasSuccessful()) { - this.avmBrowseBean.getLinkValidationState().updateState(report); + // setup the context required by the reporting components to display the results + if (this.rerun) + { + this.avmBrowseBean.getLinkValidationState().updateState(report); + } + else + { + LinkValidationState state = new LinkValidationState(this.store, report); + this.avmBrowseBean.setLinkValidationState(state); + } + + Map params = new HashMap(1); + params.put("store", this.store); + Application.getDialogManager().setupParameters(params); + + outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + + AlfrescoNavigationHandler.OUTCOME_SEPARATOR + + "dialog:linkValidationReport"; } else { - LinkValidationState state = new LinkValidationState(this.store, report); - this.avmBrowseBean.setLinkValidationState(state); + String errorMsg = Application.getMessage(context, "link_validation_unknown_error"); + Throwable cause = report.getError(); + if (cause != null) + { + errorMsg = Application.getMessage(context, "link_validation_error") + ": " + + cause.getMessage(); + } + + Utils.addErrorMessage(errorMsg); } - - Map params = new HashMap(1); - params.put("store", this.store); - Application.getDialogManager().setupParameters(params); - - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "dialog:linkValidationReport"; - } - else - { - FacesContext context = FacesContext.getCurrentInstance(); - String errorMsg = Application.getMessage(context, "link_validation_unknown_error"); - Throwable cause = report.getError(); - if (cause != null) - { - errorMsg = Application.getMessage(context, "link_validation_error") + ": " + - cause.getMessage(); - } - - Utils.addErrorMessage(errorMsg); } } + + // commit the changes + tx.commit(); + } + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} + Utils.addErrorMessage(formatErrorMessage(e), e); } return outcome; diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java index 96614864e5..73c274cb7b 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java @@ -61,20 +61,20 @@ public class LinkValidationState private Date initialCheckedCompletedAt; private boolean checkBeenReRun = false; - private int noFilesCheckedStart = 0; - private int noFilesCheckedLast = 0; + private int noFilesCheckedStart = -1; + private int noFilesCheckedLast = -1; - private int noLinksCheckedStart = 0; - private int noLinksCheckedLast = 0; + private int noLinksCheckedStart = -1; + private int noLinksCheckedLast = -1; - private int noBrokenFilesStart = 0; - private int noBrokenFilesLast = 0; + private int noBrokenFilesStart = -1; + private int noBrokenFilesLast = -1; - private int noBrokenLinksStart = 0; - private int noBrokenLinksLast = 0; + private int noBrokenLinksStart = -1; + private int noBrokenLinksLast = -1; - private int noFixedFiles = 0; - private int noFixedLinks = 0; + private int noFixedFiles = -1; + private int noFixedLinks = -1; private List brokenStaticFilesStart; private List brokenFormsStart; @@ -88,6 +88,8 @@ public class LinkValidationState private Map> brokenLinksByFile; private Map> brokenFilesByForm; + private Throwable cause; + private static Log logger = LogFactory.getLog(LinkValidationState.class); /** @@ -120,6 +122,14 @@ public class LinkValidationState return this.initialCheckedCompletedAt; } + /** + * @return The error that caused the last report to fail + */ + public Throwable getError() + { + return this.cause; + } + /** * @return The number of files checked by the initial link check */ @@ -291,7 +301,8 @@ public class LinkValidationState public String toString() { StringBuilder buffer = new StringBuilder(super.toString()); - buffer.append(" (store=").append(this.store).append(")"); + buffer.append(" (store=").append(this.store); + buffer.append(" error=").append(this.cause).append(")"); return buffer.toString(); } @@ -301,67 +312,73 @@ public class LinkValidationState public void processReport(LinkValidationReport report, boolean rerunReport) { this.checkBeenReRun = rerunReport; + this.cause = report.getError(); - if (rerunReport == false) + if (this.cause == null) { - // setup initial counts - this.noBrokenFilesStart = report.getNumberBrokenFiles(); - this.noBrokenLinksStart = report.getNumberBrokenLinks(); - this.noFilesCheckedStart = report.getNumberFilesChecked(); - this.noLinksCheckedStart = report.getNumberLinksChecked(); - this.noBrokenFilesLast = report.getNumberBrokenFiles(); - this.noBrokenLinksLast = report.getNumberBrokenLinks(); - this.noFilesCheckedLast = report.getNumberFilesChecked(); - this.noLinksCheckedLast = report.getNumberLinksChecked(); - - // setup fixed lists - this.fixedFiles = new ArrayList(this.noBrokenFilesStart); - this.fixedForms = new ArrayList(this.noBrokenFilesStart); - - // process the broken files and determine which ones are static files - // and which ones are generated - processFiles(report.getFilesWithBrokenLinks(), rerunReport, report); - } - else - { - // update the relevant counts - this.noBrokenFilesLast = report.getNumberBrokenFiles(); - this.noBrokenLinksLast = report.getNumberBrokenLinks(); - this.noFilesCheckedLast = report.getNumberFilesChecked(); - this.noLinksCheckedLast = report.getNumberLinksChecked(); - - this.noFixedFiles = this.noBrokenFilesStart - this.noBrokenFilesLast; - this.noFixedLinks = this.noBrokenLinksStart - this.noBrokenLinksLast; - - if (this.noFixedFiles < 0) + if (rerunReport == false) { + // setup initial counts + this.noBrokenFilesStart = report.getNumberBrokenFiles(); + this.noBrokenLinksStart = report.getNumberBrokenLinks(); + this.noFilesCheckedStart = report.getNumberFilesChecked(); + this.noLinksCheckedStart = report.getNumberLinksChecked(); + this.noBrokenFilesLast = report.getNumberBrokenFiles(); + this.noBrokenLinksLast = report.getNumberBrokenLinks(); + this.noFilesCheckedLast = report.getNumberFilesChecked(); + this.noLinksCheckedLast = report.getNumberLinksChecked(); this.noFixedFiles = 0; - } - if (this.noFixedLinks < 0) - { this.noFixedLinks = 0; + + // setup fixed lists + this.fixedFiles = new ArrayList(this.noBrokenFilesStart); + this.fixedForms = new ArrayList(this.noBrokenFilesStart); + + // process the broken files and determine which ones are static files + // and which ones are generated + processFiles(report.getFilesWithBrokenLinks(), rerunReport, report); } - - // process the broken files and determine which ones are static files - // and which ones are generated - processFiles(report.getFilesWithBrokenLinks(), rerunReport, report); - - // go through the list of files & forms still broken and find which ones - // were fixed in the last re-run of the report - for (String file : this.brokenStaticFilesStart) + else { - if (this.brokenStaticFilesLast.contains(file) == false && - this.fixedFiles.contains(file) == false) + // update the relevant counts + this.noBrokenFilesLast = report.getNumberBrokenFiles(); + this.noBrokenLinksLast = report.getNumberBrokenLinks(); + this.noFilesCheckedLast = report.getNumberFilesChecked(); + this.noLinksCheckedLast = report.getNumberLinksChecked(); + + this.noFixedFiles = this.noBrokenFilesStart - this.noBrokenFilesLast; + this.noFixedLinks = this.noBrokenLinksStart - this.noBrokenLinksLast; + + if (this.noFixedFiles < 0) { - this.fixedFiles.add(file); + this.noFixedFiles = 0; } - } - for (String file : this.brokenFormsStart) - { - if (this.brokenFormsLast.contains(file) == false && - this.fixedForms.contains(file) == false) + if (this.noFixedLinks < 0) { - this.fixedForms.add(file); + this.noFixedLinks = 0; + } + + // process the broken files and determine which ones are static files + // and which ones are generated + processFiles(report.getFilesWithBrokenLinks(), rerunReport, report); + + // go through the list of files & forms still broken and find which ones + // were fixed in the last re-run of the report + for (String file : this.brokenStaticFilesStart) + { + if (this.brokenStaticFilesLast.contains(file) == false && + this.fixedFiles.contains(file) == false) + { + this.fixedFiles.add(file); + } + } + for (String file : this.brokenFormsStart) + { + if (this.brokenFormsLast.contains(file) == false && + this.fixedForms.contains(file) == false) + { + this.fixedForms.add(file); + } } } } diff --git a/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java new file mode 100644 index 0000000000..73896f1977 --- /dev/null +++ b/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2005-2007 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.alfresco.web.bean.wcm; + +import java.util.HashMap; +import java.util.Map; + +import javax.faces.context.FacesContext; +import javax.transaction.UserTransaction; + +import org.alfresco.linkvalidation.LinkValidationReport; +import org.alfresco.repo.domain.PropertyValue; +import org.alfresco.sandbox.SandboxConstants; +import org.alfresco.web.app.Application; +import org.alfresco.web.bean.repository.Repository; +import org.alfresco.web.bean.workflow.ManageTaskDialog; +import org.alfresco.web.ui.common.Utils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Bean implementation for the "Manage Task" dialog when dealing + * with the "WCM Review" task specifically. + * + * @author gavinc + */ +public class ManageVerifyBrokenLinksTaskDialog extends ManageTaskDialog +{ + protected AVMBrowseBean avmBrowseBean; + + private static final Log logger = LogFactory.getLog(ManageVerifyBrokenLinksTaskDialog.class); + + // ------------------------------------------------------------------------------ + // Implementation + + @Override + public void init(Map parameters) + { + super.init(parameters); + + FacesContext context = FacesContext.getCurrentInstance(); + UserTransaction tx = null; + + try + { + tx = Repository.getUserTransaction(context, true); + tx.begin(); + + // reset any previous link validation state + this.avmBrowseBean.setLinkValidationState(null); + this.avmBrowseBean.setLinkValidationMonitor(null); + + // try and retrieve the deployment report from the workflow + // store, if present setup the validation state on AVMBrowseBean + String storeName = this.workflowPackage.getStoreRef().getIdentifier(); + + if (logger.isDebugEnabled()) + logger.debug("Retrieving link validation report for store '" + storeName + "'"); + + PropertyValue val = this.avmService.getStoreProperty(storeName, + SandboxConstants.PROP_LINK_VALIDATION_REPORT); + if (val != null) + { + LinkValidationReport report = (LinkValidationReport)val.getSerializableValue(); + if (report != null) + { + LinkValidationState state = new LinkValidationState(storeName, report); + this.avmBrowseBean.setLinkValidationState(state); + + if (logger.isDebugEnabled()) + logger.debug("Stored link validation state: " + state); + } + } + + // commit the changes + tx.commit(); + } + catch (Throwable e) + { + // rollback the transaction + try { if (tx != null) {tx.rollback();} } catch (Exception ex) {} + Utils.addErrorMessage(formatErrorMessage(e), e); + } + } + + // ------------------------------------------------------------------------------ + // Event handlers + + public String viewLinkReport() + { + String storeName = this.workflowPackage.getStoreRef().getIdentifier(); + + if (logger.isDebugEnabled()) + logger.debug("Viewing link validation report for store '" + storeName + "'"); + + Map params = new HashMap(1); + params.put("store", storeName); + params.put("directView", "true"); + Application.getDialogManager().setupParameters(params); + + return "dialog:linkValidationReport"; + } + + // ------------------------------------------------------------------------------ + // Getters and Setters + + /** + * @param avmBrowseBean AVMBrowseBean instance + */ + public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) + { + this.avmBrowseBean = avmBrowseBean; + } +} diff --git a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java index fda3c7fd78..81447d7b5e 100644 --- a/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/SubmitDialog.java @@ -97,6 +97,7 @@ public class SubmitDialog extends BaseDialogBean private String[] workflowSelectedValue; private boolean enteringExpireDate = false; private boolean startedFromWorkflow = false; + private boolean validateLinks = false; private Date defaultExpireDate; private Date launchDate; @@ -195,6 +196,7 @@ public class SubmitDialog extends BaseDialogBean this.defaultExpireDate = new Date(); this.workflowSelectedValue = null; this.launchDate = null; + this.validateLinks = false; // determine if the dialog has been started from a workflow Boolean bool = new Boolean(this.parameters.get(PARAM_STARTED_FROM_WORKFLOW)); @@ -330,6 +332,7 @@ public class SubmitDialog extends BaseDialogBean params.put(WCMWorkflowModel.PROP_FROM_PATH, AVMUtil.buildStoreRootPath(this.avmBrowseBean.getSandbox())); params.put(WCMWorkflowModel.PROP_LAUNCH_DATE, this.launchDate); + params.put(WCMWorkflowModel.PROP_VALIDATE_LINKS, new Boolean(this.validateLinks)); params.put(WCMWorkflowModel.ASSOC_WEBPROJECT, this.avmBrowseBean.getWebsite().getNodeRef()); @@ -517,6 +520,22 @@ public class SubmitDialog extends BaseDialogBean this.launchDate = launchDate; } + /** + * @return Flag to indicate whether links should be validated + */ + public boolean isValidateLinks() + { + return this.validateLinks; + } + + /** + * @param validateLinks Flag to indicate whether links should be validated + */ + public void setValidateLinks(boolean validateLinks) + { + this.validateLinks = validateLinks; + } + /** * @return List of UIListItem object representing the available workflows for the website */ 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 498926bec1..2e1bd6d690 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java @@ -72,14 +72,87 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone } // get the link validation state object to get the data from + ResourceBundle bundle = Application.getBundle(context); ResponseWriter out = context.getResponseWriter(); LinkValidationState linkState = getValue(); if (logger.isDebugEnabled()) logger.debug("Rendering summary from state object: " + linkState); - // resolve all the strings holding data - ResourceBundle bundle = Application.getBundle(context); + if (linkState.getError() == null) + { + Object initialCheckOnly = this.getAttributes().get("initialCheckOnly"); + if (initialCheckOnly instanceof Boolean && + ((Boolean)initialCheckOnly).booleanValue()) + { + out.write("
"); + renderInitialCheckSummary(context, out, linkState, bundle); + out.write("
"); + } + else + { + String pattern = bundle.getString("files_links_still_broken"); + String stillBroken = MessageFormat.format(pattern, + new Object[] {linkState.getNumberBrokenFiles(), linkState.getNumberBrokenLinks()}); + pattern = bundle.getString("broken_links_fixed"); + 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("
"); + out.write(bundle.getString("summary")); + out.write("
"); + out.write(""); + out.write("
"); + out.write(bundle.getString("initial_check")); + out.write(":"); + renderInitialCheckSummary(context, out, linkState, bundle); + out.write("
"); + out.write(bundle.getString("current_status")); + out.write(":
"); + out.write(stillBroken); + out.write(""); + out.write(linksFixed); + out.write("  "); + Utils.encodeRecursive(context, updateStatusAction); + out.write("
"); + } + } + else + { + String pattern = bundle.getString("files_links_checked_error"); + Date initialCheck = linkState.getInitialCheckCompletedAt(); + String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck); + String initialCheckSummary = MessageFormat.format(pattern, + new Object[] {initialCheckTime}); + + out.write("
"); + out.write(initialCheckSummary); + out.write(" "); + String err = linkState.getError().getMessage(); + if (err == null) + { + out.write(linkState.getError().toString()); + } + else + { + out.write(err); + } + out.write("
"); + } + } + + protected void renderInitialCheckSummary(FacesContext context, + ResponseWriter out, LinkValidationState linkState, + ResourceBundle bundle) throws IOException + { String pattern = bundle.getString("files_links_checked"); Date initialCheck = linkState.getInitialCheckCompletedAt(); String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck); @@ -89,45 +162,16 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone pattern = bundle.getString("files_links_broken"); String initialBrokenSummary = MessageFormat.format(pattern, new Object[] {linkState.getInitialNumberBrokenFiles(), linkState.getInitialNumberBrokenLinks()}); - pattern = bundle.getString("files_links_still_broken"); - String stillBroken = MessageFormat.format(pattern, - new Object[] {linkState.getNumberBrokenFiles(), linkState.getNumberBrokenLinks()}); - pattern = bundle.getString("broken_links_fixed"); - 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("
"); - out.write(bundle.getString("summary")); - out.write("
"); - out.write(""); - out.write(""); - out.write("
"); - out.write(bundle.getString("initial_check")); - out.write(":
"); + out.write("
"); out.write(initialCheckSummary); out.write("
"); out.write(initialBrokenSummary); - out.write("
"); - out.write(bundle.getString("current_status")); - out.write(":
"); - out.write(stillBroken); - out.write(""); - out.write(linksFixed); - out.write("  "); - Utils.encodeRecursive(context, updateStatusAction); - out.write("
"); + out.write(""); } - + @SuppressWarnings("unchecked") private UICommand aquireAction(FacesContext context, String actionId) { diff --git a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java b/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java index 225833ae06..da8ab72849 100644 --- a/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java +++ b/source/java/org/alfresco/web/ui/wcm/tag/LinkValidationSummaryTag.java @@ -36,6 +36,7 @@ import org.alfresco.web.ui.common.tag.HtmlComponentTag; public class LinkValidationSummaryTag extends HtmlComponentTag { private String value; + private String initialCheckOnly; /** * @see javax.faces.webapp.UIComponentTag#getComponentType() @@ -61,6 +62,7 @@ public class LinkValidationSummaryTag extends HtmlComponentTag super.setProperties(component); setStringProperty(component, "value", this.value); + setBooleanProperty(component, "initialCheckOnly", this.initialCheckOnly); } /** @@ -70,6 +72,7 @@ public class LinkValidationSummaryTag extends HtmlComponentTag { super.release(); this.value = null; + this.initialCheckOnly = null; } /** @@ -79,4 +82,12 @@ public class LinkValidationSummaryTag extends HtmlComponentTag { this.value = value; } + + /** + * @param initialCheckOnly true will make the component only show the initial check summary info + */ + public void setInitialCheckOnly(String initialCheckOnly) + { + this.initialCheckOnly = initialCheckOnly; + } } diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 05af4501fb..660f1ffc2e 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2136,6 +2136,59 @@ #{AVMBrowseBean} + + + + The bean that backs up the Verify Broken Links Task Dialog + + ManageVerifyBrokenLinksTaskDialog + org.alfresco.web.bean.wcm.ManageVerifyBrokenLinksTaskDialog + session + + nodeService + #{NodeService} + + + fileFolderService + #{FileFolderService} + + + searchService + #{SearchService} + + + navigator + #{NavigationBean} + + + browseBean + #{BrowseBean} + + + dictionaryService + #{DictionaryService} + + + namespaceService + #{NamespaceService} + + + workflowService + #{WorkflowService} + + + avmService + #{AVMService} + + + avmSyncService + #{AVMSyncService} + + + avmBrowseBean + #{AVMBrowseBean} + + diff --git a/source/web/WEB-INF/wcm.tld b/source/web/WEB-INF/wcm.tld index 2cc1f7e6aa..dea1412e87 100644 --- a/source/web/WEB-INF/wcm.tld +++ b/source/web/WEB-INF/wcm.tld @@ -302,6 +302,13 @@ The link validation state object holding the report data + + initialCheckOnly + false + true + Only shows the initial check summary if set to true, false by default + + id false diff --git a/source/web/jsp/wcm/manage-broken-links-task-dialog.jsp b/source/web/jsp/wcm/manage-broken-links-task-dialog.jsp new file mode 100644 index 0000000000..3f51349b7b --- /dev/null +++ b/source/web/jsp/wcm/manage-broken-links-task-dialog.jsp @@ -0,0 +1,185 @@ +<%-- + * Copyright (C) 2005-2007 Alfresco Software Limited. + + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" +--%> +<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> +<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- Name column --%> + + + + + + + + + + + + <%-- Description column --%> + + + + + + + + <%-- Path column --%> + + + + + + + + <%-- Created Date column --%> + + + + + + + + + + <%-- Modified Date column --%> + + + + + + + + + + <%-- Expiration Date column --%> + + + + + + + + + + <%-- Actions column --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + + + + + diff --git a/source/web/jsp/wcm/submit-dialog.jsp b/source/web/jsp/wcm/submit-dialog.jsp index 608fa3b733..1f7904a8dd 100644 --- a/source/web/jsp/wcm/submit-dialog.jsp +++ b/source/web/jsp/wcm/submit-dialog.jsp @@ -79,6 +79,15 @@ onkeyup="javascript:checkButtonState();" /> +<%-- + + + + + + +--%> +