changeset 57:7cdb0fc34a92

added getInfo_xml method
author casties
date Fri, 04 May 2007 15:17:02 +0200
parents 0bc0d56cae7d
children cc1d3d22ca72
files documentViewer.py
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Thu May 03 19:50:58 2007 +0200
+++ b/documentViewer.py	Fri May 04 15:17:02 2007 +0200
@@ -80,6 +80,7 @@
     image_main = PageTemplateFile('zpt/image_main', globals())
     head_main = PageTemplateFile('zpt/head_main', globals())
     docuviewer_css = PageTemplateFile('css/docuviewer.css', globals())
+    info_xml = PageTemplateFile('zpt/info_xml', globals())
 
     security.declareProtected('View management screens','changeDocumentViewerForm')    
     changeDocumentViewerForm = PageTemplateFile('zpt/changeDocumentViewer', globals())
@@ -108,9 +109,9 @@
     def index_html(self,mode,url,viewMode="auto",start=None,pn=1):
         '''
         view it
-        @param mode: defines which type of document is behind url (text,images or auto)
+        @param mode: defines how to access the document behind url 
         @param url: url which contains display information
-        @param viewMode: if images display images, if text display text, default is images
+        @param viewMode: if images display images, if text display text, default is images (text,images or auto)
         
         '''
         
@@ -133,7 +134,6 @@
             else:
                 viewMode="images"
                
-
         return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode)
   
   
@@ -152,6 +152,17 @@
         url=self.REQUEST['URL1']+"?"+ps
         return url
 
+
+    def getInfo_xml(self,url,mode):
+        """returns info about the document as XML"""
+
+        if not self.digilibBaseUrl:
+            self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary"
+        
+        docinfo = self.getDocinfo(mode=mode,url=url)
+        pt = getattr(self.template, 'info_xml')
+        return pt(docinfo=docinfo)
+
     
     def getStyle(self, idx, selected, style=""):
         """returns a string with the given style and append 'sel' if path == selected."""
@@ -160,7 +171,7 @@
             return style + 'sel'
         else:
             return style
-        
+
         
     def isAccessible(self, docinfo):
         """returns if access to the resource is granted"""