Diff for /documentViewer/MpdlXmlTextServer.py between versions 1.85 and 1.185

version 1.85, 2010/10/11 15:54:24 version 1.185, 2010/10/18 12:39:14
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) url: %s"%(url))  
         pagesize = pageinfo['queryPageSize']          pagesize = pageinfo['queryPageSize']
         pn = pageinfo['searchPN']          pn = pageinfo['searchPN']
         sn = pageinfo['sn']          sn = pageinfo['sn']
Line 56  class MpdlXmlTextServer(SimpleItem): Line 54  class MpdlXmlTextServer(SimpleItem):
         tocPN = pageinfo['tocPN']          tocPN = pageinfo['tocPN']
         selfurl = self.absolute_url()          selfurl = self.absolute_url()
                   
         data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, sn, viewMode,urllib.quote(highlightQuery)))          data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&characterNormalization=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, sn, viewMode,characterNormalization ,urllib.quote(highlightQuery)))
         #page=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&highlightQuery=%s"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode,highlightQuery) ,outputUnicode=False)                          #page=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&highlightQuery=%s"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode,highlightQuery) ,outputUnicode=False)                
                   
         pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)          pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)
Line 140  class MpdlXmlTextServer(SimpleItem): Line 138  class MpdlXmlTextServer(SimpleItem):
         docinfo['numPages']=int(getTextFromNode(result[0]))          docinfo['numPages']=int(getTextFromNode(result[0]))
         return docinfo          return docinfo
           
     def getGisPlases(self, docinfo):      def getGisPlaces(self, docinfo=None, pageinfo=None):
         """ Show all Gis Places of whole Page"""          """ Show all Gis Places of whole Page"""
         xpath='//place'          xpath='//place'
           docpath = docinfo['textURLPath'] 
           url = docinfo['url']
           selfurl = self.absolute_url()
           pn = pageinfo['current']
           hrefList=[]
           myList= ""
         text=self.getServerData("xpath.xql", "document=%s&xpath=%s&pn=%s"%(docinfo['textURLPath'], xpath,pn))          text=self.getServerData("xpath.xql", "document=%s&xpath=%s&pn=%s"%(docinfo['textURLPath'], xpath,pn))
         pagedom = Parse(text)          dom = Parse(text)
         result =pagedom.xpath("//result/resultPage")          result = dom.xpath("//result/resultPage/place")
         for l in result:          for l in result:
             hrefNode= l.getAttributeNodeNS(None, u"place")              hrefNode= l.getAttributeNodeNS(None, u"id")
             logging.debug("documentViewer (characterNormalization) l:%s"%(l))              href= hrefNode.nodeValue
             if hrefNode:              hrefList.append(href)
               myList = ",".join(hrefList)
           logging.debug("getGisPlaces :%s"%(myList))                             
           return myList
       
       def getAllGisPlaces (self, docinfo=None, pageinfo=None):
           """Show all Gis Places of whole Book """
           xpath ='//echo:place'
           docpath =docinfo['textURLPath']
           url = docinfo['url']
           selfurl =self.absolute_url()
           pn =pageinfo['current']
           hrefList=[]
           myList=""
           text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'],xpath))
           dom =Parse(text)
           result = dom.xpath("//result/resultPage/place")
           for l in result:
               hrefNode = l.getAttributeNodeNS(None, u"id")
                 href= hrefNode.nodeValue                  href= hrefNode.nodeValue
                 if href.startswith('id='):              hrefList.append(href)
                     hrefNode.nodeValue = href.replace('id=',"?")              myList = ",".join(hrefList)
               logging.debug("getALLGisPlaces :%s"%(myList))
           return myList
       
       def getOrigPages (self, docinfo=None, pageinfo=None):
           """Show original page """
           docpath = docinfo['textURLPath'] 
           #url = docinfo['url']
           selfurl = self.absolute_url()
           pn =pageinfo['current']
          
           viewMode=  pageinfo['viewMode']
           text = self.getServerData("page-fragment.xql","document=%s&mode=%s&pn=%s"%(docinfo['textURLPath'], 'text',  pn))
           dom =Parse(text)
           pagedivs = dom.xpath("//div[@class='pageNumberOrig']")
           logging.debug("YYYYYYpagedivs :%s"%(pagedivs))
           if len(pagedivs)>0:
               originalPage= getTextFromNode(pagedivs[0])
               #return docinfo['originalPage']
               return originalPage
                                                                   
         return serializeNode(pagenode)  
           
     def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=""):      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"""

Removed from v.1.85  
changed lines
  Added in v.1.185


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