Index: MpdlXmlTextServer.py
===================================================================
--- MpdlXmlTextServer.py	(revision 411)
+++ MpdlXmlTextServer.py	(revision 412)
@@ -118,27 +118,48 @@
         return "no text here"   
                        
-    """def getNumPages(self, docinfo):
-        ""get list of pages from fulltext and put in docinfo""
-        if 'numPages' in docinfo:
-            # already there
-            return docinfo        
-        xquery = '//pb'
-        text = self.getServerData("xquery.xql","document=%s&xquery=%s"%(docinfo['textURLPath'],xquery))
-        docinfo['numPages'] = text.count("<pb ")
-        return docinfo
-     """
-    def getNumTextPages (self, docinfo):
+    
+    def getNumTextPages (self, docinfo=None):
         """get list of pages from fulltext (texts without images) and put in docinfo"""
+        docpath = docinfo['textURLPath'] 
+        selfurl = self.absolute_url()   
+        #viewMode=  pageinfo['viewMode']
         if 'numPages' in docinfo:
             # allredy there
             return docinfo
-        xpath ='/count(//pb)'
-        text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'], xpath))
-        dom = Parse(text)
-        result= dom.xpath("//result/resultPage")
-         
-        docinfo['numPages']=int(getTextFromNode(result[0]))
-        return docinfo
+        
+        text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
+        dom =Parse(text)
+        pagedivs = dom.xpath("//div[@class='countPages']")
+        logging.debug ("pagedivs=%s"%(pagedivs))
+        if len(pagedivs)>0:
+            docinfo['numPages']= int(getTextFromNode(pagedivs[0]))
+            return docinfo
+     
+    def getTocEntries (self, docinfo=None):
+        """ number of text entries"""
+        docpath = docinfo['textURLPath'] 
+        selfurl = self.absolute_url()
+        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
             
+    def getFigureEntries (self, docinfo=None):
+        """ number of figure entries"""
+        docpath = docinfo['textURLPath'] 
+        selfurl = self.absolute_url()
+        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
+                       
     def getGisPlaces(self, docinfo=None, pageinfo=None):
         """ Show all Gis Places of whole Page"""
@@ -184,20 +205,5 @@
             logging.debug("getALLGisPlaces :%s"%(myList))
         return myList
-    
-    
-    def getPDF (self, docinfo=None, pageinfo=None):
-        """Show and Save different Pages as PDF in Options"""
-        selfurl=self.absolute_url()
-        pn=pageinfo['current']
-        
-        viewMode =pageinfo['viewMode']
-        
-        #text = ("page-fragment.xql","document=%s&mode=%s&pn=%s&export=%s"%(docinfo['textURLPath'], 'text',  pn,'pdf'))
-        #text = self.getServerData("page-fragment.xql", "document=%s&mode=%s&pn=%s&export=%s"(docinfo['textURLPath'],'text', pn,'pdf'))
-        #logging.debug("text :%s"%(text))
-        #dom =Parse(text)
-        #logging.debug("text :%s"%(text))
-        #return text 
-           
+               
     def getOrigPages (self, docinfo=None, pageinfo=None):
         """Show original page """
@@ -229,12 +235,9 @@
         pagedivs = dom.xpath("//div[@class='countPlaces']")
         logging.debug ("pagedivs=%s"%(pagedivs))
-        #originalPage= getTextFromNode(pagedivs[0])
-        #return allPlaces
         if len(pagedivs)>0:
             originalPage= getTextFromNode(pagedivs[0])
-            #return docinfo['originalPage']
             return originalPage
            
