changeset 541:c4cc01b104d7

better metadata display for index page.
author casties
date Mon, 20 Aug 2012 20:13:56 +0200
parents 4b43a57ad9b3
children dbaa7dce60a5
files documentViewer.py zpt/viewer_index.zpt
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Thu Aug 16 19:09:49 2012 +0200
+++ b/documentViewer.py	Mon Aug 20 20:13:56 2012 +0200
@@ -18,6 +18,8 @@
 import string
 import json
 
+from Products.MetaDataProvider import MetaDataFolder
+
 from SrvTxtUtils import getInt, utf8ify, getText, getHttpData, refreshingImageFileIndexHtml
     
 def serializeNode(node, encoding="utf-8"):
@@ -553,7 +555,14 @@
             # bib info
             bib = self.metadataService.getBibData(dom=metaDom)
             if bib:
-                docinfo = self.getDocinfoFromBib(docinfo, bib)
+                # save extended version as 'bibx'
+                bibx = self.metadataService.getBibData(dom=metaDom, all=True, recursive=1)
+                if len(bibx) == 1:
+                    # unwrap list if possible
+                    bibx = bibx[0]
+                    
+                docinfo['bibx'] = bibx
+                docinfo = self.getDocinfoFromBib(docinfo, bib, bibx)
             else:
                 # no bib - try info.xml
                 docinfo = self.getDocinfoFromPresentationInfoXml(docinfo)
@@ -667,8 +676,8 @@
         # odd pages are left
         docinfo['oddPage'] = texttool.get('odd-scan-position', 'left')
             
-        # number of title page (0: not defined)
-        docinfo['titlePage'] = texttool.get('title-scan-no', 0)
+        # number of title page (default 1)
+        docinfo['titlePage'] = texttool.get('title-scan-no', 1)
             
         # old presentation stuff
         presentation = texttool.get('presentation', None)
@@ -680,7 +689,7 @@
         
         return docinfo
 
-    def getDocinfoFromBib(self, docinfo, bib):
+    def getDocinfoFromBib(self, docinfo, bib, bibx=None):
         """reads contents of bib element into docinfo"""
         logging.debug("getDocinfoFromBib bib=%s"%repr(bib))
         # put all raw bib fields in dict "bib"
--- a/zpt/viewer_index.zpt	Thu Aug 16 19:09:49 2012 +0200
+++ b/zpt/viewer_index.zpt	Mon Aug 20 20:13:56 2012 +0200
@@ -32,7 +32,7 @@
       <div class="index-info">
         <h2>Bibliographical information</h2>
         <table border="0"
-          tal:define="formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None))">
+          tal:define="formattedData python:here.metadata.getBibFormattedMetaDataExtended(bibdata=docinfo.get('bib', None),bibxdata=docinfo.get('bibx', None))">
           <tal:x condition="python:formattedData">
             <!-- wenn es bibinfo in docinfo gibt -->
             <tr tal:replace="structure python:formattedData" />
@@ -99,7 +99,7 @@
             </tr>
             <tr>
               <td class="type">License:</td>
-              <td class="content"><a href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a></td>
+              <td class="content"><a href="http://creativecommons.org/licenses/by-sa/3.0/de/">CC-BY-SA</a> (unless otherwise stated)</td>
             </tr>
           </table>
         </tal:block>