Diff for /documentViewer/MpdlXmlTextServer.py between versions 1.18 and 1.22

version 1.18, 2010/08/24 10:17:06 version 1.22, 2010/08/24 12:34:32
Line 42  class MpdlXmlTextServer(SimpleItem): Line 42  class MpdlXmlTextServer(SimpleItem):
         """get search list"""          """get search list"""
         docpath = docinfo['textURLPath']           docpath = docinfo['textURLPath'] 
         url = docinfo['url']          url = docinfo['url']
         logging.debug("documentViewer (gettoc) docpath: %s"%(docpath))          #logging.debug("documentViewer (gettoc) docpath: %s"%(docpath))
         logging.debug("documentViewer (gettoc) url: %s"%(url))          #logging.debug("documentViewer (gettoc) url: %s"%(url))
         pagesize = pageinfo['queryPageSize']          pagesize = pageinfo['queryPageSize']
         pn = pageinfo['searchPN']          pn = pageinfo['searchPN']
         sn = pageinfo['sn']          sn = pageinfo['sn']
Line 144  class MpdlXmlTextServer(SimpleItem): Line 144  class MpdlXmlTextServer(SimpleItem):
             textmode = "textPollux"              textmode = "textPollux"
         else:          else:
             textmode = mode              textmode = mode
         logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))          #logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))
         textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn)          textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn)
         if highlightQuery is not None:          if highlightQuery is not None:
             textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn)                         textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn)           
Line 165  class MpdlXmlTextServer(SimpleItem): Line 165  class MpdlXmlTextServer(SimpleItem):
                     if hrefNode:                      if hrefNode:
                         href= hrefNode.nodeValue                          href= hrefNode.nodeValue
                         if href.startswith('#note-'):                          if href.startswith('#note-'):
                             hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&characterNormalization=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,characterNormalization,tocPN,pn))                              hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s&characterNormalization=%s#note-"%(url,viewMode,tocMode,tocPN,pn,characterNormalization))
                 return serializeNode(pagenode)                  return serializeNode(pagenode)
         if mode == "xml":          if mode == "xml":
               # first div contains text                # first div contains text
Line 215  class MpdlXmlTextServer(SimpleItem): Line 215  class MpdlXmlTextServer(SimpleItem):
                             l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")                              l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")
                             l.setAttributeNS(None, 'onClick', 'popupWin.focus();')                                 l.setAttributeNS(None, 'onClick', 'popupWin.focus();')   
                         if href.startswith('#note-'):                          if href.startswith('#note-'):
                             hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&characterNormalization=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,characterNormalization,tocPN,pn))                                  hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))    
                 return serializeNode(pagenode)                  return serializeNode(pagenode)
         return "no text here"          return "no text here"
   
Line 253  class MpdlXmlTextServer(SimpleItem): Line 253  class MpdlXmlTextServer(SimpleItem):
          numdivs = pagedom.xpath("//div[@class='queryResultHits']")           numdivs = pagedom.xpath("//div[@class='queryResultHits']")
          tocSearch = int(getTextFromNode(numdivs[0]))           tocSearch = int(getTextFromNode(numdivs[0]))
          tc=int((tocSearch/10)+1)           tc=int((tocSearch/10)+1)
          logging.debug("documentViewer (gettoc) tc: %s"%(tc))           #logging.debug("documentViewer (gettoc) tc: %s"%(tc))
          return tc           return tc
   
     def getToc(self, mode="text", docinfo=None):      def getToc(self, mode="text", docinfo=None):
         """loads table of contents and stores in docinfo"""          """loads table of contents and stores in docinfo"""
         logging.debug("documentViewer (gettoc) mode: %s"%(mode))          #logging.debug("documentViewer (gettoc) mode: %s"%(mode))
         if mode == "none":          if mode == "none":
             return docinfo                      return docinfo        
         if 'tocSize_%s'%mode in docinfo:          if 'tocSize_%s'%mode in docinfo:
Line 307  class MpdlXmlTextServer(SimpleItem): Line 307  class MpdlXmlTextServer(SimpleItem):
         tocPN = pageinfo['tocPN']            tocPN = pageinfo['tocPN']  
                   
         data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))            data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))  
   
         page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&characterNormalization=%s'%(selfurl,url, viewMode, tocMode, tocPN, characterNormalization))          page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&characterNormalization=%s'%(selfurl,url, viewMode, tocMode, tocPN, characterNormalization))
         text = page.replace('mode=image','mode=texttool')          text = page.replace('mode=image','mode=texttool')
         logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))          logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))
         logging.debug("documentViewer (characterNormalization) text: %s"%(text))          #logging.debug("documentViewer (characterNormalization) text: %s"%(text))
         return text          return text
           
     def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):      def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):

Removed from v.1.18  
changed lines
  Added in v.1.22


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>