- Combined run and report dialogs for links management into one to solve some navigation issues

- Fixes for links management UI in IE

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6067 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-06-22 13:39:15 +00:00
parent 86c9a9fc7e
commit 6bc01211dd
13 changed files with 200 additions and 362 deletions

View File

@@ -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 <span id='link-count'>0</span> links in <span id='
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
link_validaton_report_desc=This dialog shows the results of the last link validation and allows broken links to be fixed.
link_validaton_dialog_title=Link Validation Report
link_validaton_dialog_desc=This dialog shows the results of a link validation check and allows broken links to be fixed.
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.

View File

@@ -247,17 +247,11 @@
icon="/images/icons/deploy_large.gif" title-id="monitor_deployment_title"
description-id="monitor_deployment_desc" show-ok-button="false" />
<dialog name="runLinkValidation" page="/jsp/wcm/run-link-validation.jsp"
managed-bean="LinkValidationRunDialog"
<dialog name="linkValidation" page="/jsp/wcm/link-validation.jsp"
managed-bean="LinkValidationDialog"
icon="/images/icons/link_validation_report_large.gif"
title-id="run_link_validaton_title"
description-id="run_link_validaton_desc" show-ok-button="false" />
<dialog name="linkValidationReport" page="/jsp/wcm/link-validation-report.jsp"
managed-bean="LinkValidationReportDialog"
icon="/images/icons/link_validation_report_large.gif"
title-id="link_validaton_report_title"
description-id="link_validaton_report_desc" />
title-id="link_validaton_dialog_title"
description-id="link_validaton_dialog_desc" />
<dialog name="editXmlInline" page="/jsp/wcm/edit-xml-inline.jsp"
managed-bean="EditXmlInlineDialog" icon="/images/icons/edit_large.gif"

View File

@@ -105,12 +105,15 @@ public class AjaxServlet extends BaseServlet
return;
}
setNoCacheHeaders(response);
uri = uri.substring(request.getContextPath().length() + "/".length());
final String[] tokens = uri.split("/");
if (tokens.length < 3)
{
throw new AlfrescoRuntimeException("Servlet URL did not contain all required args: " + uri);
}
// retrieve the command from the URL
final String commandName = tokens[1];
// retrieve the binding expression from the URL

View File

