You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ja...@apache.org on 2006/03/13 12:01:49 UTC
svn commit: r385507 -
/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp
Author: jann
Date: Mon Mar 13 03:01:47 2006
New Revision: 385507
URL: http://svn.apache.org/viewcvs?rev=385507&view=rev
Log:
Reading image height and width from the metadata in order to show them in the asset tab of the site area
Modified:
lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp
Modified: lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp
URL: http://svn.apache.org/viewcvs/lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp?rev=385507&r1=385506&r2=385507&view=diff
==============================================================================
--- lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp (original)
+++ lenya/branches/BRANCH_1_2_X/src/webapp/lenya/content/info/assets.xsp Mon Mar 13 03:01:47 2006
@@ -21,6 +21,7 @@
language="java"
xmlns:xsp="http://apache.org/xsp"
xmlns:lenya-info="http://apache.org/cocoon/lenya/info/1.0"
+ xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
xmlns:li="http://apache.org/cocoon/lenya/info/1.0"
xmlns:wf="http://apache.org/cocoon/lenya/workflow/1.0"
xmlns:rc="http://apache.org/cocoon/lenya/rc/1.0"
@@ -35,6 +36,7 @@
<xsp:include>java.util.Date</xsp:include>
<xsp:include>java.text.SimpleDateFormat</xsp:include>
<xsp:include>org.apache.lenya.xml.DocumentHelper</xsp:include>
+ <xsp:include>org.w3c.dom.NodeList</xsp:include>
</xsp:structure>
<lenya-info:info>
@@ -68,11 +70,24 @@
File metaFile;
String title = "";
String format = "";
+ String height = null;
+ String width = null;
+
org.w3c.dom.Document metaDoc;
try {
metaDoc = DocumentHelper.readDocument(resourceMgr.getMetaFile(resources[i]));
- title = metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "title").item(0).getChildNodes().item(0).getNodeValue();
- format = metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "format").item(0).getChildNodes().item(0).getNodeValue();
+ title = metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "title").item(0).getChildNodes().item(0).getNodeValue();
+ format = metaDoc.getElementsByTagNameNS("http://purl.org/dc/elements/1.1/", "format").item(0).getChildNodes().item(0).getNodeValue();
+
+ NodeList nodes = metaDoc.getElementsByTagNameNS("http://apache.org/cocoon/lenya/page-envelope/1.0","height");
+ if (nodes.item(0) != null) {
+ height = nodes.item(0).getChildNodes().item(0).getNodeValue();;
+ }
+ nodes = metaDoc.getElementsByTagNameNS("http://apache.org/cocoon/lenya/page-envelope/1.0","width");
+ if (nodes.item(0) != null) {
+ width = nodes.item(0).getChildNodes().item(0).getNodeValue();;
+ }
+
} catch(Exception e) { continue; }
<xsp:content>
@@ -82,6 +97,12 @@
<dc:date><xsp:expr>SimpleDateFormat.getDateInstance().format(new Date(resources[i].lastModified()))</xsp:expr></dc:date>
<dc:format><xsp:expr>format</xsp:expr></dc:format>
<dc:extent><xsp:expr>resources[i].length()/1024</xsp:expr></dc:extent>
+ <xsp:logic>
+ if ((width != null) && (height != null)) {
+ <lenya:imagewidth><xsp:expr>width</xsp:expr></lenya:imagewidth>
+ <lenya:imageheight><xsp:expr>height</xsp:expr></lenya:imageheight>
+ }
+ </xsp:logic>
</lenya-info:asset>
</xsp:content>
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org