changeset 103:daedc22e4e76

last update
author abukhman
date Wed, 19 May 2010 18:19:45 +0200
parents 27513c893ba9
children ff92f29e99a9
files documentViewer.py
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Mon May 10 15:22:16 2010 +0200
+++ b/documentViewer.py	Wed May 19 18:19:45 2010 +0200
@@ -705,6 +705,7 @@
         tocMode = pageinfo['tocMode']
         tocPN = pageinfo['tocPN']
         selfurl = self.absolute_url()
+        logging.debug("documentViewer (gettoc) /mpdl/interface/doc-query.xql?document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode))
         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"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode) ,outputUnicode=False)                
         pagexml = page.replace('?document=%s'%str(docpath),'?url=%s'%url)
         pagedom = Parse(pagexml)
@@ -722,8 +723,7 @@
                             #l.setAttributeNS(None, "span class = 'hit highlight'", "background-color: #77DD77;")            
                             pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN))
                             hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)                                          
-                            l.setAttributeNS(None, "onClick", "id='highlighting'")  
-                              
+                            l.setAttributeNS(None, "onClick", "id='highlighting'")              
                 return serializeNode(pagenode)
         
         if (queryType=="fulltextMorph"):
@@ -760,14 +760,14 @@
                         hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn))
                        
                         if href.startswith('../lt/lex.xql'):
-                            selfurl = self.absolute_url()
-                            hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)         
+                           # selfurl = self.absolute_url()
+                            hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl)         
                             l.setAttributeNS(None, 'target', '_blank')
                             l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
                             l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
                         if href.startswith('../lt/lemma.xql'):
-                            selfurl = self.absolute_url()
-                            hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)        
+                            #selfurl = self.absolute_url()
+                            hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl)        
                             l.setAttributeNS(None, 'target', '_blank')
                             l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
                             l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
@@ -804,7 +804,16 @@
             pagedivs = pagedom.xpath("/div")
             #queryResultPage
             if len(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('#note-0006-01'):
+                            selfurl = self.absolute_url()
+                            hrefNode.nodeValue = href.replace("href='#note-'",'xaxa/%s/'%selfurl)
                 return serializeNode(pagenode)
         if mode == "xml":
               # first div contains text