changeset 414:ad201f406dd1

*** empty log message ***
author abukhman
date Thu, 23 Dec 2010 16:38:41 +0100
parents ea9aaecd73f1
children b93a2e5d5506
files MpdlXmlTextServer.py
diffstat 1 files changed, 24 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/MpdlXmlTextServer.py	Wed Dec 22 12:54:46 2010 +0100
+++ b/MpdlXmlTextServer.py	Thu Dec 23 16:38:41 2010 +0100
@@ -139,27 +139,33 @@
         """ number of text entries"""
         docpath = docinfo['textURLPath'] 
         selfurl = self.absolute_url()
+        if 'tocEntries' in docinfo:
+            # allredy there
+            return docinfo['tocEntries']
         if (docpath!=None):
             text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
             dom =Parse(text)
             pagedivs = dom.xpath("//div[@class='countTocEntries']")
-            logging.debug ("pagedivs=%s"%(pagedivs))
-            originalPage = getTextFromNode(pagedivs[0])
-            tc = int (originalPage)
-            return tc
+            #logging.debug ("pagedivs=%s"%(pagedivs))
+            docinfo['tocEntries'] = getTextFromNode(pagedivs[0])
+            #tc = int (originalPage)
+            return docinfo['tocEntries']
             
     def getFigureEntries (self, docinfo=None):
         """ number of figure entries"""
         docpath = docinfo['textURLPath'] 
         selfurl = self.absolute_url()
+        if 'figureEntries' in docinfo:
+            # allredy there
+            return docinfo['figureEntries']
         if (docpath!=None):   
             text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
             dom = Parse(text)
             pagedivs = dom.xpath("//div[@class='countFigureEntries']")
-            logging.debug ("pagedivs=%s"%(pagedivs))
-            originalPage = getTextFromNode(pagedivs[0])
-            tc = int (originalPage)
-            return tc
+            #logging.debug ("pagedivs=%s"%(pagedivs))
+            docinfo['figureEntries'] = getTextFromNode(pagedivs[0])
+            #tc = int (docinfo['figureEntries'])
+            return docinfo['figureEntries']
                        
     def getGisPlaces(self, docinfo=None, pageinfo=None):
         """ Show all Gis Places of whole Page"""
@@ -210,9 +216,6 @@
         docpath = docinfo.get('textURLPath',None)
         if not docpath:
             return None
-
-        logging.debug ("docinfo['textURLPath']=%s"%(docinfo['textURLPath']))
-        #url = docinfo['url']
         selfurl = self.absolute_url()
         pn =pageinfo['current']
        
@@ -225,18 +228,22 @@
             #return docinfo['originalPage']
             return originalPage
     
-    def getAllPlaces (self, docinfo=None, pageinfo=None):
+    def getAllPlaces (self, docinfo=None):
         """Show all Places if no places than 0"""
         docpath = docinfo['textURLPath'] 
-        selfurl = self.absolute_url()   
-        viewMode=  pageinfo['viewMode']
-        text = self.getServerData("page-fragment.xql","document=%s&mode=%s"%(docinfo['textURLPath'], 'text'))
+        selfurl = self.absolute_url()
+        if 'allPlaces' in docinfo:
+            # allredy there
+            return docinfo['allPlaces']
+        
+        text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
         dom =Parse(text)
         pagedivs = dom.xpath("//div[@class='countPlaces']")
         logging.debug ("pagedivs=%s"%(pagedivs))
         if len(pagedivs)>0:
-            originalPage= getTextFromNode(pagedivs[0])
-            return originalPage
+            docinfo['allPlaces']= getTextFromNode(pagedivs[0])
+            #logging.debug ("docinfo['allPlaces']=%s"%(docinfo['allPlaces']))
+            return docinfo['allPlaces']
            
     def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="reg", highlightQuery=None, sn=None, optionToggle=None):
         """returns single page from fulltext"""