Added links management to the submit process

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5989 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2007-06-15 19:33:02 +00:00
parent 2d878e8273
commit 460092a901
14 changed files with 676 additions and 134 deletions

View File

@@ -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_title=Change Expiration Date
change_expiration_date_desc=This dialog allows you to change the expiration date for a modified item. 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 expired_content_for_review=Expired Content For Review
link_validation=Link Validation
run_link_validaton_title=Run 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. run_link_validaton_desc=This dialog shows the progress of the link validation check currently running.
check_links=Check Links 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_progress=Generating links report, please wait...
checking_links_status=Checked <span id='link-count'>0</span> links in <span id='file-count'>0</span> files. checking_links_status=Checked <span id='link-count'>0</span> links in <span id='file-count'>0</span> files.
view_link_validation_report=View Link Validation Report
link_validation_unknown_error=An unknown error occurred during the link validation check 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_validation_error=An error occurred during the link validation check
link_validaton_report_title=Link Validation Report 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 initial_check=Initial check
current_status=Current status 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=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_broken={0} broken link(s) were found in {1} file(s).
files_links_still_broken={0} link(s) still broken 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. broken_links_fixed={0} broken link(s) have been fixed.

View File

@@ -314,6 +314,15 @@
</dialogs> </dialogs>
</config> </config>
<config evaluator="node-type" condition="wcmwf:verifyBrokenLinksTask">
<dialogs>
<dialog name="manageTask" page="/jsp/wcm/manage-broken-links-task-dialog.jsp"
managed-bean="ManageVerifyBrokenLinksTaskDialog"
icon="/images/icons/manage_workflow_task_large.gif"
description-id="manage_task_desc" />
</dialogs>
</config>
<config evaluator="node-type" condition="wcmwf:changeRequestTask"> <config evaluator="node-type" condition="wcmwf:changeRequestTask">
<dialogs> <dialogs>
<dialog name="manageTask" page="/jsp/workflow/manage-task-dialog.jsp" <dialog name="manageTask" page="/jsp/workflow/manage-task-dialog.jsp"

View File

@@ -444,6 +444,18 @@
</property-sheet> </property-sheet>
</config> </config>
<config evaluator="node-type" condition="wcmwf:verifyBrokenLinksTask" replace="true">
<property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
<show-property name="bpm:taskId" />
<show-property name="bpm:description" component-generator="TextAreaGenerator" read-only="true"/>
<show-property name="wcmwf:label" read-only="true" />
<show-property name="wcmwf:launchDate" read-only="true" />
<show-property name="bpm:status" />
<show-property name="bpm:comment" component-generator="TextAreaGenerator" />
</property-sheet>
</config>
<config evaluator="node-type" condition="wcmwf:reviewTask" replace="true"> <config evaluator="node-type" condition="wcmwf:reviewTask" replace="true">
<property-sheet> <property-sheet>
<separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" /> <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />

View File

