diff documentViewer.py @ 541:c4cc01b104d7

better metadata display for index page.
author casties
date Mon, 20 Aug 2012 20:13:56 +0200
parents dbf25bd05fc6
children 6cdc31e9ed8e
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"