From 224a6b2fb82291f7bb8789c561bcc525a2badb67 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Tue, 13 Nov 2007 00:24:19 +0000 Subject: [PATCH] Merged V2.1 to HEAD 6958: Fix for WCM-823 6959: Merged V1.4 to V2.1 6943: Upgrade scripts for transaction commit time and indexes for QName columns on alf_child_assoc 6960: Fixed script patch "applied on" date updates. 6961: Retry transactions on ConstraintViolationException. 6964: Added svn revision number to be substituted into build string if build number is not passed. 6965: Daylight savings for FTP. Fix for AR-1776. 6966: Added catch blocks for the AVMLockingException. WCM-877. 6967: Interim fix for WCM-866 (large link validation report causes SQL exception) 6968: Fixes for AWC-1309 "Broken preview image for Web Projects in MySpaces" and similar AWC-1635 "Broken/Missing images in MySpaces Web Script". 6970: Force DB write ordering of the NodeStatus vs Node object. 6971: More transaction demarcation fixes for special cases of non-executed script patches. 6972: Switch off session size management for the mass archive and restore test. 6973: Fixed AR-1801: Boolean isMultiValued() no longer returns null git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7370 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 1 + .../alfresco/portlets/myspaces.get.html.ftl | 2 + .../portlets/myspacespanel.get.html.ftl | 2 + .../web/bean/wcm/LinkValidationState.java | 28 +- .../wcm/component/UILinkValidationReport.java | 383 +++++++++--------- .../component/UILinkValidationSummary.java | 148 ++++--- 6 files changed, 308 insertions(+), 256 deletions(-) diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index ed243bfa23..70daa5efec 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1242,6 +1242,7 @@ generated_tab={0} Generated Files all_items_tab=All Items inc_tab_size=Increases the size of the scrollable area by 100px dec_tab_size=Decreases the size of the scrollable area by 100px (to a minimum of 100px) +failed_to_find_validation_report=Failed to find the link validation report, this is probably due to the report being too large, please lower the 'maxNumberLinksInReport' setting. prompt_for_web_form=Select Web Form prompt_for_web_form_info=Select the Web Form to use for editing this file diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl index 0618565895..60795833b0 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspaces.get.html.ftl @@ -123,6 +123,7 @@ a.spacefilterLink:link, a.spacefilterLink:visited font-size: 12px; font-weight: bold; text-decoration: none; + outline: none; padding-left: 4px; padding-right: 4px; } @@ -531,6 +532,7 @@ a.refreshViewLink:link, a.refreshViewLink:visited, a.refreshViewLink:hover font-size: 12px; color: #515D6B; text-decoration: none; + outline: none; } .spacePreview diff --git a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.html.ftl b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.html.ftl index 1d313e22bf..6051b9a32e 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.html.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/portlets/myspacespanel.get.html.ftl @@ -3,6 +3,8 @@ <#assign weekms=1000*60*60*24*7> <#list companyhome.nodeByReference[args.h].children?sort_by('name') as d> <#if (d.isContainer || d.isDocument) && + (d.type != "{http://www.alfresco.org/model/forum/1.0}forums") && + (d.type != "{http://www.alfresco.org/model/wcmappmodel/1.0}webfolder") && ((args.f="0") || (args.f="1" && d.isContainer) || (args.f="2" && d.isDocument) || diff --git a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java index efe918bd73..adafa11f7a 100644 --- a/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java +++ b/source/java/org/alfresco/web/bean/wcm/LinkValidationState.java @@ -60,6 +60,7 @@ public class LinkValidationState private String store; private String webapp; private boolean checkBeenReRun = false; + private boolean maxLinksReached = false; private Date checkCompletedAt; private int noFilesCheckedStart = -1; @@ -82,6 +83,8 @@ public class LinkValidationState private int baseSnapshotVersion = 0; private int latestSnapshotVersion = 0; + private int maxNumberLinksInReport = -1; + private List brokenStaticFilesStart; private List brokenFormsStart; @@ -237,7 +240,7 @@ public class LinkValidationState */ public int getBaseSnapshotVersion() { - return baseSnapshotVersion; + return this.baseSnapshotVersion; } /** @@ -245,7 +248,23 @@ public class LinkValidationState */ public int getLatestSnapshotVersion() { - return latestSnapshotVersion; + return this.latestSnapshotVersion; + } + + /** + * @return The maximum number of links a report can have + */ + public int getMaxNumberLinksInReport() + { + return this.maxNumberLinksInReport; + } + + /** + * @return true if the maximum number of links was exceeded in the last check + */ + public boolean hasMaxNumberLinksExceeded() + { + return this.maxLinksReached; } /** @@ -360,6 +379,11 @@ public class LinkValidationState // get the snapshot versions this.baseSnapshotVersion = report.getBaseSnapshotVersion(); this.latestSnapshotVersion = report.getLatestSnapshotVersion(); + + // get whether the max number of links was exceeded for the report + // and the maximum number of links allowed + this.maxLinksReached = report.hasMaxNumberLinksExceeded(); + this.maxNumberLinksInReport = report.getMaxNumberLinksInReport(); if (this.cause == null) { diff --git a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationReport.java b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationReport.java index 09eb1b13e9..a763204de9 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationReport.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UILinkValidationReport.java @@ -119,206 +119,213 @@ public class UILinkValidationReport extends AbstractLinkValidationReportComponen if (logger.isDebugEnabled()) logger.debug("Rendering report from state object: " + linkState); - if (linkState.getError() == null && linkState.getNumberBrokenLinks() > 0) + if (linkState != null) { - // determine whether the generated files and broken links sections - // should be expanded - boolean sectionsExpanded = this.getItemsExpanded(); - - // render the required JavaScript - String selectedTab = this.getInitialTab(); - out.write("\n"); - - out.write("\n"); - - out.write("\n"); - - // gather count data for tab titles - int numStaticFiles = linkState.getStaticFilesWithBrokenLinks().size(); - int numForms = linkState.getFormsWithBrokenLinks().size(); - int numBrokenFileLinks = linkState.getNoBrokenLinksInStaticFiles(); - int numBrokenFormLinks = linkState.getNoBrokenLinksInForms(); - int numFixedItems = linkState.getNumberFixedItems(); - - String pattern = bundle.getString("static_tab"); - String staticTabTitle = MessageFormat.format(pattern, - new Object[] {numStaticFiles}); - - pattern = bundle.getString("generated_tab"); - String generatedTabTitle = MessageFormat.format(pattern, - new Object[] {numForms}); - - // render the tabs - out.write("
"); - - // reset the oddRow flag - this.oddRow = true; - - // render the list of broken files and their contained links - out.write(""); - - // reset the oddRow flag - this.oddRow = true; - - // render the list of broken forms, the files it generated and their contained links - out.write(""); } - if (linkState.getError() == null) + if (linkState != null) { - // render the main summary info - - int latestVersion = linkState.getLatestSnapshotVersion(); - int baseVersion = linkState.getBaseSnapshotVersion(); - - String pattern = bundle.getString("link_check_completed_at"); - Date checkAt = linkState.getCheckCompletedAt(); - String checkTime = Utils.getDateTimeFormat(context).format(checkAt); - String checkTimeSummary = MessageFormat.format(pattern, - new Object[] {checkTime, baseVersion}); - - out.write("
"); - out.write(checkTimeSummary); - - // NOTE: Whenever latestVersion > baseVersion, link validation is "behind". - if (latestVersion > baseVersion) + if (linkState.getError() == null) { - pattern = bundle.getString("link_check_not_latest"); - String latestVersionInfo = - MessageFormat.format( - pattern, new Object[] { new Integer( latestVersion )}); - + // render the main summary info + + int latestVersion = linkState.getLatestSnapshotVersion(); + int baseVersion = linkState.getBaseSnapshotVersion(); + + String pattern = bundle.getString("link_check_completed_at"); + Date checkAt = linkState.getCheckCompletedAt(); + String checkTime = Utils.getDateTimeFormat(context).format(checkAt); + String checkTimeSummary = MessageFormat.format(pattern, + new Object[] {checkTime, baseVersion}); + + out.write("
"); + out.write(checkTimeSummary); + + // NOTE: Whenever latestVersion > baseVersion, link validation is "behind". + if (latestVersion > baseVersion) + { + pattern = bundle.getString("link_check_not_latest"); + String latestVersionInfo = + MessageFormat.format( + pattern, new Object[] { new Integer( latestVersion )}); + + out.write("  "); + out.write( latestVersionInfo ); + } + + pattern = bundle.getString("link_check_items_found"); + String checkedSummary = MessageFormat.format(pattern, + new Object[] {linkState.getNumberFilesChecked(), + linkState.getNumberLinksChecked()}); + + pattern = bundle.getString("link_check_items_broken"); + + String numBrokenLinks = Integer.toString(linkState.getNumberBrokenLinks()); + if (linkState.hasMaxNumberLinksExceeded()) + { + numBrokenLinks = Integer.toString(linkState.getMaxNumberLinksInReport()) + "+"; + } + + String brokenSummary = MessageFormat.format(pattern, + new Object[] {numBrokenLinks, linkState.getNumberBrokenFiles()}); + + out.write("
"); + out.write(checkedSummary); out.write("  "); - out.write( latestVersionInfo ); - } - - pattern = bundle.getString("link_check_items_found"); - String checkedSummary = MessageFormat.format(pattern, - new Object[] {linkState.getNumberFilesChecked(), - linkState.getNumberLinksChecked()}); - - pattern = bundle.getString("link_check_items_broken"); - String brokenSummary = MessageFormat.format(pattern, - new Object[] {linkState.getNumberBrokenLinks(), - linkState.getNumberBrokenFiles()}); - - out.write("
"); - out.write(checkedSummary); - out.write("  "); - out.write(bundle.getString("link_check_no_broken")); + + if (linkState.getNumberBrokenLinks() == 0) + { + out.write("/images/icons/info_icon.gif' /> "); + out.write(bundle.getString("link_check_no_broken")); + } + else + { + out.write("/images/icons/warning.gif' /> "); + out.write(brokenSummary); + } + out.write("
"); } else { - out.write("/images/icons/warning.gif' /> "); - out.write(brokenSummary); + // render the error that occurred + String pattern = bundle.getString("link_check_error"); + Date initialCheck = linkState.getCheckCompletedAt(); + String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck); + String initialCheckSummary = MessageFormat.format(pattern, + new Object[] {initialCheckTime}); + + out.write(initialCheckSummary); + out.write(" "); + String err = linkState.getError().getMessage(); + if (err == null) + { + out.write(linkState.getError().toString()); + } + else + { + out.write(err); + } + out.write(""); } - out.write("
"); } else { - // render the error that occurred - String pattern = bundle.getString("link_check_error"); - Date initialCheck = linkState.getCheckCompletedAt(); - String initialCheckTime = Utils.getDateTimeFormat(context).format(initialCheck); - String initialCheckSummary = MessageFormat.format(pattern, - new Object[] {initialCheckTime}); - - out.write(initialCheckSummary); - out.write(" "); - String err = linkState.getError().getMessage(); - if (err == null) - { - out.write(linkState.getError().toString()); - } - else - { - out.write(err); - } + // if the report was not found at all, show an error to that effect + out.write(""); + out.write(bundle.getString("failed_to_find_validation_report")); out.write(""); }