Changeset 112:d48c1d507556 in documentViewer
- Timestamp:
- May 21, 2010, 2:20:38 PM (15 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r109 r112 660 660 pageinfo['numgroups'] += 1 661 661 662 #pageinfo['viewMode'] = viewMode662 663 663 pageinfo['viewMode'] = viewMode 664 664 pageinfo['tocMode'] = tocMode … … 666 666 pageinfo['queryType'] = self.REQUEST.get('queryType',' ') 667 667 pageinfo['querySearch'] =self.REQUEST.get('querySearch', 'fulltext') 668 pageinfo['sn'] = self.REQUEST.get('sn','')669 668 pageinfo['textPN'] = self.REQUEST.get('textPN','1') 670 669 pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','') … … 687 686 688 687 pageinfo['searchPN'] =self.REQUEST.get('searchPN','1') 689 pageinfo['sn'] =self.REQUEST.get('sn',' 1')688 pageinfo['sn'] =self.REQUEST.get('sn','') 690 689 691 690 return pageinfo … … 707 706 tocPN = pageinfo['tocPN'] 708 707 selfurl = self.absolute_url() 709 # 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))710 708 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&highlightQuery=%s"%(docpath, 'text', queryType, query, pagesize, pn, sn, viewMode,highlightQuery) ,outputUnicode=False) 711 709 pagexml = page.replace('?document=%s'%str(docpath),'?url=%s'%url) … … 721 719 href = hrefNode.nodeValue 722 720 if href.startswith('page-fragment.xql'): 723 selfurl = self.absolute_url() 724 #l.setAttributeNS(None, "span class = 'hit highlight'", "background-color: #77DD77;") 721 selfurl = self.absolute_url() 725 722 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)) 726 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) 727 l.setAttributeNS(None, "onClick", "id='highlighting'") 728 logging.debug("documentViewer (gettoc) highlightQuery: %s"%(highlightQuery)) 729 l.setAttributeNS(None, highlightQuery, "id='highlighting'") 723 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) 730 724 return serializeNode(pagenode) 731 725 … … 764 758 765 759 if href.startswith('../lt/lex.xql'): 766 # selfurl = self.absolute_url()767 760 hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl) 768 761 l.setAttributeNS(None, 'target', '_blank') … … 770 763 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') 771 764 if href.startswith('../lt/lemma.xql'): 772 #selfurl = self.absolute_url()773 765 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl) 774 766 l.setAttributeNS(None, 'target', '_blank') … … 786 778 return docinfo 787 779 788 def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None ):780 def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None): 789 781 """returns single page from fulltext""" 790 782 docpath = docinfo['textURLPath'] 791 #pageinfo = pageinfo['highlightQuery'] 783 path = docinfo['textURLPath'] 784 url = docinfo['url'] 785 viewMode= pageinfo['viewMode'] 786 tocMode = pageinfo['tocMode'] 787 tocPN = pageinfo['tocPN'] 788 selfurl = self.absolute_url() 789 790 #pn = pageinfo['searchPN'] 791 792 792 if mode == "text_dict": 793 793 textmode = "textPollux" 794 794 else: 795 795 textmode = mode 796 797 #selfurl = self.absolute_url() 798 #viewMode= pageinfo['viewMode'] 799 #tocMode = pageinfo['tocMode'] 800 #tocPN = pageinfo['tocPN'] 801 802 pagexml=self.template.fulltextclient.eval("/mpdl/interface/page-fragment.xql", "document=%s&mode=%s&pn=%s&highlightQuery=%s&sn=%s"%(docpath,textmode,pn,highlightQuery,sn), outputUnicode=False) 803 logging.debug("documentViewer (gettoc) document=%s&mode=%s&pn=%s&highlightQuery=%s"%(docpath,textmode,pn,highlightQuery)) 804 # post-processing downloaded xml 796 797 textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn) 798 if highlightQuery is not None: 799 textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn) 800 801 pagexml=self.template.fulltextclient.eval("/mpdl/interface/page-fragment.xql", textParam, outputUnicode=False) 805 802 pagedom = Parse(pagexml) 806 803 # plain text mode … … 809 806 pagedivs = pagedom.xpath("/div") 810 807 #queryResultPage 811 if len(pagedivs) > 0: 812 808 if len(pagedivs) > 0: 813 809 pagenode = pagedivs[0] 814 810 links = pagenode.xpath("//a") 815 811 for l in links: 816 812 hrefNode = l.getAttributeNodeNS(None, u"href") 813 817 814 if hrefNode: 818 815 href= hrefNode.nodeValue 819 if href.startswith('#note- 0006-01'):820 selfurl = self.absolute_url()821 hrefNode.nodeValue = href.replace("href='#note-'",'xaxa/%s/'%selfurl)816 if href.startswith('#note-'): 817 hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn)) 818 822 819 return serializeNode(pagenode) 823 820 if mode == "xml": … … 856 853 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") 857 854 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') 855 856 if href.startswith('#note-'): 857 hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn)) 858 859 858 860 return serializeNode(pagenode) 859 861
Note: See TracChangeset
for help on using the changeset viewer.