|
|
Choosing A Webhost: |
svn commit: r533689 - in /lenya/trunk/src/modules-core/workflow: java/src/o: msg#00240cms.lenya.cvs
Author: andreas Date: Mon Apr 30 03:46:46 2007 New Revision: 533689 URL: http://svn.apache.org/viewvc?view=rev&rev=533689 Log: Use plain error messages for unpublished ancestor docs. This makes the error messages compatible with the multiWorkflow (workflow overview) usecase. See bug 42292. 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 lenya/trunk/src/modules-core/workflow/usecases/publish.jx 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=533689&r1=533688&r2=533689 ============================================================================== --- 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 Mon Apr 30 03:46:46 2007 @@ -24,6 +24,7 @@ import java.util.Date; import java.util.GregorianCalendar; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -37,6 +38,7 @@ import org.apache.lenya.cms.linking.LinkManager; import org.apache.lenya.cms.linking.LinkResolver; import org.apache.lenya.cms.linking.LinkTarget; +import org.apache.lenya.cms.metadata.dublincore.DublinCoreHelper; import org.apache.lenya.cms.observation.RepositoryEvent; import org.apache.lenya.cms.observation.RepositoryEventFactory; import org.apache.lenya.cms.publication.Document; @@ -71,7 +73,6 @@ protected static final String MESSAGE_SUBJECT = "notification-message"; protected static final String MESSAGE_DOCUMENT_PUBLISHED = "document-published"; - protected static final String MISSING_DOCUMENTS = "missingDocuments"; protected static final String SCHEDULE = "schedule"; protected static final String SCHEDULE_TIME = "schedule.time"; protected static final String SEND_NOTIFICATION = "sendNotification"; @@ -136,7 +137,7 @@ Document doc = getSourceDocument(); nodes.add(doc.getRepositoryNode()); nodes.add(doc.area().getSite().getRepositoryNode()); - + return (org.apache.lenya.cms.repository.Node[]) nodes .toArray(new org.apache.lenya.cms.repository.Node[nodes.size()]); @@ -203,8 +204,19 @@ } if (!missingDocuments.isEmpty()) { - addErrorMessage("Cannot publish document unless the following documents are published:"); - setParameter(MISSING_DOCUMENTS, missingDocuments); + addErrorMessage("publish-missing-documents"); + for (Iterator i = missingDocuments.iterator(); i.hasNext();) { + Document doc = (Document) i.next(); + /* + * This doesn't work yet, see + * https://issues.apache.org/jira/browse/COCOON-2057 + * String[] params = { doc.getCanonicalWebappURL(), + * doc.getPath() + " (" + doc.getLanguage() + ")" }; + */ + String[] params = { doc.getPath() + ":" + doc.getLanguage(), + DublinCoreHelper.getTitle(doc) }; + addErrorMessage("missing-document", params); + } } } } @@ -294,20 +306,21 @@ Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(), getLogger(), authoringDocument); Version versions[] = workflowable.getVersions(); - Version version = versions[versions.length-2]; + Version version = versions[versions.length - 2]; - // we assume that the document has been submitted, otherwise we do nothing + // we assume that the document has been submitted, otherwise we do + // nothing if (version.getEvent().equals("submit")) { - + String userId = version.getUserId(); - User user = PolicyUtil.getUser(this.manager, authoringDocument - .getCanonicalWebappURL(), userId, getLogger()); - + User user = PolicyUtil.getUser(this.manager, authoringDocument.getCanonicalWebappURL(), + userId, getLogger()); + Identifiable[] recipients = { user }; - + Document liveVersion = authoringDocument.getAreaVersion(Publication.LIVE_AREA); String url; - + Proxy proxy = liveVersion.getPublication().getProxy(liveVersion, false); if (proxy != null) { url = proxy.getURL(liveVersion); @@ -319,12 +332,12 @@ url = serverUrl + request.getContextPath() + webappUrl; } String[] params = { url }; - Message message = new Message(MESSAGE_SUBJECT, new String[0], MESSAGE_DOCUMENT_PUBLISHED, - params, sender, recipients); - + Message message = new Message(MESSAGE_SUBJECT, new String[0], + MESSAGE_DOCUMENT_PUBLISHED, params, sender, recipients); + NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message); - RepositoryEvent event = RepositoryEventFactory - .createEvent(this.manager, getSession(), getLogger(), descriptor); + RepositoryEvent event = RepositoryEventFactory.createEvent(this.manager, getSession(), + getLogger(), descriptor); getSession().enqueueEvent(event); } } 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=533689&r1=533688&r2=533689 ============================================================================== --- lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml (original) +++ lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui.xml Mon Apr 30 03:46:46 2007 @@ -30,5 +30,14 @@ <message key="Actions">Actions</message> <message key="state-as-text">State as text</message> <message key="state-as-columns">State as columns</message> + <message key="publish-missing-documents"> + The document can't be published unless the following documents are published: + </message> + <message key="missing-document"> + <!-- This doesn't work yet, see https://issues.apache.org/jira/browse/COCOON-2057 + <xhtml:a href="{0}">{1}</xhtml:a> + --> + {0} ("{1}") + </message> </catalogue> 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=533689&r1=533688&r2=533689 ============================================================================== --- lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml (original) +++ lenya/trunk/src/modules-core/workflow/resources/i18n/cmsui_de.xml Mon Apr 30 03:46:46 2007 @@ -30,6 +30,15 @@ <message key="Actions">Aktionen</message> <message key="state-as-text">Zustand als Text</message> <message key="state-as-columns">Zustand als Spalten</message> + <message key="publish-missing-documents"> + Das Dokument kann nicht publiziert werden, solange die folgenden Dokumente nicht publiziert sind: + </message> + <message key="missing-document"> + <!-- This doesn't work yet, see https://issues.apache.org/jira/browse/COCOON-2057 + <xhtml:a href="{0}">{1}</xhtml:a> + --> + {0} ("{1}") + </message> </catalogue> Modified: lenya/trunk/src/modules-core/workflow/usecases/publish.jx URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/usecases/publish.jx?view=diff&rev=533689&r1=533688&r2=533689 ============================================================================== --- lenya/trunk/src/modules-core/workflow/usecases/publish.jx (original) +++ lenya/trunk/src/modules-core/workflow/usecases/publish.jx Mon Apr 30 03:46:46 2007 @@ -63,11 +63,6 @@ </i18n:translate> </li> </jx:forEach> - <jx:forEach var="missingDocument" items="${usecase.getParameter('missingDocuments')}"> - <li> - <a href="${request.getContextPath() + missingDocument.getCanonicalWebappURL()}"><jx:out value="${missingDocument.getId()}"/> [<jx:out value="${missingDocument.getLanguage()}"/>]</a> - </li> - </jx:forEach> <jx:forEach var="message" items="${usecase.getInfoMessages()}"> <li> <i18n:translate>
|
|
| <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 |