mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- 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:
@@ -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
|
||||
|
@@ -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.update)
|
||||
logger.debug("Starting update link validation check for webapp '" + this.webappPath + "'");
|
||||
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("Starting initial link validation check for webapp '" + this.webappPath + "'");
|
||||
{
|
||||
logger.debug("Showing link validation report for webapp '" + this.webappPath + "'");
|
||||
}
|
||||
}
|
||||
|
||||
// execute the report if required
|
||||
if (this.runningReport)
|
||||
{
|
||||
executeReport();
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
@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<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";
|
||||
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<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
|
||||
*/
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
@@ -195,7 +195,7 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
action = (UICommand)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user