-    def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="regPlusNorm", highlightQuery=None, sn=None, optionToggle=None):
+    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"""
         docpath = docinfo['textURLPath']
@@ -397,41 +400,32 @@
     def getQueryResultHitsText(self,  docinfo=None, pageinfo=None):      
          """number of hits in Text of Contents mode"""
+         selfurl = self.absolute_url()
+         docpath = docinfo['textURLPath']
+         viewMode=  pageinfo['viewMode']
+         text = self.getServerData("page-fragment.xql","document=%s&mode=%s"%(docinfo['textURLPath'], 'text'))
+         dom =Parse(text)
+         pagedivs = dom.xpath("//div[@class='countTocEntries']")
+         logging.debug ("pagedivs=%s"%(pagedivs))
+         if len(pagedivs)>0:
+            originalPage= (getTextFromNode(pagedivs[0]))
+            tc = int (originalPage)
+            tc1 =tc/30+1
+            return tc1
          
-         docpath = docinfo['textURLPath'] 
-         pagesize = pageinfo['queryPageSize']
-         pn = pageinfo['searchPN']
-         query =pageinfo['query']
-         queryType =pageinfo['queryType']
-         tocSearch = 0
-         tocDiv = None
-         tocMode = pageinfo['tocMode']
-         tocPN = pageinfo['tocPN']  
-         pagexml=self.getServerData("doc-query.xql", "document=%s&queryType=%s"%(docpath,'toc'))
-         pagedom = Parse(pagexml)
-         logging.debug("documentViewer (pagedom) pagedom: %s"%(pagedom))
-         numdivs = pagedom.xpath("//div[@class='queryResultHits']")
-         tocSearch = int(getTextFromNode(numdivs[0]))  
-         tc=int((tocSearch/30)+1)  
-         return tc 
-
     def getQueryResultHitsFigures(self,  docinfo=None, pageinfo=None):      
          """number of hits in Text of Figures mode"""
          
-         docpath = docinfo['textURLPath'] 
-         pagesize = pageinfo['queryPageSize']
-         pn = pageinfo['searchPN']
-         query =pageinfo['query']
-         queryType =pageinfo['queryType']
-         tocSearch = 0
-         tocDiv = None
-         tocMode = pageinfo['tocMode']
-         tocPN = pageinfo['tocPN']  
-         pagexml=self.getServerData("doc-query.xql", "document=%s&queryType=%s"%(docpath,'figures'))
-         pagedom = Parse(pagexml)
-         logging.debug("documentViewer (pagedom) pagedom: %s"%(pagedom))
-         numdivs = pagedom.xpath("//div[@class='queryResultHits']")
-         tocSearch = int(getTextFromNode(numdivs[0]))  
-         tc=int((tocSearch/30)+1)  
-         return tc 
+         selfurl = self.absolute_url()
+         docpath = docinfo['textURLPath']
+         viewMode=  pageinfo['viewMode']
+         text = self.getServerData("page-fragment.xql","document=%s&mode=%s"%(docinfo['textURLPath'], 'text'))
+         dom =Parse(text)
+         pagedivs = dom.xpath("//div[@class='countFigureEntries']")
+         logging.debug ("pagedivs=%s"%(pagedivs))
+         if len(pagedivs)>0:
+            originalPage= (getTextFromNode(pagedivs[0]))
+            tc = int (originalPage)
+            tc1 =tc/30+1
+            return tc1 
 
 
Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 410)
+++ documentViewer.py	(revision 412)
@@ -148,4 +148,5 @@
     toc_figures = PageTemplateFile('zpt/toc_figures', globals())
     page_main_images = PageTemplateFile('zpt/page_main_images', globals())
+    page_main_double = PageTemplateFile('zpt/page_main_double', globals())
     page_main_text = PageTemplateFile('zpt/page_main_text', globals())
     page_main_text_dict = PageTemplateFile('zpt/page_main_text_dict', globals())
@@ -213,8 +214,4 @@
         return self.template.fulltextclient.getQueryResultHitsFigures(**args)
     
-    def getPDF(self, **args):
-        """get query"""
-        return self.template.fulltextclient.getPDF(**args)
-
     def getSearch(self, **args):
         """get search"""
@@ -236,4 +233,12 @@
         """get original page number """
         return self.template.fulltextclient.getAllPlaces(**args)
+    
+    def getTocEntries(self, **args):
+        """get original page number """
+        return self.template.fulltextclient.getTocEntries(**args)
+    
+    def getFigureEntries(self, **args):
+        """get original page number """
+        return self.template.fulltextclient.getFigureEntries(**args)    
     
     def getNumPages(self, docinfo):
@@ -349,5 +354,4 @@
         names=""
         names = browserCheck(self)
-        #logging.debug("XXXXXXXXXXXXXXXX: %s"%names)
         return names
         
@@ -835,5 +839,5 @@
         pageinfo['viewMode'] = viewMode
         pageinfo['tocMode'] = tocMode
-        pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','regPlusNorm')
+        pageinfo['characterNormalization'] = self.REQUEST.get('characterNormalization','reg')
         pageinfo['optionToggle'] = self.REQUEST.get('optionToggle','')
         pageinfo['query'] = self.REQUEST.get('query','') 
Index: zpt/page_main_double.zpt
===================================================================
--- zpt/page_main_double.zpt	(revision 412)
+++ zpt/page_main_double.zpt	(revision 412)
@@ -0,0 +1,4 @@
+
+<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None)   ">
+  <div tal:content="structure python:here.getTextPage(mode='image',pn=pageinfo['current'],docinfo=docinfo,   pageinfo=pageinfo)"></div>
+</tal:block>
