Mercurial > hg > documentViewer
comparison MpdlXmlTextServer.py @ 176:0c6df37adcd1
url_quote
author | abukhman |
---|---|
date | Thu, 23 Sep 2010 16:34:26 +0200 |
parents | d1c13a6ba20d |
children | 393234132abd |
comparison
equal
deleted
inserted
replaced
175:d1c13a6ba20d | 176:0c6df37adcd1 |
---|---|
54 tocMode = pageinfo['tocMode'] | 54 tocMode = pageinfo['tocMode'] |
55 characterNormalization = pageinfo['characterNormalization'] | 55 characterNormalization = pageinfo['characterNormalization'] |
56 tocPN = pageinfo['tocPN'] | 56 tocPN = pageinfo['tocPN'] |
57 selfurl = self.absolute_url() | 57 selfurl = self.absolute_url() |
58 | 58 |
59 data = self.getServerData("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)) | 59 data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&highlightQuery=%s"%(docpath, 'text', queryType, url_quote(query), pagesize, pn, sn, viewMode,highlightQuery)) |
60 #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) | 60 #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) |
61 | 61 |
62 pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url) | 62 pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url) |
63 pagedom = Parse(pagexml) | 63 pagedom = Parse(pagexml) |
64 if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"): | 64 if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"): |
70 hrefNode = l.getAttributeNodeNS(None, u"href") | 70 hrefNode = l.getAttributeNodeNS(None, u"href") |
71 if hrefNode: | 71 if hrefNode: |
72 href = hrefNode.nodeValue | 72 href = hrefNode.nodeValue |
73 if href.startswith('page-fragment.xql'): | 73 if href.startswith('page-fragment.xql'): |
74 selfurl = self.absolute_url() | 74 selfurl = self.absolute_url() |
75 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)) | 75 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,url_quote(query),pagesize,pn,tocMode,pn,tocPN)) |
76 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) | 76 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) |
77 return serializeNode(pagenode) | 77 return serializeNode(pagenode) |
78 if (queryType=="fulltextMorph"): | 78 if (queryType=="fulltextMorph"): |
79 pagedivs = pagedom.xpath("//div[@class='queryResult']") | 79 pagedivs = pagedom.xpath("//div[@class='queryResult']") |
80 if len(pagedivs)>0: | 80 if len(pagedivs)>0: |
84 hrefNode = l.getAttributeNodeNS(None, u"href") | 84 hrefNode = l.getAttributeNodeNS(None, u"href") |
85 if hrefNode: | 85 if hrefNode: |
86 href = hrefNode.nodeValue | 86 href = hrefNode.nodeValue |
87 if href.startswith('page-fragment.xql'): | 87 if href.startswith('page-fragment.xql'): |
88 selfurl = self.absolute_url() | 88 selfurl = self.absolute_url() |
89 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)) | 89 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,url_quote(query),pagesize,pn,tocMode,pn,tocPN)) |
90 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) | 90 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) |
91 if href.startswith('../lt/lemma.xql'): | 91 if href.startswith('../lt/lemma.xql'): |
92 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma_New'%(selfurl)) | 92 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma_New'%(selfurl)) |
93 l.setAttributeNS(None, 'target', '_blank') | 93 l.setAttributeNS(None, 'target', '_blank') |
94 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") | 94 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |