Diff for /documentViewer/documentViewer.py between versions 1.48 and 1.49

version 1.48, 2010/04/30 14:36:00 version 1.49, 2010/05/05 15:42:56
Line 174  class documentViewer(Folder): Line 174  class documentViewer(Folder):
         @param url: url which contains display information          @param url: url which contains display information
         @param viewMode: if images display images, if text display text, default is auto (text,images or auto)          @param viewMode: if images display images, if text display text, default is auto (text,images or auto)
         @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)          @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none)
         @param querySearch: type of different search modes (fulltext, fulltextMorph, xpath, xquery, ftIndex, ftIndexMorph)          @param querySearch: type of different search modes (fulltext, fulltextMorph, xpath, xquery, ftIndex, ftIndexMorph, fulltextMorphLemma)
         '''          '''
                   
         logging.debug("documentViewer (index) mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))          logging.debug("documentViewer (index) mode: %s url:%s start:%s pn:%s"%(mode,url,start,pn))
Line 697  class documentViewer(Folder): Line 697  class documentViewer(Folder):
         viewMode=  pageinfo['viewMode']          viewMode=  pageinfo['viewMode']
         tocMode = pageinfo['tocMode']          tocMode = pageinfo['tocMode']
         tocPN = pageinfo['tocPN']          tocPN = pageinfo['tocPN']
                   selfurl = self.absolute_url()
         page=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s"%(docpath, 'text', queryType, query, pagesize, pn, sn) ,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"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode) ,outputUnicode=False)                
         pagexm = page.replace('?document=/echo/la/Benedetti_1585.xml','?url=/mpiwg/online/permanent/library/163127KK')          pagexml = page.replace('?document=/echo/la/Benedetti_1585.xml','?url=/mpiwg/online/permanent/library/163127KK')
         pagexml=pagexm.replace('mode=text','mode=texttool')          #hrefNode.nodeValue =pagexml.replace('mode=text','%s&mode=texttool'%selfurl)
         pagedom = Parse(pagexml)          pagedom = Parse(pagexml)
                   #logging.debug("documentViewer (gettoc) pagedom: %s"%(pagedom))
         if (queryType=="fulltext")or(queryType=="fulltextMorph")or(queryType=="xpath")or(queryType=="xquery"):          if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"):   
             pagedivs = pagedom.xpath("//div[@class='queryResultPage']")              pagedivs = pagedom.xpath("//div[@class='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('page-fragment.xql'):
                               selfurl = self.absolute_url()
                               #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, "span class = 'hit'", "background-color: #77DD77;")      
                   return serializeNode(pagenode)
           
           if (queryType=="fulltextMorph"):
               pagedivs = pagedom.xpath("//div[@class='queryResult']")
               
               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('page-fragment.xql'):
                               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'%(viewMode,queryType,query,pagesize,pn,tocMode,pn,tocPN))
                               hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)  
                           if href.startswith('../lt/lemma.xql'):
             selfurl = self.absolute_url()              selfurl = self.absolute_url()
             page = pagexml.replace('page-fragment.xql?document=/echo/la/Benedetti_1585.xml','%s?url=/mpiwg/online/permanent/library/163127KK&viewMode=%s&tocMode=%s&tocPN=%s&query=%s&queryType=%s'%(selfurl, viewMode, tocMode, tocPN, query, queryType))                              hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)        
             text =page.replace('mode=text','mode=texttool')                              l.setAttributeNS(None, 'target', '_blank')
             return text                              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();')                  
                   return serializeNode(pagenode)
                   
         if (queryType=="ftIndex")or(queryType=="ftIndexMorph"):          if (queryType=="ftIndex")or(queryType=="ftIndexMorph"):
             pagedivs= pagedom.xpath("//div[@class='queryResultPage']")              pagedivs= pagedom.xpath("//div[@class='queryResultPage']")
Line 719  class documentViewer(Folder): Line 751  class documentViewer(Folder):
                     hrefNode = l.getAttributeNodeNS(None, u"href")                      hrefNode = l.getAttributeNodeNS(None, u"href")
                     if hrefNode:                      if hrefNode:
                         href = hrefNode.nodeValue                          href = hrefNode.nodeValue
                           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'):                          if href.startswith('../lt/lex.xql'):
                             selfurl = self.absolute_url()                              selfurl = self.absolute_url()
                             hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)                              hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)
                               
                                       
                               
                             l.setAttributeNS(None, 'target', '_blank')                              l.setAttributeNS(None, 'target', '_blank')
                             l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=200, scrollbars=1'); return false;")                              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();')                              l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
                         if href.startswith('../lt/lemma.xql'):                          if href.startswith('../lt/lemma.xql'):
                             selfurl = self.absolute_url()                              selfurl = self.absolute_url()
                             hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)                                      hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)        
                             l.setAttributeNS(None, 'target', '_blank')                              l.setAttributeNS(None, 'target', '_blank')
                             l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=200, scrollbars=1'); return false;")                              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();')                              l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
                 return serializeNode(pagenode)                  return serializeNode(pagenode)
                   return "xexe"   
         return "no text here"     
                                                 
     def getNumPages(self,docinfo=None):      def getNumPages(self,docinfo=None):
         """get list of pages from fulltext and put in docinfo"""          """get list of pages from fulltext and put in docinfo"""

Removed from v.1.48  
changed lines
  Added in v.1.49


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