Mercurial > hg > documentViewer
comparison documentViewer.py @ 334:a8fb29c62b47
*** empty log message ***
author | abukhman |
---|---|
date | Mon, 18 Oct 2010 11:54:40 +0200 |
parents | 119d415a0ce3 |
children | ac8375a9147e |
comparison
equal
deleted
inserted
replaced
333:119d415a0ce3 | 334:a8fb29c62b47 |
---|---|
241 | 241 |
242 if not self.digilibBaseUrl: | 242 if not self.digilibBaseUrl: |
243 self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary" | 243 self.digilibBaseUrl = self.findDigilibUrl() or "http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary" |
244 | 244 |
245 docinfo = self.getDocinfo(mode=mode,url=url) | 245 docinfo = self.getDocinfo(mode=mode,url=url) |
246 #pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo) | 246 pageinfo = self.getPageinfo(start=start,current=pn,docinfo=docinfo) |
247 pageinfo = self.getPageinfo(start=start,current=pn, originalPage=originalPage, docinfo=docinfo) | 247 #pageinfo = self.getPageinfo(start=start,current=pn, originalPage=originalPage, docinfo=docinfo) |
248 ''' ZDES ''' | 248 ''' ZDES ''' |
249 pt = getattr(self.template, 'thumbs_main_rss') | 249 pt = getattr(self.template, 'thumbs_main_rss') |
250 | 250 |
251 if viewMode=="auto": # automodus gewaehlt | 251 if viewMode=="auto": # automodus gewaehlt |
252 if docinfo.has_key("textURL") or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert | 252 if docinfo.has_key("textURL") or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert |
255 viewMode="images" | 255 viewMode="images" |
256 | 256 |
257 return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode) | 257 return pt(docinfo=docinfo,pageinfo=pageinfo,viewMode=viewMode) |
258 | 258 |
259 security.declareProtected('View','index_html') | 259 security.declareProtected('View','index_html') |
260 def index_html(self,url,mode="texttool",viewMode="auto",tocMode="thumbs",start=None,pn=1,mk=None, query=None, querySearch=None, characterNormalization="", originalPage=None): | 260 def index_html(self,url,mode="texttool",viewMode="auto",tocMode="thumbs",start=None,pn=1,mk=None, query=None, querySearch=None, characterNormalization=""): |
261 ''' | 261 ''' |
262 view it | 262 view it |
263 @param mode: defines how to access the document behind url | 263 @param mode: defines how to access the document behind url |
264 @param url: url which contains display information | 264 @param url: url which contains display information |
265 @param viewMode: if images display images, if text display text, default is auto (text,images or auto) | 265 @param viewMode: if images display images, if text display text, default is auto (text,images or auto) |
660 docinfo = self.getNumTextPages(docinfo) | 660 docinfo = self.getNumTextPages(docinfo) |
661 | 661 |
662 presentationUrls = dom.xpath("//texttool/presentation") | 662 presentationUrls = dom.xpath("//texttool/presentation") |
663 docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag | 663 docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag |
664 docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom) | 664 docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom) |
665 docinfo =self.getOrigPages(docinfo=None, pageinfo=None) | |
665 | 666 |
666 if presentationUrls and (len(presentationUrls) > 0): # ueberschreibe diese durch presentation informationen | 667 if presentationUrls and (len(presentationUrls) > 0): # ueberschreibe diese durch presentation informationen |
667 # presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten | 668 # presentation url ergiebt sich ersetzen von index.meta in der url der fuer die Metadaten |
668 # durch den relativen Pfad auf die presentation infos | 669 # durch den relativen Pfad auf die presentation infos |
669 presentationPath = getTextFromNode(presentationUrls[0]) | 670 presentationPath = getTextFromNode(presentationUrls[0]) |
743 | 744 |
744 logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) | 745 logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) |
745 self.REQUEST.SESSION['docinfo'] = docinfo | 746 self.REQUEST.SESSION['docinfo'] = docinfo |
746 return docinfo | 747 return docinfo |
747 | 748 |
748 def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, tocMode=None,characterNormalization="",originalPage=originalPage): | 749 def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, tocMode=None,characterNormalization=""): |
749 """returns pageinfo with the given parameters""" | 750 """returns pageinfo with the given parameters""" |
750 pageinfo = {} | 751 pageinfo = {} |
751 current = getInt(current) | 752 current = getInt(current) |
752 pageinfo ['originalPage'] = originalPage | 753 #pageinfo ['originalPage'] = originalPage |
753 pageinfo['current'] = current | 754 pageinfo['current'] = current |
754 rows = int(rows or self.thumbrows) | 755 rows = int(rows or self.thumbrows) |
755 pageinfo['rows'] = rows | 756 pageinfo['rows'] = rows |
756 cols = int(cols or self.thumbcols) | 757 cols = int(cols or self.thumbcols) |
757 pageinfo['cols'] = cols | 758 pageinfo['cols'] = cols |