Changeset 100:137459e3b378 in documentViewer
- Timestamp:
- May 5, 2010, 3:42:56 PM (15 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r99 r100 175 175 @param viewMode: if images display images, if text display text, default is auto (text,images or auto) 176 176 @param tocMode: type of 'table of contents' for navigation (thumbs, text, figures, none) 177 @param querySearch: type of different search modes (fulltext, fulltextMorph, xpath, xquery, ftIndex, ftIndexMorph )177 @param querySearch: type of different search modes (fulltext, fulltextMorph, xpath, xquery, ftIndex, ftIndexMorph, fulltextMorphLemma) 178 178 ''' 179 179 … … 698 698 tocMode = pageinfo['tocMode'] 699 699 tocPN = pageinfo['tocPN'] 700 701 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)702 pagexm = page.replace('?document=/echo/la/Benedetti_1585.xml','?url=/mpiwg/online/permanent/library/163127KK')703 pagexml=pagexm.replace('mode=text','mode=texttool')700 selfurl = self.absolute_url() 701 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) 702 pagexml = page.replace('?document=/echo/la/Benedetti_1585.xml','?url=/mpiwg/online/permanent/library/163127KK') 703 #hrefNode.nodeValue =pagexml.replace('mode=text','%s&mode=texttool'%selfurl) 704 704 pagedom = Parse(pagexml) 705 706 if (queryType=="fulltext")or(queryType==" fulltextMorph")or(queryType=="xpath")or(queryType=="xquery"):705 #logging.debug("documentViewer (gettoc) pagedom: %s"%(pagedom)) 706 if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"): 707 707 pagedivs = pagedom.xpath("//div[@class='queryResultPage']") 708 selfurl = self.absolute_url() 709 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)) 710 text =page.replace('mode=text','mode=texttool') 711 return text 708 if len(pagedivs)>0: 709 pagenode=pagedivs[0] 710 links=pagenode.xpath("//a") 711 for l in links: 712 hrefNode = l.getAttributeNodeNS(None, u"href") 713 if hrefNode: 714 href = hrefNode.nodeValue 715 if href.startswith('page-fragment.xql'): 716 selfurl = self.absolute_url() 717 #l.setAttributeNS(None, "span class = 'hit highlight'", "background-color: #77DD77;") 718 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)) 719 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) 720 l.setAttributeNS(None, "span class = 'hit'", "background-color: #77DD77;") 721 return serializeNode(pagenode) 722 723 if (queryType=="fulltextMorph"): 724 pagedivs = pagedom.xpath("//div[@class='queryResult']") 725 726 if len(pagedivs)>0: 727 pagenode=pagedivs[0] 728 links=pagenode.xpath("//a") 729 for l in links: 730 hrefNode = l.getAttributeNodeNS(None, u"href") 731 if hrefNode: 732 href = hrefNode.nodeValue 733 if href.startswith('page-fragment.xql'): 734 selfurl = self.absolute_url() 735 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)) 736 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) 737 if href.startswith('../lt/lemma.xql'): 738 selfurl = self.absolute_url() 739 hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl) 740 l.setAttributeNS(None, 'target', '_blank') 741 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") 742 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') 743 return serializeNode(pagenode) 712 744 713 745 if (queryType=="ftIndex")or(queryType=="ftIndexMorph"): … … 720 752 if hrefNode: 721 753 href = hrefNode.nodeValue 754 hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn)) 755 722 756 if href.startswith('../lt/lex.xql'): 723 757 selfurl = self.absolute_url() 724 hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl) 725 726 727 758 hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl) 728 759 l.setAttributeNS(None, 'target', '_blank') 729 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left= 200, scrollbars=1'); return false;")760 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") 730 761 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') 731 762 if href.startswith('../lt/lemma.xql'): … … 733 764 hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl) 734 765 l.setAttributeNS(None, 'target', '_blank') 735 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left= 200, scrollbars=1'); return false;")766 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") 736 767 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') 737 return serializeNode(pagenode) 738 739 return "no text here" 768 return serializeNode(pagenode) 769 return "xexe" 740 770 741 771 def getNumPages(self,docinfo=None):
Note: See TracChangeset
for help on using the changeset viewer.