Diff for /documentViewer/MpdlXmlTextServer.py between versions 1.24 and 1.28

version 1.24, 2010/08/24 13:15:59 version 1.28, 2010/09/21 10:21:33
Line 130  class MpdlXmlTextServer(SimpleItem): Line 130  class MpdlXmlTextServer(SimpleItem):
         docinfo['numPages'] = text.count("<pb ")          docinfo['numPages'] = text.count("<pb ")
         return docinfo          return docinfo
                 
     def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=None):      def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=""):
         """returns single page from fulltext"""          """returns single page from fulltext"""
         docpath = docinfo['textURLPath']          docpath = docinfo['textURLPath']
         path = docinfo['textURLPath']          path = docinfo['textURLPath']
Line 145  class MpdlXmlTextServer(SimpleItem): Line 145  class MpdlXmlTextServer(SimpleItem):
         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&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)
         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&tocPN=%s&pn=%s&characterNormalization=%s#note-"%(url,viewMode,tocMode,tocPN,pn,characterNormalization))                              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)
         if mode == "xml":          if mode == "xml":
               # first div contains text                # first div contains text
Line 178  class MpdlXmlTextServer(SimpleItem): Line 178  class MpdlXmlTextServer(SimpleItem):
               pagedivs = pagedom.xpath("/div")                pagedivs = pagedom.xpath("/div")
               if len(pagedivs) > 0:                if len(pagedivs) > 0:
                   pagenode = pagedivs[0]                    pagenode = pagedivs[0]
                     links =pagenode.xpath("//a")
                     for l in links:
                         hrefNode =l.getAttributeNodeNS(None, u"href")
                         if hrefNode:
                             href=hrefNode.nodeValue
                             if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'):
                                 hrefNode.nodeValue =href.replace('chinagis_REST','chinagis')
                   return serializeNode(pagenode)                    return serializeNode(pagenode)
                                           
         if mode == "pureXml":          if mode == "pureXml":
Line 237  class MpdlXmlTextServer(SimpleItem): Line 244  class MpdlXmlTextServer(SimpleItem):
         #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query)))          #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query)))
         return data          return data
   
       def getGis (self, mode="gis", pn=1, pageinfo=None, docinfo=None):
           docpath = docinfo['textURLPath']
           path = docinfo['textURLPath']       
           pagesize = pageinfo['tocPageSize']
           pn = pageinfo['tocPN']
           url = docinfo['url']
           selfurl = self.absolute_url()  
           viewMode=  pageinfo['viewMode']
           tocMode = pageinfo['tocMode']
           tocPN = pageinfo['tocPN']  
           data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))
           page =data.replace("http://chinagis.mpiwg-berlin.mpg.de/chinagis_REST/REST/","http://chinagis.mpiwg-berlin.mpg.de/chinagis/REST/")      
           return page
       
     def getQuery (self,  docinfo=None, pageinfo=None, query=None, queryType=None, pn=1):      def getQuery (self,  docinfo=None, pageinfo=None, query=None, queryType=None, pn=1):
          """number of"""           """number of"""
          docpath = docinfo['textURLPath']            docpath = docinfo['textURLPath'] 

Removed from v.1.24  
changed lines
  Added in v.1.28


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