@@ -42,7 +42,6 @@ import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.NodeRef;
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.alfresco.web.bean.repository.Repository;
@@ -51,11 +50,14 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Implementation of the run link validation dialog.
* Implementation of the link validation dialog.
*
* The dialog is in one of 2 modes, either running a report showing progress
* or showing the results of an executed link check.
*
* @author gavinc
*/
public class LinkValidationRunDialog extends BaseDialogBean
public class LinkValidationDialog extends BaseDialogBean
{
protected AVMBrowseBean avmBrowseBean;
protected AVMService avmService;
@@ -64,12 +66,12 @@ public class LinkValidationRunDialog extends BaseDialogBean
private String store;
private String webapp;
private String webappPath;
private String fromTaskDialog;
private NodeRef webappPathRef;
private boolean runningReport = false;
private boolean update = false;
private boolean compareToStaging = false;
private static final Log logger = LogFactory.getLog(LinkValidationRunDialog.class);
private static final Log logger = LogFactory.getLog(LinkValidationDialog.class);
// ------------------------------------------------------------------------------
// Dialog implementation
@@ -86,10 +88,16 @@ public class LinkValidationRunDialog extends BaseDialogBean
ParameterCheck.mandatoryString("webapp", this.webapp);
// setup context for dialog
this.fromTaskDialog = parameters.get("fromTaskDialog");
this.webappPath = AVMUtil.buildStoreWebappPath(this.store, this.webapp);
this.webappPathRef = AVMNodeConverter.ToNodeRef(-1, this.webappPath);
this.runningReport = false;
String modeParam = parameters.get("mode");
if (modeParam != null && modeParam.equalsIgnoreCase("runReport"))
{
this.runningReport = true;
}
this.update = false;
String updateParam = parameters.get("update");
if (updateParam != null && updateParam.equals("true"))
@@ -99,36 +107,64 @@ public class LinkValidationRunDialog extends BaseDialogBean
this.compareToStaging = false;
String compareToStagingParam = parameters.get("compareToStaging");
if (compareToStagingParam != null && compareToStagingParam.equals("true"))
if (compareToStagingParam != null && compareToStagingParam.equalsIgnoreCase("true"))
{
this.compareToStaging = true;
}
if (logger.isDebugEnabled())
{
if (this.runningReport)
{
if (this.update)
logger.debug("Starting update link validation check for webapp '" + this.webappPath + "'");
else
logger.debug("Starting initial link validation check for webapp '" + this.webappPath + "'");
}
else
{
logger.debug("Showing link validation report for webapp '" + this.webappPath + "'");
}
}
// create context required to run and monitor the link check
HrefValidationProgress monitor = new HrefValidationProgress();
Map<String, Serializable> args = new HashMap<String, Serializable>(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);
// execute the report if required
if (this.runningReport)
{
executeReport();
}
}
@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
@@ -156,8 +203,6 @@ 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)
@@ -169,30 +214,6 @@ public class LinkValidationRunDialog extends BaseDialogBean
LinkValidationState state = new LinkValidationState(report);
this.avmBrowseBean.setLinkValidationState(state);
}
Map<String, String> params = new HashMap<String, String>(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";
}
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);
}
}
}
@@ -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<String, Serializable> args = new HashMap<String, Serializable>(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
*/

View File

@@ -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<String, String> 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<String, String> params = new HashMap<String, String>(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<String, String> params = new HashMap<String, String>(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;
}
}

View File

@@ -126,10 +126,9 @@ public class ManageVerifyBrokenLinksTaskDialog extends ManageTaskDialog
Map<String, String> params = new HashMap<String, String>(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";
}
// ------------------------------------------------------------------------------

View File

@@ -195,7 +195,7 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
{
if (actionId.equals(component.getId()))
{
action = (UIActionLink)component;
action = (UICommand)component;
break;
}
}

View File

@@ -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("&nbsp;&nbsp;");
// Browse Sandbox

View File

@@ -3548,10 +3548,10 @@
<managed-bean>
<description>
The bean that backs up the Run Link Validation Dialog
The bean that backs up the Link Validation Dialog
</description>
<managed-bean-name>LinkValidationRunDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.LinkValidationRunDialog</managed-bean-class>
<managed-bean-name>LinkValidationDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.LinkValidationDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmBrowseBean</property-name>
@@ -3567,23 +3567,6 @@
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the Link Validation Report Dialog
</description>
<managed-bean-name>LinkValidationReportDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.LinkValidationReportDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMService}</value>
</managed-property>
</managed-bean>
<!-- ==================== COMPONENT GENERATOR BEANS ==================== -->
<managed-bean>
<description>

View File

@@ -140,9 +140,10 @@
<td align=left><h:outputText value="#{msg.staging_sandbox}" styleClass="mainSubTitle" /></td>
<td align=right>
<a:actionLink id="actLinks" value="#{msg.check_links}" image="/images/icons/run_link_validation.gif"
actionListener="#{DialogManager.setupParameters}" action="dialog:runLinkValidation">
actionListener="#{DialogManager.setupParameters}" action="dialog:linkValidation">
<f:param name="store" value="#{AVMBrowseBean.stagingStore}" />
<f:param name="webapp" value="#{AVMBrowseBean.webapp}" />
<f:param name="mode" value="runReport" />
</a:actionLink>
&nbsp;
<a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif"

View File

@@ -32,11 +32,16 @@
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%-- Display progress if dialog is running report --%>
<w:linkValidationProgress rendered="#{DialogManager.bean.runningReport}" />
<%-- Display the reporting components if showing a report --%>
<h:panelGroup rendered="#{DialogManager.bean.showingReport}">
<w:linkValidationSummary value="#{AVMBrowseBean.linkValidationState}" />
<w:linkValidationBrokenFiles value="#{AVMBrowseBean.linkValidationState}" />
<w:linkValidationBrokenForms value="#{AVMBrowseBean.linkValidationState}" />
<w:linkValidationFixedFiles value="#{AVMBrowseBean.linkValidationState}" />
</h:panelGroup>

View File

@@ -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" %>
<w:linkValidationProgress />

View File

@@ -57,8 +57,7 @@ Alfresco.initLinkValidationMonitor = function()
}
Alfresco.linkMonitor = null;
window.onload = Alfresco.initLinkValidationMonitor;
YAHOO.util.Event.on(window, "load", Alfresco.initLinkValidationMonitor);