You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ro...@apache.org on 2004/08/23 00:50:41 UTC

cvs commit: cocoon-lenya/src/webapp/lenya/content/info assets.xsp

roku        2004/08/22 15:50:41

  Modified:    src/webapp/lenya/xslt/info info.xsl
               src/webapp/lenya/content/info assets.xsp
  Log:
  Started using dc meta data in assets.xsp and info:assets.
  Its a bit hacky, but my approach to do it nice is out of scope
  of Lenya 1.2.1. So smack me if its too bad.
  The info:assets screen now also shows  the real dc:title.
  The bxe assets screens need to be fixed abit. I laready started but haven't tested yet.
  
  Revision  Changes    Path
  1.67      +4 -2      cocoon-lenya/src/webapp/lenya/xslt/info/info.xsl
  
  Index: info.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/xslt/info/info.xsl,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- info.xsl	21 May 2004 14:36:31 -0000	1.66
  +++ info.xsl	22 Aug 2004 22:50:41 -0000	1.67
  @@ -184,6 +184,7 @@
       <table class="lenya-table">
         <tr>
           <th><i18n:text>Assets</i18n:text></th>
  +        <th><i18n:text>Title</i18n:text></th>
           <th><i18n:text>File Size</i18n:text></th>
           <th><i18n:text>Creation Date</i18n:text></th>
           <th></th>
  @@ -191,6 +192,7 @@
         <xsl:for-each select="lenya-info:asset">
           <xsl:sort select="dc:title"/>
           <tr>
  +          <td><xsl:value-of select="dc:source"/></td>
             <td><xsl:value-of select="dc:title"/></td>
             <td align="right"><xsl:value-of select="dc:extent"/> kB</td>
             <td align="right"><xsl:value-of select="dc:date"/></td>
  @@ -206,7 +208,7 @@
                 </input>
                 <input type="hidden" name="properties.remove.asset.name">
                   <xsl:attribute name="value">
  -                  <xsl:value-of select="dc:title"/>
  +                  <xsl:value-of select="dc:source"/>
                   </xsl:attribute>
                 </input>
                 <xsl:choose>
  
  
  
  1.9       +18 -4     cocoon-lenya/src/webapp/lenya/content/info/assets.xsp
  
  Index: assets.xsp
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/info/assets.xsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- assets.xsp	13 Mar 2004 12:31:30 -0000	1.8
  +++ assets.xsp	22 Aug 2004 22:50:41 -0000	1.9
  @@ -34,6 +34,7 @@
       <xsp:include>org.apache.lenya.cms.publication.ResourcesManager</xsp:include>
       <xsp:include>java.util.Date</xsp:include>
       <xsp:include>java.text.SimpleDateFormat</xsp:include>
  +    <xsp:include>org.apache.lenya.xml.DocumentHelper</xsp:include>
     </xsp:structure>
     
     <lenya-info:info>
  @@ -50,10 +51,23 @@
         <lenya-info:language><input:get-attribute module="page-envelope" name="document-language"/></lenya-info:language>
         <xsp:logic>
   	if (resources != null) {
  -	  for(int i = 0; i &lt; resources.length; i++) {
  +	  for(int i = 0; i &lt; resources.length; i++) {    
  +      <!-- The follwoing code should be moved into a more generic dc class library
  +           i.e. to o.a.l.xml.dc or o.a.l.dc
  +           We also should consolidate the *.publication.DublinCore  * classes to use the newer lib.
  +           But this would be to heavy for 1.2.1, so I do this hack here, sorry :) /roku
  +      -->
  +      File metaFile;
  +      String title;
  +      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();
  +      } catch(Exception e) { continue; } 
   	  <xsp:content>
  -	    <lenya-info:asset>
  -	      <dc:title><xsp:expr>resources[i].getName()</xsp:expr></dc:title>
  +	    <lenya-info:asset>   
  +	      <dc:source><xsp:expr>resources[i].getName()</xsp:expr></dc:source>
  +        <dc:title><xsp:expr>title</xsp:expr></dc:title>
   	      <dc:date><xsp:expr>SimpleDateFormat.getDateInstance().format(new Date(resources[i].lastModified()))</xsp:expr></dc:date>
   	      <dc:extent><xsp:expr>resources[i].length()/1024</xsp:expr></dc:extent>
   	    </lenya-info:asset>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org