changeset 51:c5d3aabbf61b

textviewer now integrated, new modus auto introduced as standard for viewing
author dwinter
date Thu, 11 Jan 2007 21:27:17 +0100
parents 6c0f20cecc60
children 92047eaa6272
files documentViewer.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Thu Jan 11 13:03:17 2007 +0100
+++ b/documentViewer.py	Thu Jan 11 21:27:17 2007 +0100
@@ -100,10 +100,10 @@
 
 
     security.declareProtected('View','index_html')
-    def index_html(self,mode,url,viewMode="images",start=None,pn=1):
+    def index_html(self,mode,url,viewMode="auto",start=None,pn=1):
         '''
         view it
-        @param mode: defines which type of document is behind url
+        @param mode: defines which type of document is behind url (text,images or auto)
         @param url: url which contains display information
         @param viewMode: if images display images, if text display text, default is images
         
@@ -121,6 +121,13 @@
         docinfo = self.getDocinfo(mode=mode,url=url)
         pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo)
         pt = getattr(self.template, 'viewer_main')
+        
+        if viewMode=="auto": # automodus gewaehlt
+            if docinfo.get("textURL",'') and self.textViewerUrl: #texturl gesetzt und textViewer konfiguriert
+                viewMode="text"
+            else:
+                viewMode="images"
+                
         return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode)
   
   
@@ -418,8 +425,7 @@
         """returns docinfo depending on mode"""
         zLOG.LOG("documentViewer (getdocinfo)", zLOG.INFO,"mode: %s, url: %s"%(mode,url))
         # look for cached docinfo in session
-        # XXXX Sesion abgeschaltet
-        if self.REQUEST.SESSION.has_key('docinfo_XX'):
+        if self.REQUEST.SESSION.has_key('docinfo'):
             docinfo = self.REQUEST.SESSION['docinfo']
             # check if its still current
             if docinfo is not None and docinfo.get('mode') == mode and docinfo.get('url') == url: