--- documentViewer/documentViewer.py 2007/01/11 12:03:17 1.20 +++ documentViewer/documentViewer.py 2007/01/11 20:27:17 1.21 @@ -100,10 +100,10 @@ class documentViewer(Folder): 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 @@ class documentViewer(Folder): 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 @@ class documentViewer(Folder): """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: