Changeset 518:91051b36b9cc in documentViewer for documentViewer.py


Ignore:
Timestamp:
Mar 12, 2012, 6:01:14 PM (12 years ago)
Author:
casties
Branch:
default
Message:

uses xml info from doc-info.xql for table of contents now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r516 r518  
    257257            self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary"
    258258           
    259         docinfo = self.getDocinfo(mode=mode,url=url)
    260        
    261         if tocMode != "thumbs":
    262             # get table of contents
    263             self.getToc(mode=tocMode, docinfo=docinfo)
    264 
     259        docinfo = self.getDocinfo(mode=mode,url=url,tocMode=tocMode)
     260       
    265261        # auto viewMode: text if there is a text else images
    266262        if viewMode=="auto":
     
    430426
    431427
    432     def getDocinfo(self, mode, url):
     428    def getDocinfo(self, mode, url, tocMode=None):
    433429        """returns docinfo depending on mode"""
    434430        logging.debug("getDocinfo: mode=%s, url=%s"%(mode,url))
     
    484480            if texttool:
    485481                docinfo = self.getDocinfoFromTexttool(docinfo, texttool)
    486                 # document info from full text
     482                # document info (including toc) from full text
    487483                if docinfo.get('textURLPath', None):
    488                     docinfo = self.getTextInfo(docinfo=docinfo)
     484                    docinfo = self.getTextInfo(mode=tocMode, docinfo=docinfo)
    489485           
    490486            # bib info
     
    730726        np = int(docinfo.get('numPages', 0))
    731727        if np == 0:
    732             # numPages unknown - maybe we can get it from text page
    733             logging.warn("getPageInfo: numPages=0 trying getTextPage!")
    734             if docinfo.get('textURLPath', None):
    735                 # cache text page as well
    736                 pageinfo['textPage'] = self.getTextPage(mode=viewLayer, pn=current, docinfo=docinfo, pageinfo=pageinfo)
    737                 np = int(docinfo.get('numPages', 0))
    738                
     728            # try numTextPages
     729            np = docinfo.get('numTextPages', 0)
     730            if np != 0:
     731                docinfo['numPages'] = np
     732
    739733        # cache table of contents
    740734        pageinfo['tocPageSize'] = getInt(self.REQUEST.get('tocPageSize', 30))
Note: See TracChangeset for help on using the changeset viewer.