changeset 436:0baf4e761be7

*** empty log message ***
author abukhman
date Mon, 07 Mar 2011 15:08:07 +0100
parents 94baa8dbc7e8
children da43c361c0ff
files MpdlXmlTextServer.py documentViewer.py
diffstat 2 files changed, 42 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MpdlXmlTextServer.py	Tue Mar 01 15:53:15 2011 +0100
+++ b/MpdlXmlTextServer.py	Mon Mar 07 15:08:07 2011 +0100
@@ -85,7 +85,7 @@
                             selfurl = self.absolute_url()            
                             pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s&optionToggle=%s&characterNormalization=%s'%(viewMode,queryType,urllib.quote(query),pagesize,pn,tocMode,pn,tocPN,optionToggle,characterNormalization))
                             hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)                                           
-                logging.debug("PUREXML :%s"%(serializeNode(pagenode)))
+                #logging.debug("PUREXML :%s"%(serializeNode(pagenode)))
                 return serializeNode(pagenode)        
         if (queryType=="fulltextMorph"):
             pagedivs = pagedom.xpath("//div[@class='queryResult']")
@@ -150,7 +150,7 @@
             href= hrefNode.nodeValue
             hrefList.append(href)
             myList = ",".join(hrefList)
-        logging.debug("getGisPlaces :%s"%(myList))                             
+        #logging.debug("getGisPlaces :%s"%(myList))                             
         return myList
     
     def getAllGisPlaces (self, docinfo=None, pageinfo=None):
@@ -171,7 +171,7 @@
             href= hrefNode.nodeValue
             hrefList.append(href)
             myList = ",".join(hrefList)
-            logging.debug("getALLGisPlaces :%s"%(myList))
+            #logging.debug("getALLGisPlaces :%s"%(myList))
         return myList
           
            
@@ -202,16 +202,18 @@
         dom = Parse(pagexml)
         #original Pages
         pagedivs = dom.xpath("//div[@class='pageNumberOrig']")
-        if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"):
+        """if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"):
             if len(pagedivs)>0:
                 docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0])
+                logging.debug("ORIGINAL PAGE: %s"%(docinfo['pageNumberOrig']))
         
         #original Pages Norm
         pagedivs = dom.xpath("//div[@class='pageNumberOrigNorm']")
         if pagedivs == dom.xpath("//div[@class='pageNumberOrigNorm']"):
             if len(pagedivs)>0:
                 docinfo['pageNumberOrigNorm']= getTextFromNode(pagedivs[0])
-        
+                logging.debug("ORIGINAL PAGE NORM: %s"%(docinfo['pageNumberOrigNorm']))
+        """
         #figureEntries
         pagedivs = dom.xpath("//div[@class='countFigureEntries']")
         if pagedivs == dom.xpath("//div[@class='countFigureEntries']"):
@@ -363,6 +365,31 @@
                 return serializeNode(pagenode)
         return "no text here"
     
+    def getOrigPages(self, docinfo=None, pageinfo=None):
+        docpath = docinfo['textURLPath']
+        pn =pageinfo['current']
+        selfurl = self.absolute_url()   
+        pagexml = self.getServerData("page-fragment.xql","document=%s&pn=%s"%(docpath, pn))
+        dom = Parse(pagexml)
+        pagedivs = dom.xpath("//div[@class='pageNumberOrig']")
+        if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"):
+            if len(pagedivs)>0:
+                docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0])        
+                return docinfo['pageNumberOrig']
+    
+    def getOrigPagesNorm(self, docinfo=None, pageinfo=None):
+        docpath = docinfo['textURLPath']
+        pn =pageinfo['current']
+        selfurl = self.absolute_url()   
+        pagexml = self.getServerData("page-fragment.xql","document=%s&pn=%s"%(docpath, pn))
+        dom = Parse(pagexml)
+        pagedivs = dom.xpath("//div[@class='pageNumberOrigNorm']")
+        if pagedivs == dom.xpath("//div[@class='pageNumberOrigNorm']"):
+            if len(pagedivs)>0:
+                docinfo['pageNumberOrigNorm']= getTextFromNode(pagedivs[0])        
+                return docinfo['pageNumberOrigNorm']
+
+                
     def getTranslate(self, query=None, language=None):
         """translate into another languages"""
         data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query))
--- a/documentViewer.py	Tue Mar 01 15:53:15 2011 +0100
+++ b/documentViewer.py	Mon Mar 07 15:08:07 2011 +0100
@@ -46,10 +46,10 @@
 def serializeNode(node, encoding="utf-8"):
     """returns a string containing node as XML"""
     stream = cStringIO.StringIO()
-    logging.debug("BUF: %s"%(stream))
+    #logging.debug("BUF: %s"%(stream))
     Ft.Xml.Domlette.PrettyPrint(node, stream=stream, encoding=encoding)
     s = stream.getvalue()
-    logging.debug("BUF: %s"%(s))
+    #logging.debug("BUF: %s"%(s))
     stream.close()
     return s
 
@@ -230,7 +230,15 @@
     def getTextPage(self, **args):
         """get page"""
         return self.template.fulltextclient.getTextPage(**args)
+
+    def getOrigPages(self, **args):
+        """get page"""
+        return self.template.fulltextclient.getOrigPages(**args)
     
+    def getOrigPagesNorm(self, **args):
+        """get page"""
+        return self.template.fulltextclient.getOrigPagesNorm(**args)
+
     def getQuery(self, **args):
         """get query in search"""
         return self.template.fulltextclient.getQuery(**args)