You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by eg...@apache.org on 2003/10/02 14:36:37 UTC
cvs commit: cocoon-lenya/src/webapp/lenya/content/publishing screen.xsp
egli 2003/10/02 05:36:37
Modified: src/webapp/lenya/content/publishing screen.xsp
Log:
Use the DocumentReferencesHelper to produce a list of all
non-published documents which are referenced in the current document.
Revision Changes Path
1.13 +59 -42 cocoon-lenya/src/webapp/lenya/content/publishing/screen.xsp
Index: screen.xsp
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/publishing/screen.xsp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- screen.xsp 23 Sep 2003 08:52:47 -0000 1.12
+++ screen.xsp 2 Oct 2003 12:36:37 -0000 1.13
@@ -17,6 +17,7 @@
<xsp:include>org.apache.lenya.cms.publication.Publication</xsp:include>
<xsp:include>org.apache.lenya.cms.publication.SiteTree</xsp:include>
<xsp:include>org.apache.lenya.cms.publication.SiteTreeNode</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.xsp.DocumentReferencesHelper</xsp:include>
<xsp:include>org.apache.lenya.cms.workflow.CMSVersion</xsp:include>
<xsp:include>org.apache.lenya.cms.workflow.WorkflowFactory</xsp:include>
<xsp:include>org.apache.lenya.workflow.impl.History</xsp:include>
@@ -71,48 +72,64 @@
}
</xsp:logic>
- <not:users>
- <xsp:logic>
-
- try {
-
- Document document = (Document)
- <input:get-attribute module="page-envelope" as="object" name="document"/>;
- String userId = null;
-
- if (WorkflowFactory.newInstance().hasWorkflow(document)) {
- History history = WorkflowFactory.getHistory(document);
- Version[] versions = history.getVersions();
-
- int i = versions.length - 1;
- while (userId == null && i >= 0) {
- if (versions[i].getEvent() != null &&
- versions[i].getEvent().getName().equals("submit")) {
- userId = ((CMSVersion) versions[i]).getUserId();
- }
- i--;
- }
- }
-
- if (userId != null) {
- UserManager userManager = (UserManager)
- <input:get-attribute module="access-control" as="object" name="user-manager"/>;
- User user = userManager.getUser(userId);
- <not:user>
- <xsp:attribute name="id"><xsp:expr>user.getId()</xsp:expr></xsp:attribute>
- <xsp:attribute name="name"><xsp:expr>user.getName()</xsp:expr></xsp:attribute>
- <xsp:attribute name="email"><xsp:expr>user.getEmail()</xsp:expr></xsp:attribute>
- </not:user>
- }
- }
- catch (Exception e) {
- throw new ProcessingException(e);
- }
-
- </xsp:logic>
-
- </not:users>
-
+ <not:users>
+ <xsp:logic>
+
+ try {
+
+ Document document = (Document)
+ <input:get-attribute module="page-envelope" as="object" name="document"/>;
+ String userId = null;
+
+ if (WorkflowFactory.newInstance().hasWorkflow(document)) {
+ History history = WorkflowFactory.getHistory(document);
+ Version[] versions = history.getVersions();
+
+ int i = versions.length - 1;
+ while (userId == null && i >= 0) {
+ if (versions[i].getEvent() != null &&
+ versions[i].getEvent().getName().equals("submit")) {
+ userId = ((CMSVersion) versions[i]).getUserId();
+ }
+ i--;
+ }
+ }
+
+ if (userId != null) {
+ UserManager userManager = (UserManager)
+ <input:get-attribute module="access-control" as="object" name="user-manager"/>;
+ User user = userManager.getUser(userId);
+ <not:user>
+ <xsp:attribute name="id"><xsp:expr>user.getId()</xsp:expr></xsp:attribute>
+ <xsp:attribute name="name"><xsp:expr>user.getName()</xsp:expr></xsp:attribute>
+ <xsp:attribute name="email"><xsp:expr>user.getEmail()</xsp:expr></xsp:attribute>
+ </not:user>
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException(e);
+ }
+
+ </xsp:logic>
+
+ </not:users>
+
+ <xsp:logic>
+ DocumentReferencesHelper helper = new DocumentReferencesHelper(objectModel);
+ String[] references = helper.getInternalReferences();
+ if (references.length > 0) {
+ </xsp:logic><referenced-documents><xsp:logic>
+
+ for (int i = 0; i < references.length; i++) {
+ <referenced-document>
+ <xsp:attribute name="href"><xsp:expr>helper.getURL(Publication.AUTHORING_AREA, references[i])</xsp:expr></xsp:attribute>
+ <xsp:expr>references[i]</xsp:expr>
+ </referenced-document>
+ }
+ </xsp:logic></referenced-documents><xsp:logic>
+ }
+ </xsp:logic>
+
</usecase:publish>
</xsp:page>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org