diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 178f372c1f..52a038438e 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1168,8 +1168,6 @@ 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... @@ -1177,8 +1175,8 @@ checking_links_status=Checked 0 links in args = new HashMap(1, 1.0f); - args.put(LinkValidationAction.PARAM_MONITOR, monitor); - args.put(LinkValidationAction.PARAM_COMPARE_TO_STAGING, new Boolean(this.compareToStaging)); - this.avmBrowseBean.setLinkValidationMonitor(monitor); - - // create and execute the action in the background - Action action = this.actionService.createAction(LinkValidationAction.NAME, args); - this.actionService.executeAction(action, this.webappPathRef, false, true); } @SuppressWarnings("unchecked") @Override protected String finishImpl(FacesContext context, String outcome) throws Exception { - return outcome; + if (logger.isDebugEnabled()) + logger.debug("Starting fresh link validation check for webapp '" + this.webappPath + "'"); + + // indicate we need a new report produced then execute + this.update = false; + this.runningReport = true; + executeReport(); + + return null; + } + + @Override + public boolean getFinishButtonDisabled() + { + return this.runningReport; + } + + @Override + public String getFinishButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "rerun_report"); + } + + @Override + public String getCancelButtonLabel() + { + return Application.getMessage(FacesContext.getCurrentInstance(), "close"); } // ------------------------------------------------------------------------------ @@ -136,7 +172,18 @@ public class LinkValidationRunDialog extends BaseDialogBean public String linkCheckCompleted() { - String outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; + String outcome = null; + + // indicate that we are now showing a report + this.runningReport = false; + + if (logger.isDebugEnabled()) + { + if (this.update) + logger.debug("Link check has completed, updating state object"); + else + logger.debug("Link check has completed, creating state object"); + } // the link validation report should be stored as a store property // on the store the link check was run on, retrieve it and see if @@ -157,41 +204,15 @@ public class LinkValidationRunDialog extends BaseDialogBean LinkValidationReport report = (LinkValidationReport)val.getSerializableValue(); if (report != null) { - if (report.wasSuccessful()) + // setup the context required by the reporting components to display the results + if (this.update) { - // setup the context required by the reporting components to display the results - if (this.update) - { - this.avmBrowseBean.getLinkValidationState().updateState(report); - } - else - { - LinkValidationState state = new LinkValidationState(report); - this.avmBrowseBean.setLinkValidationState(state); - } - - Map params = new HashMap(1); - params.put("store", this.store); - params.put("webapp", this.webapp); - params.put("fromTaskDialog", this.fromTaskDialog); - params.put("compareToStaging", Boolean.toString(this.compareToStaging)); - Application.getDialogManager().setupParameters(params); - - outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "dialog:linkValidationReport"; + this.avmBrowseBean.getLinkValidationState().updateState(report); } else { - 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); + LinkValidationState state = new LinkValidationState(report); + this.avmBrowseBean.setLinkValidationState(state); } } } @@ -209,9 +230,63 @@ public class LinkValidationRunDialog extends BaseDialogBean return outcome; } + /** + * Sets up the dialog to update the status and display the differences + * + * @return The outcome, null to stay on this page + */ + public String updateStatus() + { + if (logger.isDebugEnabled()) + logger.debug("Updating status for link validation report for webapp '" + this.webappPath + "'"); + + // indicate we need an update report produced then execute + this.update = true; + this.runningReport = true; + executeReport(); + + return null; + } + + // ------------------------------------------------------------------------------ + // Helpers + + protected void executeReport() + { + if (logger.isDebugEnabled()) + logger.debug("Creating LinkValidationAction to run report for webapp '" + this.webappPath + "'"); + + // create context required to run and monitor the link check + HrefValidationProgress monitor = new HrefValidationProgress(); + Map args = new HashMap(1, 1.0f); + args.put(LinkValidationAction.PARAM_MONITOR, monitor); + args.put(LinkValidationAction.PARAM_COMPARE_TO_STAGING, new Boolean(this.compareToStaging)); + this.avmBrowseBean.setLinkValidationMonitor(monitor); + + // create and execute the action in the background + Action action = this.actionService.createAction(LinkValidationAction.NAME, args); + this.actionService.executeAction(action, this.webappPathRef, false, true); + } + // ------------------------------------------------------------------------------ // Bean getters and setters + /** + * @return true if the dialog is currently running a report + */ + public boolean getRunningReport() + { + return this.runningReport; + } + + /** + * @return true if the dialog is currently showing a report + */ + public boolean getShowingReport() + { + return !this.runningReport; + } + /** * @param avmBrowseBean The AVM BrowseBean to set */ diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java deleted file mode 100644 index 12d67e5944..0000000000 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationReportDialog.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * 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 org.alfresco.service.cmr.action.ActionService; -import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.util.ParameterCheck; -import org.alfresco.web.app.AlfrescoNavigationHandler; -import org.alfresco.web.app.Application; -import org.alfresco.web.bean.dialog.BaseDialogBean; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Implementation of the link validation report dialog. - * - * @author gavinc - */ -public class LinkValidationReportDialog extends BaseDialogBean -{ - protected AVMBrowseBean avmBrowseBean; - protected AVMService avmService; - protected ActionService actionService; - - private String store; - private String webapp; - private String webappPath; - private String cancelOutcome; - private String fromTaskDialog; - private String compareToStaging; - - private static final Log logger = LogFactory.getLog(LinkValidationReportDialog.class); - - // ------------------------------------------------------------------------------ - // Dialog implementation - - @Override - public void init(Map parameters) - { - super.init(parameters); - - // check required params are present - this.store = parameters.get("store"); - this.webapp = parameters.get("webapp"); - ParameterCheck.mandatoryString("store", this.store); - ParameterCheck.mandatoryString("webapp", this.webapp); - - // setup context for dialog - this.webappPath = AVMUtil.buildStoreWebappPath(this.store, this.webapp); - this.compareToStaging = parameters.get("compareToStaging"); - - if (logger.isDebugEnabled()) - logger.debug("Showing link validation report for webapp '" + webappPath + "'"); - - // use a different cancel outcome if we were launched from the task dialog - this.fromTaskDialog = parameters.get("fromTaskDialog"); - if (this.fromTaskDialog != null && this.fromTaskDialog.equals("true")) - { - this.cancelOutcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "myalfresco"; - } - else - { - this.cancelOutcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "browseWebsite"; - } - } - - @SuppressWarnings("unchecked") - @Override - protected String finishImpl(FacesContext context, String outcome) throws Exception - { - if (logger.isDebugEnabled()) - logger.debug("Re-running link validation report for webapp '" + this.webappPath + "'"); - - Map params = new HashMap(1); - params.put("store", this.store); - params.put("webapp", this.webapp); - params.put("fromTaskDialog", this.fromTaskDialog); - params.put("compareToStaging", this.compareToStaging); - Application.getDialogManager().setupParameters(params); - - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "dialog:runLinkValidation"; - } - - @Override - public boolean getFinishButtonDisabled() - { - return false; - } - - @Override - public String getFinishButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "rerun_report"); - } - - @Override - public String getCancelButtonLabel() - { - return Application.getMessage(FacesContext.getCurrentInstance(), "close"); - } - - @Override - protected String getDefaultCancelOutcome() - { - return this.cancelOutcome; - } - - // ------------------------------------------------------------------------------ - // Event handlers - - public String updateStatus() - { - if (logger.isDebugEnabled()) - logger.debug("Updating status for link validation report for webapp '" + this.webappPath + "'"); - - Map params = new HashMap(1); - params.put("store", this.store); - params.put("webapp", this.webapp); - params.put("fromTaskDialog", this.fromTaskDialog); - params.put("compareToStaging", this.compareToStaging); - params.put("update", "true"); - Application.getDialogManager().setupParameters(params); - - return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + - AlfrescoNavigationHandler.OUTCOME_SEPARATOR + - "dialog:runLinkValidation"; - } - - // ------------------------------------------------------------------------------ - // Bean getters and setters - - /** - * @param avmBrowseBean The AVM BrowseBean to set - */ - public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean) - { - this.avmBrowseBean = avmBrowseBean; - } - - public void setAvmService(AVMService avmService) - { - this.avmService = avmService; - } - - /** - * @param actionService The actionService to set. - */ - public void setActionService(ActionService actionService) - { - this.actionService = actionService; - } -} diff --git a/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java b/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java index 9f4423ab55..f629be2942 100644 --- a/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java +++ b/source/java/org/alfresco/web/bean/wcm/ManageVerifyBrokenLinksTaskDialog.java @@ -126,10 +126,9 @@ public class ManageVerifyBrokenLinksTaskDialog extends ManageTaskDialog Map params = new HashMap(1); params.put("store", this.store); params.put("webapp", this.webapp); - params.put("fromTaskDialog", "true"); Application.getDialogManager().setupParameters(params); - return "dialog:linkValidationReport"; + return "dialog:linkValidation"; } // ------------------------------------------------------------------------------ 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 239fd47abd..e18cfef0bd 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationSummary.java @@ -195,7 +195,7 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone { if (actionId.equals(component.getId())) { - action = (UIActionLink)component; + action = (UICommand)component; break; } } 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 0f5c68fc0b..f1cb37ac43 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UIUserSandboxes.java @@ -379,10 +379,11 @@ public class UIUserSandboxes extends SelfRenderingComponent params.put("store", mainStore); params.put("username", username); params.put("webapp", this.getWebapp()); + params.put("mode", "runReport"); params.put("compareToStaging", "true"); Utils.encodeRecursive(context, aquireAction( context, mainStore, username, ACT_SANDBOX_CHECK_LINKS, "/images/icons/run_link_validation.gif", - "#{DialogManager.setupParameters}", "dialog:runLinkValidation", null, params)); + "#{DialogManager.setupParameters}", "dialog:linkValidation", null, params)); out.write("  "); // Browse Sandbox diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index d581bd8dcf..ee1105cbd1 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -3548,10 +3548,10 @@ - The bean that backs up the Run Link Validation Dialog + The bean that backs up the Link Validation Dialog - LinkValidationRunDialog - org.alfresco.web.bean.wcm.LinkValidationRunDialog + LinkValidationDialog + org.alfresco.web.bean.wcm.LinkValidationDialog session avmBrowseBean @@ -3566,23 +3566,6 @@ #{AVMService} - - - - The bean that backs up the Link Validation Report Dialog - - LinkValidationReportDialog - org.alfresco.web.bean.wcm.LinkValidationReportDialog - session - - avmBrowseBean - #{AVMBrowseBean} - - - avmService - #{AVMService} - - diff --git a/source/web/jsp/wcm/browse-website.jsp b/source/web/jsp/wcm/browse-website.jsp index 12235414e4..f57959cc88 100644 --- a/source/web/jsp/wcm/browse-website.jsp +++ b/source/web/jsp/wcm/browse-website.jsp @@ -140,9 +140,10 @@ + actionListener="#{DialogManager.setupParameters}" action="dialog:linkValidation"> +   -<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> -<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> -<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - - - - - - - - - - - - - +<%-- + * 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> +<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> +<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> + +<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> +<%@ page isELIgnored="false" %> + +<%-- Display progress if dialog is running report --%> + + +<%-- Display the reporting components if showing a report --%> + + + + + + + + + + + + + + diff --git a/source/web/jsp/wcm/run-link-validation.jsp b/source/web/jsp/wcm/run-link-validation.jsp deleted file mode 100644 index 108d679e8f..0000000000 --- a/source/web/jsp/wcm/run-link-validation.jsp +++ /dev/null @@ -1,35 +0,0 @@ -<%-- - * 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="http://java.sun.com/jsp/jstl/core" prefix="c" %> -<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %> -<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %> -<%@ taglib uri="/WEB-INF/wcm.tld" prefix="w" %> - -<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %> -<%@ page isELIgnored="false" %> - - \ No newline at end of file diff --git a/source/web/scripts/ajax/link-validation-progress.js b/source/web/scripts/ajax/link-validation-progress.js index 601fdf8a9f..d393017a08 100644 --- a/source/web/scripts/ajax/link-validation-progress.js +++ b/source/web/scripts/ajax/link-validation-progress.js @@ -57,8 +57,7 @@ Alfresco.initLinkValidationMonitor = function() } Alfresco.linkMonitor = null; -window.onload = Alfresco.initLinkValidationMonitor; - +YAHOO.util.Event.on(window, "load", Alfresco.initLinkValidationMonitor);