# HG changeset patch # User casties # Date 1178284622 -7200 # Node ID 7cdb0fc34a927e9c8ae78fe6eb93a1779543f8f9 # Parent 0bc0d56cae7dff892c698b36f6bf39992f679e56 added getInfo_xml method diff -r 0bc0d56cae7d -r 7cdb0fc34a92 documentViewer.py --- 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"""