Changeset 471:415a7026eeda in documentViewer


Ignore:
Timestamp:
Aug 4, 2011, 2:57:02 PM (13 years ago)
Author:
casties
Branch:
elementtree
Message:

split viewMode in viewMode and viewType

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MpdlXmlTextServer.py

    r469 r471  
    1 
    21from OFS.SimpleItem import SimpleItem
    32from Products.PageTemplates.PageTemplateFile import PageTemplateFile
     
    270269         
    271270           
    272     def getTextPage(self, mode="text_dict", pn=1, docinfo=None, pageinfo=None):
     271    def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None):
    273272        """returns single page from fulltext"""
    274273        logging.debug("getTextPage mode=%s, pn=%s"%(mode,pn))
     
    293292        selfurl = docinfo['viewerUrl']   
    294293       
    295         if mode == "text_dict":
     294        if mode == "dict":
    296295            # text_dict is called textPollux in the backend
    297296            textmode = "textPollux"
     297        elif not mode:
     298            # default is text
     299            textmode = "text"
    298300        else:
    299301            textmode = mode
  • documentViewer.py

    r469 r471  
    267267 
    268268    security.declareProtected('View','index_html')
    269     def index_html(self,url,mode="texttool",viewMode="auto",tocMode="thumbs",start=None,pn=1,mk=None):
     269    def index_html(self,url,mode="texttool",viewMode="auto",viewTYpe=None,tocMode="thumbs"):
    270270        """
    271         view it
     271        view page
     272        @param url: url which contains display information
    272273        @param mode: defines how to access the document behind url
    273         @param url: url which contains display information
    274         @param viewMode: if images display images, if text display text, default is auto (text,images or auto)
     274        @param viewMode: 'images': display images, 'text': display text, default is 'auto'
     275        @param viewType: sub-type of viewMode, e.g. 'dict' for viewMode='text'
    275276        @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)
    276277        """
     
    292293            docinfo = self.getToc(mode=tocMode, docinfo=docinfo)
    293294
    294         # auto viewMode: text_dict if text else images
     295        # auto viewMode: text if there is a text else images
    295296        if viewMode=="auto":
    296297            if docinfo.get('textURL', None) or docinfo.get('textURLPath', None):
    297                 viewMode="text_dict"
     298                viewMode = "text"
     299                viewType = "dict"
    298300            else:
    299                 viewMode="images"
     301                viewMode = "images"
    300302               
    301         pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, tocMode=tocMode)
     303        pageinfo = self.getPageinfo(start=start, current=pn, docinfo=docinfo, viewMode=viewMode, viweType=viewType, tocMode=tocMode)
    302304                   
    303305        # get template /template/viewer_main
    304306        pt = getattr(self.template, 'viewer_main')
    305307        # and execute with parameters
    306         return pt(docinfo=docinfo, pageinfo=pageinfo, viewMode=viewMode, mk=self.generateMarks(mk))
     308        return pt(docinfo=docinfo, pageinfo=pageinfo)
    307309 
    308310    def generateMarks(self,mk):
     
    665667   
    666668
    667     def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, tocMode=None):
     669    def getPageinfo(self, current, start=None, rows=None, cols=None, docinfo=None, viewMode=None, viewType=None, tocMode=None):
    668670        """returns pageinfo with the given parameters"""
    669671        pageinfo = {}
     672        pageinfo['viewMode'] = viewMode
     673        pageinfo['viewType'] = viewType
     674        pageinfo['tocMode'] = tocMode
     675
    670676        current = getInt(current)
    671677        pageinfo['current'] = current
     
    688694            if docinfo.get('textURLPath', None):
    689695                # cache text page as well
    690                 pageinfo['textPage'] = self.getTextPage(mode=viewMode, pn=pn, docinfo=docinfo, pageinfo=pageinfo)
     696                pageinfo['textPage'] = self.getTextPage(mode=viewType, pn=pn, docinfo=docinfo, pageinfo=pageinfo)
    691697                np = int(docinfo.get('numPages', 0))
    692698               
     
    696702            pageinfo['numgroups'] += 1
    697703               
    698         pageinfo['viewMode'] = viewMode
    699         pageinfo['tocMode'] = tocMode
    700704        pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg')
    701         #pageinfo['optionToggle'] = self.REQUEST.get('optionToggle','1')
    702705        pageinfo['query'] = self.REQUEST.get('query','')
    703706        pageinfo['queryType'] = self.REQUEST.get('queryType','')
     
    709712        # WTF?:
    710713        toc = int(pageinfo['tocPN'])
    711         pageinfo['textPages'] =int(toc)
     714        pageinfo['textPages'] = int(toc)
    712715       
    713716        # What does this do?
Note: See TracChangeset for help on using the changeset viewer.