- Partial first cut of initial version of links management UI
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5917 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
@@ -1131,6 +1131,25 @@ change_expiration_date_change=Note: To change individual expiration dates click
|
||||
change_expiration_date_title=Change Expiration Date
|
||||
change_expiration_date_desc=This dialog allows you to change the expiration date for a modified item.
|
||||
expired_content_for_review=Expired Content For Review
|
||||
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
|
||||
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.
|
||||
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.
|
||||
initial_check=Initial check
|
||||
current_status=Current status
|
||||
files_links_checked={0} file(s) were checked, {1} link(s) were found.
|
||||
files_links_broken={0} broken link(s) were found in {1} file(s).
|
||||
files_links_still_broken={0} link(s) still broken in {1} file(s).
|
||||
broken_links_fixed={0} broken link(s) have been fixed.
|
||||
files_with_broken_links=Files with broken links
|
||||
broken_links=Broken Links
|
||||
rerun_report=Re-Run Report
|
||||
fixed_files=Files that have been fixed
|
||||
|
||||
# New User Wizard messages
|
||||
new_user_title=New User Wizard
|
||||
|
@@ -247,6 +247,18 @@
|
||||
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"
|
||||
icon="/images/icons/run_link_validation_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" />
|
||||
|
||||
<dialog name="editXmlInline" page="/jsp/wcm/edit-xml-inline.jsp"
|
||||
managed-bean="EditXmlInlineDialog" icon="/images/icons/edit_large.gif"
|
||||
title-id="title_edit_xml_inline" description-id="editfileinline_description" />
|
||||
|
@@ -41,6 +41,7 @@ import javax.faces.event.ActionEvent;
|
||||
import javax.faces.model.SelectItem;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.linkvalidation.HrefValidationProgress;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.actions.AVMRevertStoreAction;
|
||||
@@ -147,6 +148,12 @@ public class AVMBrowseBean implements IContextListener
|
||||
/** List of expired paths to submit */
|
||||
private List<AVMNodeDescriptor> expiredNodes = Collections.<AVMNodeDescriptor>emptyList();
|
||||
|
||||
/** Object used by link validation service to monitor the status of a link check */
|
||||
private HrefValidationProgress linkValidationMonitor;
|
||||
|
||||
/** Link validation state instance used by link validation dialogs */
|
||||
private LinkValidationState linkValidationState;
|
||||
|
||||
/* component references */
|
||||
private UIRichList foldersRichList;
|
||||
private UIRichList filesRichList;
|
||||
@@ -457,6 +464,38 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.deploymentMonitorIds = deploymentMonitorIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the link validation monitor instance
|
||||
*/
|
||||
public HrefValidationProgress getLinkValidationMonitor()
|
||||
{
|
||||
return this.linkValidationMonitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param monitor The link validation monitor instance to use
|
||||
*/
|
||||
public void setLinkValidationMonitor(HrefValidationProgress monitor)
|
||||
{
|
||||
this.linkValidationMonitor = monitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the link validation state instance
|
||||
*/
|
||||
public LinkValidationState getLinkValidationState()
|
||||
{
|
||||
return this.linkValidationState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param monitor The link validation state instance to use
|
||||
*/
|
||||
public void setLinkValidationState(LinkValidationState state)
|
||||
{
|
||||
this.linkValidationState = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of expired nodes. Used by the submit dialog to retrieve
|
||||
* nodes to potentially submit when a user completes a change request
|
||||
|
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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.io.IOException;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean used by the AJAX callback from the RunLinkValidationDialog.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationProgressBean
|
||||
{
|
||||
private AVMBrowseBean avmBrowseBean;
|
||||
|
||||
private static Log logger = LogFactory.getLog(LinkValidationProgressBean.class);
|
||||
|
||||
public void getStatus() throws IOException
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Retrieving progress status for link validation check...");
|
||||
|
||||
StringBuilder xml = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
|
||||
xml.append("<link-validation-progress finished=\"");
|
||||
xml.append(this.avmBrowseBean.getLinkValidationMonitor().isDone());
|
||||
xml.append("\" file-count=\"");
|
||||
xml.append(this.avmBrowseBean.getLinkValidationMonitor().getFileUpdateCount());
|
||||
xml.append("\" link-count=\"");
|
||||
xml.append(this.avmBrowseBean.getLinkValidationMonitor().getUrlUpdateCount());
|
||||
xml.append("\"></link-validation-progress>");
|
||||
|
||||
// send the generated XML back to the callee
|
||||
out.write(xml.toString());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("returning XML: " + xml.toString());
|
||||
}
|
||||
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
}
|
@@ -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 org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
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 static final Log logger = LogFactory.getLog(LinkValidationReportDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
// setup context for dialog
|
||||
store = parameters.get("store");
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Showing link validation report for store '" + store + "'");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Re-running link validation report for store '" + store + "'");
|
||||
|
||||
Map<String, String> params = new HashMap<String, String>(1);
|
||||
params.put("store", this.store);
|
||||
params.put("rerun", "true");
|
||||
Application.getDialogManager().setupParameters(params);
|
||||
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
|
||||
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
|
||||
"dialog:runLinkValidation";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "rerun_report");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return (this.avmBrowseBean.getLinkValidationState().getNumberBrokenLinks() == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelButtonLabel()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "close");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultCancelOutcome()
|
||||
{
|
||||
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
|
||||
AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
|
||||
"browseWebsite";
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* 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.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.linkvalidation.HrefValidationProgress;
|
||||
import org.alfresco.linkvalidation.LinkValidationAction;
|
||||
import org.alfresco.linkvalidation.LinkValidationReport;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.sandbox.SandboxConstants;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Implementation of the run link validation dialog.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationRunDialog extends BaseDialogBean
|
||||
{
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected AVMService avmService;
|
||||
protected ActionService actionService;
|
||||
|
||||
private String store;
|
||||
private NodeRef storeRef;
|
||||
private boolean rerun = false;
|
||||
|
||||
private static final Log logger = LogFactory.getLog(LinkValidationRunDialog.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Dialog implementation
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> parameters)
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
// TODO: determine whether the virtualisation server is running, if it's not
|
||||
// we need to throw an exception to reflect that
|
||||
|
||||
// setup context for dialog
|
||||
store = parameters.get("store");
|
||||
|
||||
String storePath = this.store + ":/";
|
||||
this.storeRef = AVMNodeConverter.ToNodeRef(-1, storePath);
|
||||
|
||||
this.rerun = false;
|
||||
String rerunParam = parameters.get("rerun");
|
||||
if (rerunParam != null && rerunParam.equals("true"))
|
||||
{
|
||||
this.rerun = true;
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
if (this.rerun)
|
||||
logger.debug("Starting re-run link validation check for store '" + store + "'");
|
||||
else
|
||||
logger.debug("Starting initial link validation check for store '" + store + "'");
|
||||
}
|
||||
|
||||
// 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);
|
||||
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.storeRef, false, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Event handlers
|
||||
|
||||
public String linkCheckCompleted()
|
||||
{
|
||||
String outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
|
||||
|
||||
// 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
|
||||
// the link check was successful.
|
||||
|
||||
PropertyValue val = this.avmService.getStoreProperty(this.store,
|
||||
SandboxConstants.PROP_LINK_VALIDATION_REPORT);
|
||||
if (val != null)
|
||||
{
|
||||
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.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
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
}
|
379
source/java/org/alfresco/web/bean/wcm/LinkValidationState.java
Normal file
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
* 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.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.linkvalidation.LinkValidationReport;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Object used to retrieve and store the state of a link validaton process.
|
||||
* The object is given an initial link validation report object (the result
|
||||
* of a LinkValidationService service call) which is used by components
|
||||
* to display the result of the links check.
|
||||
* <p>
|
||||
* Further reports can then subsequently be given to this object at which
|
||||
* point a difference is calculated i.e. which links (if any) have been
|
||||
* fixed. This allows components to display the progress of link fixing.
|
||||
* </p>
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationState
|
||||
{
|
||||
private String store;
|
||||
private boolean checkBeenReRun = false;
|
||||
|
||||
private int noFilesCheckedStart = 0;
|
||||
private int noFilesCheckedLast = 0;
|
||||
|
||||
private int noLinksCheckedStart = 0;
|
||||
private int noLinksCheckedLast = 0;
|
||||
|
||||
private int noBrokenFilesStart = 0;
|
||||
private int noBrokenFilesLast = 0;
|
||||
|
||||
private int noBrokenLinksStart = 0;
|
||||
private int noBrokenLinksLast = 0;
|
||||
|
||||
private int noFixedFiles = 0;
|
||||
private int noFixedLinks = 0;
|
||||
|
||||
private List<String> brokenStaticFilesStart;
|
||||
private List<String> brokenFormsStart;
|
||||
|
||||
private List<String> brokenStaticFilesLast;
|
||||
private List<String> brokenFormsLast;
|
||||
|
||||
private List<String> fixedStaticFiles;
|
||||
private List<String> fixedForms;
|
||||
|
||||
private List<String> fixedStaticFilesLast;
|
||||
private List<String> fixedFormsLast;
|
||||
|
||||
private Map<String, List<String>> brokenLinksByFile;
|
||||
private Map<String, List<String>> brokenLinksByForm;
|
||||
|
||||
private static Log logger = LogFactory.getLog(LinkValidationState.class);
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public LinkValidationState(String store, LinkValidationReport initialReport)
|
||||
{
|
||||
this.store = store;
|
||||
|
||||
processReport(initialReport, false);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Getters
|
||||
|
||||
/**
|
||||
* @return The number of files checked by the initial link check
|
||||
*/
|
||||
public int getInitialNumberFilesChecked()
|
||||
{
|
||||
return this.noFilesCheckedStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of links checked by the initial link check
|
||||
*/
|
||||
public int getInitialNumberLinksChecked()
|
||||
{
|
||||
return this.noLinksCheckedStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of broken files found by the initial link check
|
||||
*/
|
||||
public int getInitialNumberBrokenFiles()
|
||||
{
|
||||
return this.noBrokenFilesStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of broken links found by the initial link check
|
||||
*/
|
||||
public int getInitialNumberBrokenLinks()
|
||||
{
|
||||
return this.noBrokenLinksStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of files checked by the latest link check
|
||||
*/
|
||||
public int getNumberFilesChecked()
|
||||
{
|
||||
return this.noFilesCheckedLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of links checked by the latest link check
|
||||
*/
|
||||
public int getNumberLinksChecked()
|
||||
{
|
||||
return this.noLinksCheckedLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of broken files found by the latest link check
|
||||
*/
|
||||
public int getNumberBrokenFiles()
|
||||
{
|
||||
return this.noBrokenFilesLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of broken links found by the latest link check
|
||||
*/
|
||||
public int getNumberBrokenLinks()
|
||||
{
|
||||
return this.noBrokenLinksLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of files fixed since the initial link check
|
||||
*/
|
||||
public int getNumberFixedFiles()
|
||||
{
|
||||
return this.noFixedFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of links fixed since the initial link check
|
||||
*/
|
||||
public int getNumberFixedLinks()
|
||||
{
|
||||
return this.noFixedLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of paths to non-generated files that contain broken links
|
||||
*/
|
||||
public List<String> getStaticFilesWithBrokenLinks()
|
||||
{
|
||||
return this.brokenStaticFilesLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of forms that have generated files containing broken links
|
||||
*/
|
||||
public List<String> getFormsWithBrokenLinks()
|
||||
{
|
||||
return this.brokenFormsLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of all files found (including those generated by forms) that
|
||||
* contain broken links
|
||||
*/
|
||||
public List<String> getAllFilesWithBrokenLinks()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param form The name of a form to find broken files for
|
||||
* @return The list of broken files generated by the given form
|
||||
*/
|
||||
public List<String> getFilesBrokenByForm(String form)
|
||||
{
|
||||
return this.brokenLinksByForm.get(form);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param file The path to a file with broken links
|
||||
* @return The list of broken links within the given file
|
||||
*/
|
||||
public List<String> getBrokenLinksForFile(String file)
|
||||
{
|
||||
return this.brokenLinksByFile.get(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of non-generated files that have been fixed since the
|
||||
* initial link check
|
||||
*/
|
||||
public List<String> getFixedStaticFiles()
|
||||
{
|
||||
return this.fixedStaticFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of forms that have been fixed since the initial link check
|
||||
*/
|
||||
public List<String> getFixedForms()
|
||||
{
|
||||
return this.fixedForms;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of non-generated files fixed in the last run of the link check
|
||||
*/
|
||||
public List<String> getStaticFilesFixedInLastRun()
|
||||
{
|
||||
return this.fixedStaticFilesLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of forms fixed in the last run of the link check
|
||||
*/
|
||||
public List<String> getFormsFixedInLastRun()
|
||||
{
|
||||
return this.fixedFormsLast;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
/**
|
||||
* Determines whether the link validation check has been re-run since
|
||||
* the intial check
|
||||
*
|
||||
* @return true if the link check has been re-run, false otherwise
|
||||
*/
|
||||
public boolean hasCheckBeenReRun()
|
||||
{
|
||||
return this.checkBeenReRun;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the link validation state with the result from a re-run of
|
||||
* the link check
|
||||
*
|
||||
* @param newReport The report to compare the intial report with
|
||||
*/
|
||||
public void updateState(LinkValidationReport newReport)
|
||||
{
|
||||
// process the new report
|
||||
processReport(newReport, true);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder(super.toString());
|
||||
buffer.append(" (store=").append(this.store).append(")");
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Private Helpers
|
||||
|
||||
public void processReport(LinkValidationReport report, boolean updatedReport)
|
||||
{
|
||||
this.checkBeenReRun = updatedReport;
|
||||
|
||||
if (updatedReport == false)
|
||||
{
|
||||
// setup initial counts
|
||||
this.noBrokenFilesStart = report.getNumberBrokenFiles();
|
||||
this.noBrokenLinksStart = report.getNumberBrokenLinks();
|
||||
this.noFilesCheckedStart = report.getNumberFilesChecked();
|
||||
this.noLinksCheckedStart = report.getNumberLinksChecked();
|
||||
this.noBrokenFilesLast = report.getNumberBrokenFiles();
|
||||
this.noBrokenLinksLast = report.getNumberBrokenLinks();
|
||||
this.noFilesCheckedLast = report.getNumberFilesChecked();
|
||||
this.noLinksCheckedLast = report.getNumberLinksChecked();
|
||||
|
||||
// setup initial lists
|
||||
this.brokenStaticFilesStart = report.getFilesWithBrokenLinks();
|
||||
this.brokenFormsStart = Collections.emptyList();
|
||||
this.brokenStaticFilesLast = report.getFilesWithBrokenLinks();
|
||||
this.brokenFormsLast = Collections.emptyList();
|
||||
|
||||
this.fixedStaticFiles = Collections.emptyList();
|
||||
this.fixedForms = Collections.emptyList();
|
||||
this.fixedFormsLast = Collections.emptyList();
|
||||
this.fixedStaticFiles = Collections.emptyList();
|
||||
this.fixedStaticFilesLast = Collections.emptyList();
|
||||
|
||||
// setup initial maps
|
||||
this.brokenLinksByFile = new HashMap<String, List<String>>();
|
||||
this.brokenLinksByForm = Collections.emptyMap();
|
||||
|
||||
// populate initial maps
|
||||
for (String file : this.brokenStaticFilesLast)
|
||||
{
|
||||
this.brokenLinksByFile.put(file, report.getBrokenLinksForFile(file));
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
this.noFixedFiles = 0;
|
||||
}
|
||||
if (this.noFixedLinks < 0)
|
||||
{
|
||||
this.noFixedLinks = 0;
|
||||
}
|
||||
|
||||
// go through the list of files still broken and find which ones
|
||||
// were fixed in the last re-run of the report
|
||||
this.brokenStaticFilesLast = report.getFilesWithBrokenLinks();
|
||||
this.fixedStaticFiles = new ArrayList<String>();
|
||||
this.fixedStaticFilesLast = new ArrayList<String>();
|
||||
for (String file : this.brokenStaticFilesStart)
|
||||
{
|
||||
if (this.brokenStaticFilesLast.contains(file) == false)
|
||||
{
|
||||
this.fixedStaticFilesLast.add(file);
|
||||
this.fixedStaticFiles.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
// update the broken files info
|
||||
this.brokenLinksByFile.clear();
|
||||
for (String file : this.brokenStaticFilesLast)
|
||||
{
|
||||
this.brokenLinksByFile.put(file, report.getBrokenLinksForFile(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.ui.wcm.component;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.el.ValueBinding;
|
||||
|
||||
import org.alfresco.web.bean.wcm.LinkValidationState;
|
||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||
|
||||
/**
|
||||
* Base class for all the link validation report JSF components.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public abstract class AbstractLinkValidationReportComponent extends SelfRenderingComponent
|
||||
{
|
||||
protected LinkValidationState state;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void restoreState(FacesContext context, Object state)
|
||||
{
|
||||
Object values[] = (Object[])state;
|
||||
// standard component attributes are restored by the super class
|
||||
super.restoreState(context, values[0]);
|
||||
this.state = (LinkValidationState)values[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object saveState(FacesContext context)
|
||||
{
|
||||
Object values[] = new Object[2];
|
||||
// standard component attributes are saved by the super class
|
||||
values[0] = super.saveState(context);
|
||||
values[1] = this.state;
|
||||
return values;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Strongly typed component property accessors
|
||||
|
||||
/**
|
||||
* @return The LinkValidationState object holding the report information
|
||||
*/
|
||||
public LinkValidationState getValue()
|
||||
{
|
||||
ValueBinding vb = getValueBinding("value");
|
||||
if (vb != null)
|
||||
{
|
||||
this.state = (LinkValidationState)vb.getValue(getFacesContext());
|
||||
}
|
||||
|
||||
return this.state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The LinkValidationState object to get the summary info from
|
||||
*/
|
||||
public void setValue(LinkValidationState value)
|
||||
{
|
||||
this.state = value;
|
||||
}
|
||||
}
|
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* 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.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.wcm.LinkValidationState;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* JSF component that shows the broken file information for a link
|
||||
* validation report.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class UILinkValidationBrokenFiles extends AbstractLinkValidationReportComponent
|
||||
{
|
||||
private boolean oddRow = true;
|
||||
|
||||
private static Log logger = LogFactory.getLog(UILinkValidationBrokenFiles.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
@Override
|
||||
public String getFamily()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationBrokenFiles";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
if (isRendered() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get the link validation state object to get the data from
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
LinkValidationState linkState = getValue();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Rendering broken files from state object: " + linkState);
|
||||
|
||||
// render the list of broken files and their contained links
|
||||
out.write("<div class='linkValidationBrokenFilesPanel'><div class='linkValidationReportTitle'>");
|
||||
out.write(Application.getMessage(context, "files_with_broken_links"));
|
||||
out.write("</div><div class='linkValidationList'><table width='100%' cellpadding='0' cellspacing='0'>");
|
||||
|
||||
List<String> brokenFiles = linkState.getStaticFilesWithBrokenLinks();
|
||||
for (String file : brokenFiles)
|
||||
{
|
||||
renderBrokenFile(context, out, file, linkState);
|
||||
}
|
||||
|
||||
out.write("</table></div></div>");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
private void renderBrokenFile(FacesContext context, ResponseWriter out,
|
||||
String file, LinkValidationState linkState) throws IOException
|
||||
{
|
||||
// gather the data to show for the file
|
||||
String fileName = file;
|
||||
String filePath = file;
|
||||
|
||||
int idx = file.lastIndexOf("/");
|
||||
if (idx != -1)
|
||||
{
|
||||
fileName = file.substring(idx+1);
|
||||
|
||||
int appbaseIdx = file.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE);
|
||||
if (appbaseIdx != -1)
|
||||
{
|
||||
filePath = file.substring(appbaseIdx+JNDIConstants.DIR_DEFAULT_APPBASE.length(), idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
filePath = file.substring(0, idx);
|
||||
}
|
||||
}
|
||||
|
||||
// build the list of broken links for the file
|
||||
List<String> brokenLinks = linkState.getBrokenLinksForFile(file);
|
||||
StringBuilder builder = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (String link : brokenLinks)
|
||||
{
|
||||
if (first == false)
|
||||
{
|
||||
builder.append(", ");
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
|
||||
builder.append(parseBrokenLink(link));
|
||||
}
|
||||
String brokenLinksList = builder.toString();
|
||||
|
||||
// render the row with the appropriate background style
|
||||
out.write("<tr class='");
|
||||
|
||||
if (this.oddRow)
|
||||
{
|
||||
out.write("linkValidationListOddRow");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write("linkValidationListEvenRow");
|
||||
}
|
||||
|
||||
// toggle the type of row
|
||||
this.oddRow = !this.oddRow;
|
||||
|
||||
// render the data
|
||||
out.write("'><td valign='top'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/filetypes32/html.gif' style='padding: 5px;' /></td>");
|
||||
out.write("<td width='100%'><div style='padding: 5px;'><div style='font-weight: bold;'>");
|
||||
out.write(fileName);
|
||||
out.write("</div><div style='padding-top: 2px;'>");
|
||||
out.write(filePath);
|
||||
out.write("</div><div style='padding-top: 4px; color: #aaa;'>");
|
||||
out.write(Application.getMessage(context, "broken_links"));
|
||||
out.write(":</div><div style='padding-top: 2px;'>");
|
||||
out.write(brokenLinksList);
|
||||
out.write("</div></div></td><td align='right' valign='top'>");
|
||||
out.write("<div style='white-space: nowrap; padding: 5px; padding-right: 10px;'>");
|
||||
out.write(" ");
|
||||
// out.write("<img src='/alfresco/images/icons/edit_icon.gif' /> ");
|
||||
// out.write("<img src='/alfresco/images/icons/update.gif' /> ");
|
||||
// out.write("<img src='/alfresco/images/icons/revert.gif' /> ");
|
||||
// out.write("<img src='/alfresco/images/icons/preview_website.gif' /> ");
|
||||
out.write("</div></td></tr>");
|
||||
}
|
||||
|
||||
private String parseBrokenLink(String linkUrl)
|
||||
{
|
||||
String link = linkUrl;
|
||||
|
||||
if (linkUrl.startsWith("http://") && linkUrl.indexOf("www--sandbox") != -1)
|
||||
{
|
||||
// remove the virtualisation server host name
|
||||
int idx = linkUrl.indexOf("/", 7);
|
||||
if (idx != -1)
|
||||
{
|
||||
link = linkUrl.substring(idx);
|
||||
}
|
||||
}
|
||||
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.config.JNDIConstants;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.wcm.LinkValidationState;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* JSF component that shows the fixed files for a link validation report.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class UILinkValidationFixedFiles extends AbstractLinkValidationReportComponent
|
||||
{
|
||||
private boolean oddRow = true;
|
||||
|
||||
private static Log logger = LogFactory.getLog(UILinkValidationFixedFiles.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
@Override
|
||||
public String getFamily()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationFixedFiles";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
if (isRendered() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get the link validation state object to get the data from
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
LinkValidationState linkState = getValue();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Rendering fixed files from state object: " + linkState);
|
||||
|
||||
// render the list of broken files and their contained links
|
||||
out.write("<div class='linkValidationFixedFilesPanel'><div class='linkValidationReportTitle'>");
|
||||
out.write(Application.getMessage(context, "fixed_files"));
|
||||
out.write("</div><div class='linkValidationList'><table width='100%' cellpadding='0' cellspacing='0'>");
|
||||
|
||||
List<String> fixedFiles = linkState.getFixedStaticFiles();
|
||||
for (String file : fixedFiles)
|
||||
{
|
||||
renderFixedFile(context, out, file, linkState);
|
||||
}
|
||||
|
||||
out.write("</table></div></div>");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
|
||||
private void renderFixedFile(FacesContext context, ResponseWriter out,
|
||||
String file, LinkValidationState linkState) throws IOException
|
||||
{
|
||||
// gather the data to show for the file
|
||||
String fileName = file;
|
||||
String filePath = file;
|
||||
|
||||
int idx = file.lastIndexOf("/");
|
||||
if (idx != -1)
|
||||
{
|
||||
fileName = file.substring(idx+1);
|
||||
|
||||
int appbaseIdx = file.indexOf(JNDIConstants.DIR_DEFAULT_APPBASE);
|
||||
if (appbaseIdx != -1)
|
||||
{
|
||||
filePath = file.substring(appbaseIdx+JNDIConstants.DIR_DEFAULT_APPBASE.length(), idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
filePath = file.substring(0, idx);
|
||||
}
|
||||
}
|
||||
|
||||
// render the row with the appropriate background style
|
||||
out.write("<tr class='");
|
||||
|
||||
if (this.oddRow)
|
||||
{
|
||||
out.write("linkValidationListOddRow");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.write("linkValidationListEvenRow");
|
||||
}
|
||||
|
||||
// toggle the type of row
|
||||
this.oddRow = !this.oddRow;
|
||||
|
||||
// render the data
|
||||
out.write("'><td valign='top'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/filetypes32/html.gif' style='padding: 5px;' /></td>");
|
||||
out.write("<td width='100%'><div style='padding: 5px;'><div style='font-weight: bold;'>");
|
||||
out.write(fileName);
|
||||
out.write("</div><div style='padding-top: 2px;'>");
|
||||
out.write(filePath);
|
||||
out.write("</div></div></td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* 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.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.el.MethodBinding;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.SelfRenderingComponent;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
import org.alfresco.web.ui.repo.component.UIActions;
|
||||
|
||||
/**
|
||||
* JSF component that displays information about the workflows a node is involved in.
|
||||
* <p>
|
||||
* The node to show workflow information on.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class UILinkValidationProgress extends SelfRenderingComponent
|
||||
{
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component Impl
|
||||
|
||||
@Override
|
||||
public String getFamily()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationProgress";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreState(FacesContext context, Object state)
|
||||
{
|
||||
Object values[] = (Object[])state;
|
||||
// standard component attributes are restored by the super class
|
||||
super.restoreState(context, values[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object saveState(FacesContext context)
|
||||
{
|
||||
Object values[] = new Object[1];
|
||||
// standard component attributes are saved by the super class
|
||||
values[0] = super.saveState(context);
|
||||
return values;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
if (!isRendered()) return;
|
||||
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
|
||||
// render the hidden action used to close the dialog
|
||||
UIActionLink action = findOrCreateHiddenAction(context);
|
||||
Utils.encodeRecursive(context, action);
|
||||
|
||||
// output the script
|
||||
out.write("<script type='text/javascript' src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/scripts/ajax/link-validation-progress.js'></script>\n");
|
||||
|
||||
// output the HTML
|
||||
out.write("<div class='linkValidationProgressPanel'><table border='0' cellspacing='4' cellpadding='2'>");
|
||||
out.write("<tr><td valign='top'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/ajax_anim.gif' /></td><td>");
|
||||
out.write("<div class='linkValidationProgressWait'>");
|
||||
out.write(Application.getMessage(context, "checking_links_progress"));
|
||||
out.write("</div><div class='linkValidationProgressStatus'>");
|
||||
out.write(Application.getMessage(context, "checking_links_status"));
|
||||
out.write("</div></td></tr></table></div>\n");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encodeEnd(FacesContext context) throws IOException
|
||||
{
|
||||
if (!isRendered()) return;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private UIActionLink findOrCreateHiddenAction(FacesContext fc)
|
||||
{
|
||||
UIActionLink action = null;
|
||||
String actionId = "validation-callback-link";
|
||||
|
||||
for (UIComponent component : (List<UIComponent>)getChildren())
|
||||
{
|
||||
if (actionId.equals(component.getId()))
|
||||
{
|
||||
action = (UIActionLink)component;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (action == null)
|
||||
{
|
||||
javax.faces.application.Application facesApp = fc.getApplication();
|
||||
action = (UIActionLink)facesApp.createComponent(UIActions.COMPONENT_ACTIONLINK);
|
||||
|
||||
action.setRendererType(UIActions.RENDERER_ACTIONLINK);
|
||||
action.setId(actionId);
|
||||
action.setValue("Callback");
|
||||
action.setShowLink(false);
|
||||
MethodBinding callback = facesApp.createMethodBinding(
|
||||
"#{DialogManager.bean.linkCheckCompleted}", new Class[] {});
|
||||
action.setAction(callback);
|
||||
action.getAttributes().put("style", "display:none;");
|
||||
|
||||
this.getChildren().add(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
}
|
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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.ui.wcm.component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.context.ResponseWriter;
|
||||
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.wcm.LinkValidationState;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* JSF component that shows the summary information for a link
|
||||
* validation report.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class UILinkValidationSummary extends AbstractLinkValidationReportComponent
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(UILinkValidationSummary.class);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Component implementation
|
||||
|
||||
@Override
|
||||
public String getFamily()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationSummary";
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void encodeBegin(FacesContext context) throws IOException
|
||||
{
|
||||
if (isRendered() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get the link validation state object to get the data from
|
||||
ResponseWriter out = context.getResponseWriter();
|
||||
LinkValidationState linkState = getValue();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Rendering summary from state object: " + linkState);
|
||||
|
||||
// resolve all the strings holding data
|
||||
ResourceBundle bundle = Application.getBundle(context);
|
||||
String pattern = bundle.getString("files_links_checked");
|
||||
String initialCheckSummary = MessageFormat.format(pattern,
|
||||
new Object[] {linkState.getInitialNumberFilesChecked(), linkState.getInitialNumberLinksChecked()});
|
||||
pattern = bundle.getString("files_links_broken");
|
||||
String initialBrokenSummary = MessageFormat.format(pattern,
|
||||
new Object[] {linkState.getInitialNumberBrokenFiles(), linkState.getInitialNumberBrokenLinks()});
|
||||
pattern = bundle.getString("files_links_still_broken");
|
||||
String stillBroken = MessageFormat.format(pattern,
|
||||
new Object[] {linkState.getNumberBrokenFiles(), linkState.getNumberBrokenLinks()});
|
||||
pattern = bundle.getString("broken_links_fixed");
|
||||
String linksFixed = MessageFormat.format(pattern,
|
||||
new Object[] {linkState.getNumberFixedLinks()});
|
||||
|
||||
// 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("</div><div style='margin-bottom: 14px;'><img src='");
|
||||
out.write(context.getExternalContext().getRequestContextPath());
|
||||
out.write("/images/icons/warning.gif'' style='vertical-align: -4px; padding-right: 4px;'/>");
|
||||
out.write(initialBrokenSummary);
|
||||
out.write("</div></td></tr>");
|
||||
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/warning.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("</div></td></tr>");
|
||||
out.write("</table></div>");
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.ui.wcm.tag;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
|
||||
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
|
||||
|
||||
/**
|
||||
* Tag class for adding the UILinkValidationBrokenFiles component to a JSP page.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationBrokenFilesTag extends HtmlComponentTag
|
||||
{
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||
*/
|
||||
public String getComponentType()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationBrokenFiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||
*/
|
||||
public String getRendererType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||
*/
|
||||
protected void setProperties(UIComponent component)
|
||||
{
|
||||
super.setProperties(component);
|
||||
|
||||
setStringProperty(component, "value", this.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
|
||||
*/
|
||||
public void release()
|
||||
{
|
||||
super.release();
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value (the list of servers to deploy to)
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.ui.wcm.tag;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
|
||||
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
|
||||
|
||||
/**
|
||||
* Tag class for adding the UILinkValidationFixedFiles component to a JSP page.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationFixedFilesTag extends HtmlComponentTag
|
||||
{
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||
*/
|
||||
public String getComponentType()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationFixedFiles";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||
*/
|
||||
public String getRendererType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||
*/
|
||||
protected void setProperties(UIComponent component)
|
||||
{
|
||||
super.setProperties(component);
|
||||
|
||||
setStringProperty(component, "value", this.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
|
||||
*/
|
||||
public void release()
|
||||
{
|
||||
super.release();
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value (the list of servers to deploy to)
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.ui.wcm.tag;
|
||||
|
||||
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
|
||||
|
||||
/**
|
||||
* Tag class for adding the UILinkValidationProgress component to a JSP page.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationProgressTag extends HtmlComponentTag
|
||||
{
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||
*/
|
||||
public String getComponentType()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationProgress";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||
*/
|
||||
public String getRendererType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.ui.wcm.tag;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
|
||||
import org.alfresco.web.ui.common.tag.HtmlComponentTag;
|
||||
|
||||
/**
|
||||
* Tag class for adding the UILinkValidationSummary component to a JSP page.
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class LinkValidationSummaryTag extends HtmlComponentTag
|
||||
{
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getComponentType()
|
||||
*/
|
||||
public String getComponentType()
|
||||
{
|
||||
return "org.alfresco.faces.LinkValidationSummary";
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#getRendererType()
|
||||
*/
|
||||
public String getRendererType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.faces.webapp.UIComponentTag#setProperties(javax.faces.component.UIComponent)
|
||||
*/
|
||||
protected void setProperties(UIComponent component)
|
||||
{
|
||||
super.setProperties(component);
|
||||
|
||||
setStringProperty(component, "value", this.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.ui.common.tag.HtmlComponentTag#release()
|
||||
*/
|
||||
public void release()
|
||||
{
|
||||
super.release();
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the value (the list of servers to deploy to)
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
@@ -3416,6 +3416,44 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Run 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-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>actionService</property-name>
|
||||
<value>#{ActionService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMService}</value>
|
||||
</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>
|
||||
@@ -3754,4 +3792,17 @@
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.DeploymentProgressBean</managed-bean-class>
|
||||
<managed-bean-scope>request</managed-bean-scope>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
Bean that returns link validation progress status
|
||||
</description>
|
||||
<managed-bean-name>LinkValidationProgressBean</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.LinkValidationProgressBean</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
</faces-config>
|
||||
|
@@ -39,6 +39,26 @@
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UIPendingSubmissions</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.LinkValidationProgress</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UILinkValidationProgress</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.LinkValidationSummary</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UILinkValidationSummary</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.LinkValidationBrokenFiles</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UILinkValidationBrokenFiles</component-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<component-type>org.alfresco.faces.LinkValidationFixedFiles</component-type>
|
||||
<component-class>org.alfresco.web.ui.wcm.component.UILinkValidationFixedFiles</component-class>
|
||||
</component>
|
||||
|
||||
<!-- ==================== CONVERTERS ==================== -->
|
||||
|
||||
|
||||
|
@@ -267,4 +267,112 @@
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>linkValidationProgress</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.LinkValidationProgressTag</tag-class>
|
||||
<display-name>Link Validation Progress</display-name>
|
||||
<body-content>JSP</body-content>
|
||||
<description>Monitors the progress of the current link validation check being executed.</description>
|
||||
|
||||
<attribute>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>rendered</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>Flag to determine whether component should be rendered</description>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>linkValidationSummary</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.LinkValidationSummaryTag</tag-class>
|
||||
<body-content>JSP</body-content>
|
||||
<display-name>Link Validation Sumary</display-name>
|
||||
<description>Displays summary information for a link validation report</description>
|
||||
|
||||
<attribute>
|
||||
<name>value</name>
|
||||
<required>true</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The link validation state object holding the report data</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The component identifier for this component</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>rendered</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>Flag to determine whether component should be rendered</description>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>linkValidationBrokenFiles</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.LinkValidationBrokenFilesTag</tag-class>
|
||||
<body-content>JSP</body-content>
|
||||
<display-name>Link Validation Broken Files</display-name>
|
||||
<description>Displays broken file information for a link validation report</description>
|
||||
|
||||
<attribute>
|
||||
<name>value</name>
|
||||
<required>true</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The link validation state object holding the report data</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The component identifier for this component</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>rendered</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>Flag to determine whether component should be rendered</description>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
<tag>
|
||||
<name>linkValidationFixedFiles</name>
|
||||
<tag-class>org.alfresco.web.ui.wcm.tag.LinkValidationFixedFilesTag</tag-class>
|
||||
<body-content>JSP</body-content>
|
||||
<display-name>Link Validation Fixed Files</display-name>
|
||||
<description>Displays the list of files fixed since the initial run of a link validation report</description>
|
||||
|
||||
<attribute>
|
||||
<name>value</name>
|
||||
<required>true</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The link validation state object holding the report data</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>id</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>The component identifier for this component</description>
|
||||
</attribute>
|
||||
|
||||
<attribute>
|
||||
<name>rendered</name>
|
||||
<required>false</required>
|
||||
<rtexprvalue>true</rtexprvalue>
|
||||
<description>Flag to determine whether component should be rendered</description>
|
||||
</attribute>
|
||||
</tag>
|
||||
|
||||
</taglib>
|
||||
|
@@ -718,3 +718,81 @@ a.sidebarButtonLink, a.sidebarButtonLink:link, a.sidebarButtonLink:visited
|
||||
{
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.linkValidationProgressPanel
|
||||
{
|
||||
width: 100%;
|
||||
margin: 30px;
|
||||
}
|
||||
|
||||
.linkValidationProgressWait
|
||||
{
|
||||
font-size: 14px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.linkValidationProgressStatus
|
||||
{
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.linkValidationReportTitle
|
||||
{
|
||||
color: #004488;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.linkValidationReportSubTitle
|
||||
{
|
||||
color: #004488;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.linkValidationSummaryPanel
|
||||
{
|
||||
margin: 6px;
|
||||
padding: 8px;
|
||||
background-color: white;
|
||||
/* border: 1px solid #babfc5; */
|
||||
}
|
||||
|
||||
.linkValidationBrokenFilesPanel
|
||||
{
|
||||
margin: 6px;
|
||||
margin-top: 10px;
|
||||
padding: 8px;
|
||||
background-color: white;
|
||||
/* border: 1px solid #babfc5; */
|
||||
}
|
||||
|
||||
.linkValidationFixedFilesPanel
|
||||
{
|
||||
margin: 6px;
|
||||
margin-top: 10px;
|
||||
padding: 8px;
|
||||
background-color: white;
|
||||
/* border: 1px solid #babfc5; */
|
||||
}
|
||||
|
||||
.linkValidationList
|
||||
{
|
||||
overflow: auto;
|
||||
height: 150px;
|
||||
border: 1px solid #aaa;
|
||||
}
|
||||
|
||||
.linkValidationListOddRow
|
||||
{
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.linkValidationListEvenRow
|
||||
{
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
|
||||
|
BIN
source/web/images/icons/fixed_link.gif
Normal file
After Width: | Height: | Size: 335 B |
BIN
source/web/images/icons/link_validation_report.gif
Normal file
After Width: | Height: | Size: 335 B |
BIN
source/web/images/icons/link_validation_report_large.gif
Normal file
After Width: | Height: | Size: 967 B |
BIN
source/web/images/icons/placeholder.gif
Normal file
After Width: | Height: | Size: 335 B |
BIN
source/web/images/icons/placeholder_large.gif
Normal file
After Width: | Height: | Size: 967 B |
BIN
source/web/images/icons/run_link_validation.gif
Normal file
After Width: | Height: | Size: 335 B |
BIN
source/web/images/icons/run_link_validation_large.gif
Normal file
After Width: | Height: | Size: 967 B |
@@ -139,6 +139,11 @@
|
||||
</td>
|
||||
<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">
|
||||
<f:param name="store" value="#{AVMBrowseBean.stagingStore}" />
|
||||
</a:actionLink>
|
||||
|
||||
<a:actionLink id="actBrowse" value="#{msg.sandbox_browse}" image="/images/icons/space_small.gif"
|
||||
actionListener="#{AVMBrowseBean.setupSandboxAction}" action="browseSandbox" />
|
||||
|
||||
|
46
source/web/jsp/wcm/link-validation-report.jsp
Normal file
@@ -0,0 +1,46 @@
|
||||
<%--
|
||||
* 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:linkValidationSummary value="#{AVMBrowseBean.linkValidationState}" />
|
||||
<w:linkValidationBrokenFiles value="#{AVMBrowseBean.linkValidationState}" />
|
||||
<w:linkValidationFixedFiles value="#{AVMBrowseBean.linkValidationState}" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
35
source/web/jsp/wcm/run-link-validation.jsp
Normal file
@@ -0,0 +1,35 @@
|
||||
<%--
|
||||
* 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 />
|
61
source/web/scripts/ajax/link-validation-progress.js
Normal file
@@ -0,0 +1,61 @@
|
||||
Alfresco.LinkValidationMonitor = function()
|
||||
{
|
||||
this.url = getContextPath() + '/ajax/invoke/LinkValidationProgressBean.getStatus';
|
||||
this.failedMsg = '';
|
||||
this.successMsg = '';
|
||||
}
|
||||
|
||||
Alfresco.LinkValidationMonitor.prototype = {
|
||||
url: null,
|
||||
failedMsg: null,
|
||||
successMsg: null,
|
||||
retrieveLinkValidationStatus: function() {
|
||||
YAHOO.util.Connect.asyncRequest('GET', this.url,
|
||||
{
|
||||
success: this.processResults,
|
||||
failure: this.handleError,
|
||||
scope: this
|
||||
},
|
||||
null);
|
||||
},
|
||||
processResults: function(ajaxResponse) {
|
||||
var xml = ajaxResponse.responseXML.documentElement;
|
||||
var finished = xml.getAttribute('finished');
|
||||
var fileCount = xml.getAttribute('file-count');
|
||||
var linkCount = xml.getAttribute('link-count');
|
||||
|
||||
var fileCountElem = document.getElementById('file-count');
|
||||
if (fileCountElem != null) {
|
||||
fileCountElem.innerHTML = fileCount;
|
||||
}
|
||||
var linkCountElem = document.getElementById('link-count');
|
||||
if (linkCountElem != null) {
|
||||
linkCountElem.innerHTML = linkCount;
|
||||
}
|
||||
|
||||
if (finished == 'true') {
|
||||
var linkOnclick = document.getElementById('validation-callback-link').onclick;
|
||||
linkOnclick();
|
||||
} else {
|
||||
setTimeout('Alfresco.linkMonitor.retrieveLinkValidationStatus()', 2000);
|
||||
}
|
||||
},
|
||||
handleError: function(ajaxResponse) {
|
||||
handleErrorYahoo(ajaxResponse.status + ' ' + ajaxResponse.statusText);
|
||||
}
|
||||
}
|
||||
|
||||
Alfresco.initLinkValidationMonitor = function() {
|
||||
Alfresco.linkMonitor = new Alfresco.LinkValidationMonitor();
|
||||
Alfresco.linkMonitor.retrieveLinkValidationStatus();
|
||||
}
|
||||
|
||||
Alfresco.linkMonitor = null;
|
||||
window.onload = Alfresco.initLinkValidationMonitor;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|