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/09/02 17:25:48 UTC
cvs commit: cocoon-lenya/src/webapp/lenya/content/info overview.xsp meta.xsp
egli 2003/09/02 08:25:48
Modified: src/webapp/lenya/content/info overview.xsp meta.xsp
Log:
Make sure that if the document doesn't exist (as is the case for trash
and archive nodes in site tree in info area) no attempt is made to
fetch the dublin core meta data (which would lead to an exception)
Revision Changes Path
1.4 +41 -26 cocoon-lenya/src/webapp/lenya/content/info/overview.xsp
Index: overview.xsp
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/info/overview.xsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- overview.xsp 2 Sep 2003 13:18:50 -0000 1.3
+++ overview.xsp 2 Sep 2003 15:25:48 -0000 1.4
@@ -14,38 +14,53 @@
>
<xsp:structure>
- <xsp:include>java.io.IOException</xsp:include>
<xsp:include>org.apache.cocoon.environment.Session</xsp:include>
<xsp:include>org.apache.lenya.cms.publication.Publication</xsp:include>
- <xsp:include>org.apache.lenya.xml.DocumentHelper</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.DocumentException</xsp:include>
</xsp:structure>
-
-<lenya-info:info>
- <lenya-info:overview>
- <dc:title><input:get-attribute module="page-envelope" as="object" name="document-dc-title"/></dc:title>
- <lenya-info:abstract><input:get-attribute module="page-envelope" as="object" name="document-dc-description"/></lenya-info:abstract>
- <dc:language><input:get-attribute module="page-envelope" as="object" name="document-language"/></dc:language>
+
+ <lenya-info:info>
+
<xsp:logic>
-
- String docId = (String)<input:get-attribute module="page-envelope" as="object" name="document-id"/>;
+ Document doc = (Document)<input:get-attribute module="page-envelope" as="object" name="document"/>;
+ String docId = doc.getId();
Session session = request.getSession(true);
session.setAttribute("org.apache.lenya.cms.info.target", docId);
session.setAttribute("org.apache.lenya.cms.info.area", request.getParameter("lenya.area"));
-
- String[] documentlanguages = (String[])<input:get-attribute module="page-envelope" as="object" name="document-languages"/>;
- StringBuffer str = new StringBuffer();
- for (int i = 0; i < documentlanguages.length; i++) {
- str.append(documentlanguages[i] +" ");
- }
- </xsp:logic>
-
- <lenya-info:languages><xsp:expr>str</xsp:expr></lenya-info:languages>
- <lenya-info:lastmodifiedby></lenya-info:lastmodifiedby>
- <lenya-info:lastmodified><input:get-attribute module="page-envelope" as="object" name="document-lastmodified"/></lenya-info:lastmodified>
- <lenya-info:documentid><input:get-attribute module="page-envelope" as="object" name="document-id"/></lenya-info:documentid>
- <lenya-info:area></lenya-info:area>
- <lenya-info:workflow-state><input:get-attribute module="workflow" as="string" name="state"/></lenya-info:workflow-state>
- </lenya-info:overview>
-</lenya-info:info>
+
+ StringBuffer documentLanguagesString = new StringBuffer();
+ boolean docExists = false;
+ try {
+ String[] documentLanguages = (String[])doc.getLanguages();
+ for (int i = 0; i < documentLanguages.length; i++) {
+ documentLanguagesString.append(documentLanguages[i] +" ");
+ }
+ docExists = doc.exists();
+ } catch (DocumentException e) {}
+ </xsp:logic>
+
+ <lenya-info:overview>
+
+ <xsp:logic>
+ if (docExists) {
+ <xsp:content>
+ <dc:title><input:get-attribute module="page-envelope" as="object" name="document-dc-title"/></dc:title>
+ <lenya-info:abstract><input:get-attribute module="page-envelope" as="object" name="document-dc-description"/></lenya-info:abstract>
+ </xsp:content>
+ }
+ </xsp:logic>
+ <lenya-info:status></lenya-info:status>
+ <dc:language><input:get-attribute module="page-envelope" as="object" name="document-language"/></dc:language>
+
+ <lenya-info:languages><xsp:expr>documentLanguagesString</xsp:expr></lenya-info:languages>
+ <lenya-info:lastmodifiedby></lenya-info:lastmodifiedby>
+ <lenya-info:lastmodified><input:get-attribute module="page-envelope" as="object" name="document-lastmodified"/></lenya-info:lastmodified>
+ <lenya-info:documentid><input:get-attribute module="page-envelope" as="object" name="document-id"/></lenya-info:documentid>
+ <lenya-info:area></lenya-info:area>
+ <lenya-info:workflow-state><input:get-attribute module="workflow" as="string" name="state"/></lenya-info:workflow-state>
+ </lenya-info:overview>
+ </lenya-info:info>
+
</xsp:page>
1.4 +27 -8 cocoon-lenya/src/webapp/lenya/content/info/meta.xsp
Index: meta.xsp
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/info/meta.xsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- meta.xsp 21 Aug 2003 14:24:58 -0000 1.3
+++ meta.xsp 2 Sep 2003 15:25:48 -0000 1.4
@@ -12,19 +12,38 @@
xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
xmlns:request="http://apache.org/xsp/request/2.0"
>
-
+
+ <xsp:structure>
+ <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
+ <xsp:include>org.apache.lenya.cms.publication.DocumentException</xsp:include>
+ </xsp:structure>
+
<lenya-info:info>
+ <xsp:logic>
+ Document doc = (Document)<input:get-attribute module="page-envelope" as="object" name="document"/>;
+ boolean docExists = false;
+ try {
+ docExists = doc.exists();
+ } catch (DocumentException e) {}
+ </xsp:logic>
+
<lenya-info:meta>
<lenya-info:documentid><input:get-attribute module="page-envelope" name="document-id"/></lenya-info:documentid>
<lenya-info:area><input:get-attribute module="page-envelope" name="area"/></lenya-info:area>
<dc:language><input:get-attribute module="page-envelope" name="document-language"/></dc:language>
- <dc:title><input:get-attribute module="page-envelope" name="document-dc-title"/></dc:title>
- <dc:creator><input:get-attribute module="page-envelope" name="document-dc-creator"/></dc:creator>
- <dc:subject><input:get-attribute module="page-envelope" name="document-dc-subject"/></dc:subject>
- <dc:description><input:get-attribute module="page-envelope" name="document-dc-description"/></dc:description>
- <dc:date><input:get-attribute module="page-envelope" name="document-dc-date-created"/></dc:date>
- <dc:publisher><input:get-attribute module="page-envelope" name="document-dc-publisher"/></dc:publisher>
- <dc:rights><input:get-attribute module="page-envelope" as="object" name="document-dc-rights"/></dc:rights>
+ <xsp:logic>
+ if (docExists) {
+ <xsp:content>
+ <dc:title><input:get-attribute module="page-envelope" name="document-dc-title"/></dc:title>
+ <dc:creator><input:get-attribute module="page-envelope" name="document-dc-creator"/></dc:creator>
+ <dc:subject><input:get-attribute module="page-envelope" name="document-dc-subject"/></dc:subject>
+ <dc:description><input:get-attribute module="page-envelope" name="document-dc-description"/></dc:description>
+ <dc:date><input:get-attribute module="page-envelope" name="document-dc-date-created"/></dc:date>
+ <dc:publisher><input:get-attribute module="page-envelope" name="document-dc-publisher"/></dc:publisher>
+ <dc:rights><input:get-attribute module="page-envelope" as="object" name="document-dc-rights"/></dc:rights>
+ </xsp:content>
+ }
+ </xsp:logic>
</lenya-info:meta>
</lenya-info:info>
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org