@@ -49,6 +49,7 @@ public class LinkValidationReportDialog extends BaseDialogBean
protected ActionService actionService; protected ActionService actionService;
private String store; private String store;
private String cancelOutcome;
private static final Log logger = LogFactory.getLog(LinkValidationReportDialog.class); private static final Log logger = LogFactory.getLog(LinkValidationReportDialog.class);
@@ -65,6 +66,18 @@ public class LinkValidationReportDialog extends BaseDialogBean
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Showing link validation report for store '" + store + "'"); 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") @SuppressWarnings("unchecked")
@@ -83,6 +96,12 @@ public class LinkValidationReportDialog extends BaseDialogBean
"dialog:runLinkValidation"; "dialog:runLinkValidation";
} }
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override @Override
public String getFinishButtonLabel() public String getFinishButtonLabel()
{ {
@@ -98,9 +117,7 @@ public class LinkValidationReportDialog extends BaseDialogBean
@Override @Override
protected String getDefaultCancelOutcome() protected String getDefaultCancelOutcome()
{ {
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + return this.cancelOutcome;
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
"browseWebsite";
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------

View File

@@ -29,6 +29,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.transaction.UserTransaction;
import org.alfresco.linkvalidation.HrefValidationProgress; import org.alfresco.linkvalidation.HrefValidationProgress;
import org.alfresco.linkvalidation.LinkValidationAction; 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.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.dialog.BaseDialogBean; import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -59,7 +61,7 @@ public class LinkValidationRunDialog extends BaseDialogBean
protected ActionService actionService; protected ActionService actionService;
private String store; private String store;
private NodeRef storeRef; private NodeRef storePathRef;
private boolean rerun = false; private boolean rerun = false;
private static final Log logger = LogFactory.getLog(LinkValidationRunDialog.class); private static final Log logger = LogFactory.getLog(LinkValidationRunDialog.class);
@@ -79,7 +81,7 @@ public class LinkValidationRunDialog extends BaseDialogBean
store = parameters.get("store"); store = parameters.get("store");
String storePath = this.store + ":/"; String storePath = this.store + ":/";
this.storeRef = AVMNodeConverter.ToNodeRef(-1, storePath); this.storePathRef = AVMNodeConverter.ToNodeRef(-1, storePath);
this.rerun = false; this.rerun = false;
String rerunParam = parameters.get("rerun"); String rerunParam = parameters.get("rerun");
@@ -104,7 +106,7 @@ public class LinkValidationRunDialog extends BaseDialogBean
// create and execute the action in the background // create and execute the action in the background
Action action = this.actionService.createAction(LinkValidationAction.NAME, args); 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") @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 // on the store the link check was run on, retrieve it and see if
// the link check was successful. // the link check was successful.
PropertyValue val = this.avmService.getStoreProperty(this.store, FacesContext context = FacesContext.getCurrentInstance();
SandboxConstants.PROP_LINK_VALIDATION_REPORT); UserTransaction tx = null;
if (val != null)
try
{ {
LinkValidationReport report = (LinkValidationReport)val.getSerializableValue(); tx = Repository.getUserTransaction(context, true);
if (report != null) 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 (report.wasSuccessful())
if (this.rerun)
{ {
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<String, String> params = new HashMap<String, String>(1);
params.put("store", this.store);
Application.getDialogManager().setupParameters(params);
outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
"dialog:linkValidationReport";
} }
else else
{ {
LinkValidationState state = new LinkValidationState(this.store, report); String errorMsg = Application.getMessage(context, "link_validation_unknown_error");
this.avmBrowseBean.setLinkValidationState(state); Throwable cause = report.getError();
if (cause != null)
{
errorMsg = Application.getMessage(context, "link_validation_error") + ": " +
cause.getMessage();
}
Utils.addErrorMessage(errorMsg);
} }
Map<String, String> params = new HashMap<String, String>(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; return outcome;

View File

@@ -61,20 +61,20 @@ public class LinkValidationState
private Date initialCheckedCompletedAt; private Date initialCheckedCompletedAt;
private boolean checkBeenReRun = false; private boolean checkBeenReRun = false;
private int noFilesCheckedStart = 0; private int noFilesCheckedStart = -1;
private int noFilesCheckedLast = 0; private int noFilesCheckedLast = -1;
private int noLinksCheckedStart = 0; private int noLinksCheckedStart = -1;
private int noLinksCheckedLast = 0; private int noLinksCheckedLast = -1;
private int noBrokenFilesStart = 0; private int noBrokenFilesStart = -1;
private int noBrokenFilesLast = 0; private int noBrokenFilesLast = -1;
private int noBrokenLinksStart = 0; private int noBrokenLinksStart = -1;
private int noBrokenLinksLast = 0; private int noBrokenLinksLast = -1;
private int noFixedFiles = 0; private int noFixedFiles = -1;
private int noFixedLinks = 0; private int noFixedLinks = -1;
private List<String> brokenStaticFilesStart; private List<String> brokenStaticFilesStart;
private List<String> brokenFormsStart; private List<String> brokenFormsStart;
@@ -88,6 +88,8 @@ public class LinkValidationState
private Map<String, List<String>> brokenLinksByFile; private Map<String, List<String>> brokenLinksByFile;
private Map<String, List<String>> brokenFilesByForm; private Map<String, List<String>> brokenFilesByForm;
private Throwable cause;
private static Log logger = LogFactory.getLog(LinkValidationState.class); private static Log logger = LogFactory.getLog(LinkValidationState.class);
/** /**
@@ -120,6 +122,14 @@ public class LinkValidationState
return this.initialCheckedCompletedAt; 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 * @return The number of files checked by the initial link check
*/ */
@@ -291,7 +301,8 @@ public class LinkValidationState
public String toString() public String toString()
{ {
StringBuilder buffer = new StringBuilder(super.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(); return buffer.toString();
} }
@@ -301,67 +312,73 @@ public class LinkValidationState
public void processReport(LinkValidationReport report, boolean rerunReport) public void processReport(LinkValidationReport report, boolean rerunReport)
{ {
this.checkBeenReRun = rerunReport; this.checkBeenReRun = rerunReport;
this.cause = report.getError();
if (rerunReport == false) if (this.cause == null)
{ {
// setup initial counts if (rerunReport == false)
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<String>(this.noBrokenFilesStart);
this.fixedForms = new ArrayList<String>(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)
{ {
// 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; this.noFixedFiles = 0;
}
if (this.noFixedLinks < 0)
{
this.noFixedLinks = 0; this.noFixedLinks = 0;
// setup fixed lists
this.fixedFiles = new ArrayList<String>(this.noBrokenFilesStart);
this.fixedForms = new ArrayList<String>(this.noBrokenFilesStart);
// process the broken files and determine which ones are static files
// and which ones are generated
processFiles(report.getFilesWithBrokenLinks(), rerunReport, report);
} }
else
// 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 && // update the relevant counts
this.fixedFiles.contains(file) == false) 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;
} }
} if (this.noFixedLinks < 0)
for (String file : this.brokenFormsStart)
{
if (this.brokenFormsLast.contains(file) == false &&
this.fixedForms.contains(file) == false)
{ {
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);
}
} }
} }
} }

View File

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

View File

@@ -97,6 +97,7 @@ public class SubmitDialog extends BaseDialogBean
private String[] workflowSelectedValue; private String[] workflowSelectedValue;
private boolean enteringExpireDate = false; private boolean enteringExpireDate = false;
private boolean startedFromWorkflow = false; private boolean startedFromWorkflow = false;
private boolean validateLinks = false;
private Date defaultExpireDate; private Date defaultExpireDate;
private Date launchDate; private Date launchDate;
@@ -195,6 +196,7 @@ public class SubmitDialog extends BaseDialogBean
this.defaultExpireDate = new Date(); this.defaultExpireDate = new Date();
this.workflowSelectedValue = null; this.workflowSelectedValue = null;
this.launchDate = null; this.launchDate = null;
this.validateLinks = false;
// determine if the dialog has been started from a workflow // determine if the dialog has been started from a workflow
Boolean bool = new Boolean(this.parameters.get(PARAM_STARTED_FROM_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, params.put(WCMWorkflowModel.PROP_FROM_PATH,
AVMUtil.buildStoreRootPath(this.avmBrowseBean.getSandbox())); AVMUtil.buildStoreRootPath(this.avmBrowseBean.getSandbox()));
params.put(WCMWorkflowModel.PROP_LAUNCH_DATE, this.launchDate); params.put(WCMWorkflowModel.PROP_LAUNCH_DATE, this.launchDate);
params.put(WCMWorkflowModel.PROP_VALIDATE_LINKS, new Boolean(this.validateLinks));
params.put(WCMWorkflowModel.ASSOC_WEBPROJECT, params.put(WCMWorkflowModel.ASSOC_WEBPROJECT,
this.avmBrowseBean.getWebsite().getNodeRef()); this.avmBrowseBean.getWebsite().getNodeRef());
@@ -517,6 +520,22 @@ public class SubmitDialog extends BaseDialogBean
this.launchDate = launchDate; 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 * @return List of UIListItem object representing the available workflows for the website
*/ */

View File

@@ -72,14 +72,87 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
} }
// get the link validation state object to get the data from // get the link validation state object to get the data from
ResourceBundle bundle = Application.getBundle(context);
ResponseWriter out = context.getResponseWriter(); ResponseWriter out = context.getResponseWriter();
LinkValidationState linkState = getValue(); LinkValidationState linkState = getValue();
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Rendering summary from state object: " + linkState); logger.debug("Rendering summary from state object: " + linkState);
// resolve all the strings holding data if (linkState.getError() == null)
ResourceBundle bundle = Application.getBundle(context); {
Object initialCheckOnly = this.getAttributes().get("initialCheckOnly");
if (initialCheckOnly instanceof Boolean &&
((Boolean)initialCheckOnly).booleanValue())
{
out.write("<div style='padding: 4px 4px 2px 13px;'>");
renderInitialCheckSummary(context, out, linkState, bundle);
out.write("</div>");
}
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("<div class='linkValidationSummaryPanel'><div class='linkValidationReportTitle'>");
out.write(bundle.getString("summary"));
out.write("</div><table cellpadding='0' cellspacing='0'><tr>");
out.write("<td valign='top' class='linkValidationReportSubTitle'>");
out.write(bundle.getString("initial_check"));
out.write(":</td><td>");
renderInitialCheckSummary(context, out, linkState, bundle);
out.write("</td></tr><tr><td class='linkValidationReportSubTitle'>");
out.write(bundle.getString("current_status"));
out.write(":</td><td><div><img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' style='vertical-align: -4px; padding-right: 4px;' >");
out.write(stillBroken);
out.write("<img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/fixed_link.gif' style='vertical-align: -4px; padding-left: 6px; padding-right: 4px;' >");
out.write(linksFixed);
out.write("&nbsp;&nbsp;");
Utils.encodeRecursive(context, updateStatusAction);
out.write("</div></td></tr>");
out.write("</table></div>");
}
}
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("<div class='linkValidationSummaryPanel'>");
out.write(initialCheckSummary);
out.write("&nbsp;<span class='errorMessage'>");
String err = linkState.getError().getMessage();
if (err == null)
{
out.write(linkState.getError().toString());
}
else
{
out.write(err);
}
out.write("</span></div>");
}
}
protected void renderInitialCheckSummary(FacesContext context,
ResponseWriter out, LinkValidationState linkState,
ResourceBundle bundle) throws IOException
{
String pattern = bundle.getString("files_links_checked"); String pattern = bundle.getString("files_links_checked");
Date initialCheck = linkState.getInitialCheckCompletedAt(); Date initialCheck = linkState.getInitialCheckCompletedAt();
String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck); String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck);
@@ -89,45 +162,16 @@ public class UILinkValidationSummary extends AbstractLinkValidationReportCompone
pattern = bundle.getString("files_links_broken"); pattern = bundle.getString("files_links_broken");
String initialBrokenSummary = MessageFormat.format(pattern, String initialBrokenSummary = MessageFormat.format(pattern,
new Object[] {linkState.getInitialNumberBrokenFiles(), linkState.getInitialNumberBrokenLinks()}); 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 out.write("<div style='margin-bottom: 6px;'>");
UICommand updateStatusAction = aquireAction(context, "update_status_" + linkState.getStore());
// render the summary area
out.write("<div class='linkValidationSummaryPanel'><div class='linkValidationReportTitle'>");
out.write(bundle.getString("summary"));
out.write("</div><table cellpadding='0' cellspacing='0'><tr>");
out.write("<td valign='top' class='linkValidationReportSubTitle'>");
out.write(bundle.getString("initial_check"));
out.write(":</td><td><div style='margin-bottom: 6px;'>");
out.write(initialCheckSummary); out.write(initialCheckSummary);
out.write("</div><div style='margin-bottom: 14px;'><img src='"); out.write("</div><div style='margin-bottom: 14px;'><img src='");
out.write(context.getExternalContext().getRequestContextPath()); out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif'' style='vertical-align: -4px; padding-right: 4px;'/>"); out.write("/images/icons/broken_link.gif'' style='vertical-align: -4px; padding-right: 4px;'/>");
out.write(initialBrokenSummary); out.write(initialBrokenSummary);
out.write("</div></td></tr>"); out.write("</div>");
out.write("<tr><td class='linkValidationReportSubTitle'>");
out.write(bundle.getString("current_status"));
out.write(":</td><td><div><img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/broken_link.gif' style='vertical-align: -4px; padding-right: 4px;' >");
out.write(stillBroken);
out.write("<img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write("/images/icons/fixed_link.gif' style='vertical-align: -4px; padding-left: 6px; padding-right: 4px;' >");
out.write(linksFixed);
out.write("&nbsp;&nbsp;");
Utils.encodeRecursive(context, updateStatusAction);
out.write("</div></td></tr>");
out.write("</table></div>");
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private UICommand aquireAction(FacesContext context, String actionId) private UICommand aquireAction(FacesContext context, String actionId)
{ {

View File

@@ -36,6 +36,7 @@ import org.alfresco.web.ui.common.tag.HtmlComponentTag;
public class LinkValidationSummaryTag extends HtmlComponentTag public class LinkValidationSummaryTag extends HtmlComponentTag
{ {
private String value; private String value;
private String initialCheckOnly;
/** /**
* @see javax.faces.webapp.UIComponentTag#getComponentType() * @see javax.faces.webapp.UIComponentTag#getComponentType()
@@ -61,6 +62,7 @@ public class LinkValidationSummaryTag extends HtmlComponentTag
super.setProperties(component); super.setProperties(component);
setStringProperty(component, "value", this.value); setStringProperty(component, "value", this.value);
setBooleanProperty(component, "initialCheckOnly", this.initialCheckOnly);
} }
/** /**
@@ -70,6 +72,7 @@ public class LinkValidationSummaryTag extends HtmlComponentTag
{ {
super.release(); super.release();
this.value = null; this.value = null;
this.initialCheckOnly = null;
} }
/** /**
@@ -79,4 +82,12 @@ public class LinkValidationSummaryTag extends HtmlComponentTag
{ {
this.value = value; 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;
}
} }

View File

@@ -2136,6 +2136,59 @@
<value>#{AVMBrowseBean}</value> <value>#{AVMBrowseBean}</value>
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>
The bean that backs up the Verify Broken Links Task Dialog
</description>
<managed-bean-name>ManageVerifyBrokenLinksTaskDialog</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.wcm.ManageVerifyBrokenLinksTaskDialog</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>fileFolderService</property-name>
<value>#{FileFolderService}</value>
</managed-property>
<managed-property>
<property-name>searchService</property-name>
<value>#{SearchService}</value>
</managed-property>
<managed-property>
<property-name>navigator</property-name>
<value>#{NavigationBean}</value>
</managed-property>
<managed-property>
<property-name>browseBean</property-name>
<value>#{BrowseBean}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>
</managed-property>
<managed-property>
<property-name>namespaceService</property-name>
<value>#{NamespaceService}</value>
</managed-property>
<managed-property>
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
<managed-property>
<property-name>avmService</property-name>
<value>#{AVMService}</value>
</managed-property>
<managed-property>
<property-name>avmSyncService</property-name>
<value>#{AVMSyncService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean>
<managed-bean> <managed-bean>
<description> <description>

View File

@@ -302,6 +302,13 @@
<description>The link validation state object holding the report data</description> <description>The link validation state object holding the report data</description>
</attribute> </attribute>
<attribute>
<name>initialCheckOnly</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description>Only shows the initial check summary if set to true, false by default</description>
</attribute>
<attribute> <attribute>
<name>id</name> <name>id</name>
<required>false</required> <required>false</required>

View File

@@ -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" %>
<a:panel id="pooled-panel" label="#{msg.task_pooled_properties}" rendered="#{DialogManager.bean.pooledTask}"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<r:propertySheetGrid id="pooled-task-props" value="#{DialogManager.bean.taskNode}" columns="1" >
<r:property id="pooled-task-owner" readOnly="true" name="owner" />
<r:association id="pooled-task-pool" readOnly="true" name="bpm:pooledActors" />
</r:propertySheetGrid>
</a:panel>
<h:outputText id="padding1" styleClass="paddingRow" value="&nbsp;" escape="false" rendered="#{DialogManager.bean.pooledTask}" />
<a:panel id="metadata-panel" label="#{msg.task_properties}"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<r:propertySheetGrid id="task-props" value="#{DialogManager.bean.taskNode}"
var="taskProps" columns="1" externalConfig="true" />
</a:panel>
<h:outputText id="padding2" styleClass="paddingRow" value="&nbsp;" escape="false" />
<a:panel id="link-validation-panel" label="#{msg.link_validation}" rendered="#{AVMBrowseBean.linkValidationState != null}"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<w:linkValidationSummary value="#{AVMBrowseBean.linkValidationState}" initialCheckOnly="true" />
<a:actionLink value="#{msg.view_link_validation_report}" action="#{DialogManager.bean.viewLinkReport}"
style='margin-left: 14px;' />
<h:outputText value="<div>&nbsp;</div>" escape="false" />
</a:panel>
<h:outputText id="padding3" styleClass="paddingRow" value="&nbsp;" escape="false" />
<a:panel id="resources-panel" label="#{msg.resources}"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<h:outputText value="#{msg.no_resources}" rendered="#{empty DialogManager.bean.resources}" />
<a:richList id="resources-list" viewMode="details" value="#{DialogManager.bean.resources}" var="r"
binding="#{DialogManager.bean.packageItemsRichList}"
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow"
altRowStyleClass="recordSetRowAlt" width="100%" pageSize="10"
initialSortColumn="name" initialSortDescending="true"
rendered="#{not empty DialogManager.bean.resources}">
<%-- Name column --%>
<a:column id="col1" primary="true" width="200" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col1-sort" label="#{msg.name}" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<f:facet name="small-icon">
<a:actionLink id="col1-act1" value="#{r.name}" href="#{r.url}" target="new" image="#{r.fileType16}"
showLink="false" styleClass="inlineAction" />
</f:facet>
<a:actionLink id="col1-act2" value="#{r.name}" href="#{r.url}" target="new" />
<r:lockIcon id="col1-lock" value="#{r.nodeRef}" align="absmiddle" />
</a:column>
<%-- Description column --%>
<a:column id="col2" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col2-sort" label="#{msg.description}" value="description" styleClass="header"/>
</f:facet>
<h:outputText id="col2-txt" value="#{r.description}" />
</a:column>
<%-- Path column --%>
<a:column id="col3" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col3-sort" label="#{msg.path}" value="path" styleClass="header"/>
</f:facet>
<r:nodePath id="col3-path" value="#{r.path}" action="dialog:close:browse"
actionListener="#{BrowseBean.clickSpacePath}" />
</a:column>
<%-- Created Date column --%>
<a:column id="col4" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col4-sort" label="#{msg.created}" value="created" styleClass="header"/>
</f:facet>
<h:outputText id="col4-txt" value="#{r.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
</a:column>
<%-- Modified Date column --%>
<a:column id="col5" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink id="col5-sort" label="#{msg.modified}" value="modified" styleClass="header"/>
</f:facet>
<h:outputText id="col5-txt" value="#{r.modified}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
</a:column>
<%-- Expiration Date column --%>
<a:column id="col16" style="text-align:left; white-space:nowrap">
<f:facet name="header">
<a:sortLink label="#{msg.expiration_date}" value="expirationDate" styleClass="header" />
</f:facet>
<h:outputText id="col16-date" value='#{r["wca:expirationDate"]}'>
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
</a:column>
<%-- Actions column --%>
<a:column id="col7" actions="true" style="padding:2px;text-align:left">
<f:facet name="header">
<h:outputText id="col7-txt" value="#{msg.actions}"/>
</f:facet>
<r:actions id="col7-actions" value="#{DialogManager.bean.packageItemActionGroup}"
context="#{r}" showLink="false" styleClass="inlineAction" />
</a:column>
<a:dataPager styleClass="pager" />
</a:richList>
<h:panelGrid id="package-actions-group" columns="1" styleClass="paddingRow">
<r:actions id="package-actions" context="#{DialogManager.bean.taskNode}"
value="#{DialogManager.bean.packageActionGroup}" />
</h:panelGrid>
<h:panelGrid id="add-item-control" columns="1" rendered="#{DialogManager.bean.itemBeingAdded}"
styleClass="selector" style="margin-top: 6px;">
<r:contentSelector id="content-picker" value="#{DialogManager.bean.itemsToAdd}" styleClass="" />
<h:panelGrid columns="2">
<h:commandButton value="#{msg.add_to_list_button}" actionListener="#{DialogManager.bean.addPackageItems}" />
<h:commandButton value="#{msg.cancel}" actionListener="#{DialogManager.bean.cancelAddPackageItems}" />
</h:panelGrid>
</h:panelGrid>
</a:panel>
<h:outputText id="padding4" styleClass="paddingRow" value="&nbsp;" escape="false" />
<a:panel id="workflow-summary-panel" label="#{msg.part_of_workflow}"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<r:workflowSummary id="workflow-summary" value="#{DialogManager.bean.workflowInstance}" styleClass="workflowSummary" />
<f:verbatim><div style="padding-left:9px;padding-top:8px;padding-bottom:4px"></f:verbatim>
<a:panel id="pending-submission-panel" label="#{msg.workflow_history}" progressive="true"
expanded="false" styleClass="mainSubTitle">
<r:workflowHistory id="workflow-history" value="#{DialogManager.bean.workflowInstance}" styleClass="workflowHistoryList" />
</a:panel>
<f:verbatim></div></f:verbatim>
</a:panel>
<h:outputText id="padding5" styleClass="paddingRow" value="&nbsp;" escape="false" />
<a:panel rendered="false" id="workflow-outline" label="#{msg.workflow_outline}" progressive="true" expanded="false"
border="white" bgcolor="white" titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white" styleClass="mainSubTitle">
<h:graphicImage value="#{DialogManager.bean.workflowDefinitionImageUrl}"/>
</a:panel>

View File

@@ -79,6 +79,15 @@
onkeyup="javascript:checkButtonState();" /> onkeyup="javascript:checkButtonState();" />
</h:panelGrid> </h:panelGrid>
<%--
<h:panelGrid columns="2" cellspacing="0" cellpadding="2" style="margin-left: 20px; margin-top: 6px;">
<h:selectBooleanCheckbox id="links-chkbox" value="#{DialogManager.bean.validateLinks}" />
<h:outputText value="#{msg.check_links}" escape="false" />
<h:outputText value="&nbsp;" escape="false" />
<h:outputText value="#{msg.check_links_info}" />
</h:panelGrid>
--%>
<h:panelGrid columns="1" cellpadding="2" style="padding-top:16px;padding-bottom:4px;" <h:panelGrid columns="1" cellpadding="2" style="padding-top:16px;padding-bottom:4px;"
width="100%" rowClasses="wizardSectionHeading"> width="100%" rowClasses="wizardSectionHeading">
<h:outputText value="&nbsp;#{msg.workflow}" escape="false" /> <h:outputText value="&nbsp;#{msg.workflow}" escape="false" />