|
|
Choosing A Webhost: |
svn commit: r534361 - in /lenya/trunk/src/modules-core/workflow: java/src/o: msg#00007cms.lenya.cvs
Author: andreas Date: Wed May 2 02:06:06 2007 New Revision: 534361 URL: http://svn.apache.org/viewvc?view=rev&rev=534361 Log: Publish usecase: add info message for broken links. This fixes bug 42303. Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java?view=diff&rev=534361&r1=534360&r2=534361 ============================================================================== --- lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java (original) +++ lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java Wed May 2 02:06:06 2007 @@ -96,6 +96,33 @@ setParameter(SEND_NOTIFICATION, Boolean.TRUE); setParameter(UNPUBLISHED_LINKS, new LinkList(this.manager, getSourceDocument())); + + } + + protected boolean hasBrokenLinks() { + LinkManager linkMgr = null; + LinkResolver resolver = null; + try { + linkMgr = (LinkManager) this.manager.lookup(LinkManager.ROLE); + resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE); + org.apache.lenya.cms.linking.Link[] links = linkMgr.getLinksFrom(getSourceDocument()); + for (int i = 0; i < links.length; i++) { + LinkTarget target = resolver.resolve(getSourceDocument(), links[i].getUri()); + if (!target.exists()) { + return true; + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + if (linkMgr != null) { + this.manager.release(linkMgr); + } + if (resolver != null) { + this.manager.release(resolver); + } + } + return false; } /** @@ -188,6 +215,10 @@ DublinCoreHelper.getTitle(doc) }; addErrorMessage("missing-document", params); } + } + + if (hasBrokenLinks()) { + addInfoMessage("publish-broken-links"); } } } Modified: lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml?view=diff&rev=534361&r1=534360&r2=534361 ============================================================================== --- lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml (original) +++ lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml Wed May 2 02:06:06 2007 @@ -42,6 +42,7 @@ <message key="unpublished-links">Links to unpublished documents:</message> <message key="links-to-document">Links from other documents:</message> + <message key="publish-broken-links">The document contains broken links.</message> <message key="notify-reviewers">Notify reviewers</message> Modified: lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml?view=diff&rev=534361&r1=534360&r2=534361 ============================================================================== --- lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml (original) +++ lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml Wed May 2 02:06:06 2007 @@ -42,6 +42,7 @@ <message key="unpublished-links">Links zu nicht publizierten Dokumenten:</message> <message key="links-to-document">Links von anderen Dokumenten:</message> + <message key="publish-broken-links">Das Dokument enthält Links zu nicht existierenden Dokumenten.</message> <message key="notify-reviewers">Prüfer benachrichtigen</message>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |