Changeset 548:7acc919f52ff in documentViewer


Ignore:
Timestamp:
Aug 31, 2012, 1:55:45 PM (12 years ago)
Author:
casties
Branch:
default
Message:

mode=filepath works again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r546 r548  
    222222        return self.template.fulltextclient.getPlacesOnPage(**args)
    223223 
    224     #WTF?
     224    # Thumb list for CoolIris Plugin
    225225    thumbs_main_rss = PageTemplateFile('zpt/thumbs_main_rss', globals())
    226226    security.declareProtected('View','thumbs_rss')
     
    233233       
    234234        '''
    235         logging.debug("HHHHHHHHHHHHHH:load the rss")
    236         logging.debug("documentViewer (index) mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))
    237235       
    238236        if not hasattr(self, 'template'):
     
    259257 
    260258    security.declareProtected('View','index_html')
    261     def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode="thumbs",start=1,pn=1):
     259    def index_html(self,url,mode="texttool",viewMode="auto",viewLayer=None,tocMode=None,start=1,pn=1):
    262260        """
    263261        show page
     
    278276        if not getattr(self, 'digilibBaseUrl', None):
    279277            self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary"
     278           
     279        # mode=filepath should not have toc-thumbs
     280        if tocMode is None:
     281            if mode == "filepath":
     282                tocMode = "none"
     283            else:
     284                tocMode = "thumbs"
    280285           
    281286        # docinfo: information about document (cached)
     
    303308        # safe viewLayer in userinfo
    304309        userinfo['viewLayer'] = viewLayer
    305        
     310               
    306311        # pageinfo: information about page (not cached)
    307312        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, userinfo=userinfo, viewMode=viewMode, viewLayer=viewLayer, tocMode=tocMode)
     
    540545        elif mode=="filepath":
    541546            # url points to image file, index.meta optional
     547            docinfo['imagePath'] = url
     548            docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + url
     549            docinfo['numPages'] = 1
    542550            # asssume index.meta is two path segments up
    543551            docUrl = getParentPath(url, 2)
     
    567575            bib = self.metadataService.getBibData(dom=metaDom)
    568576            if bib:
    569                 # save extended version as 'bibx'
     577                # save extended version as 'bibx' TODO: ugly
    570578                bibx = self.metadataService.getBibData(dom=metaDom, all=True, recursive=1)
    571579                if len(bibx) == 1:
     
    607615            docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1)
    608616
    609         # number of images from digilib
    610         if docinfo.get('imagePath', None):
    611             docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath']
    612             docinfo = self.getDocinfoFromDigilib(docinfo, docinfo['imagePath'])
    613         else:
    614             # imagePath still missing? try "./pageimg"
    615             imgPath = os.path.join(docUrl, 'pageimg')
    616             docinfo = self.getDocinfoFromDigilib(docinfo, imgPath)
    617             if docinfo.get('numPages', 0) > 0:
    618                 # there are pages
    619                 docinfo['imagePath'] = imgPath
     617        # check numPages
     618        if docinfo.get('numPages', 0) == 0:
     619            # number of images from digilib
     620            if docinfo.get('imagePath', None):
    620621                docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath']
     622                docinfo = self.getDocinfoFromDigilib(docinfo, docinfo['imagePath'])
     623            else:
     624                # imagePath still missing? try "./pageimg"
     625                imgPath = os.path.join(docUrl, 'pageimg')
     626                docinfo = self.getDocinfoFromDigilib(docinfo, imgPath)
     627                if docinfo.get('numPages', 0) > 0:
     628                    # there are pages
     629                    docinfo['imagePath'] = imgPath
     630                    docinfo['imageURL'] = self.digilibBaseUrl + "/servlet/Scaler?fn=" + docinfo['imagePath']
    621631
    622632        # check numPages
Note: See TracChangeset for help on using the changeset viewer.