Mercurial > hg > documentViewer
comparison MpdlXmlTextServer.py @ 207:0f6a377679d5
*** empty log message ***
author | abukhman |
---|---|
date | Fri, 08 Oct 2010 13:58:15 +0200 |
parents | 944c44b469e4 |
children | 0882bad5ac48 |
comparison
equal
deleted
inserted
replaced
206:944c44b469e4 | 207:0f6a377679d5 |
---|---|
116 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") | 116 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") |
117 l.setAttributeNS(None, 'onClick', 'popupWin.focus();') | 117 l.setAttributeNS(None, 'onClick', 'popupWin.focus();') |
118 return serializeNode(pagenode) | 118 return serializeNode(pagenode) |
119 return "no text here" | 119 return "no text here" |
120 | 120 |
121 def getNumPages(self, docinfo): | 121 """def getNumPages(self, docinfo): |
122 """get list of pages from fulltext and put in docinfo""" | 122 ""get list of pages from fulltext and put in docinfo"" |
123 if 'numPages' in docinfo: | 123 if 'numPages' in docinfo: |
124 # already there | 124 # already there |
125 return docinfo | 125 return docinfo |
126 xquery = '//pb' | 126 xquery = '//pb' |
127 text = self.getServerData("xquery.xql","document=%s&xquery=%s"%(docinfo['textURLPath'],xquery)) | 127 text = self.getServerData("xquery.xql","document=%s&xquery=%s"%(docinfo['textURLPath'],xquery)) |
128 docinfo['numPages'] = text.count("<pb ") | 128 docinfo['numPages'] = text.count("<pb ") |
129 return docinfo | 129 return docinfo |
130 | 130 """ |
131 def getNumTextPages (self, docinfo): | 131 def getNumTextPages (self, docinfo): |
132 """get list of pages from fulltext (texts without images) and put in docinfo""" | 132 """get list of pages from fulltext (texts without images) and put in docinfo""" |
133 if 'numPages' in docinfo: | 133 if 'numPages' in docinfo: |
134 # allredy there | 134 # allredy there |
135 return docinfo | 135 return docinfo |
137 text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'], xpath)) | 137 text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'], xpath)) |
138 dom = Parse(text) | 138 dom = Parse(text) |
139 result= dom.xpath("//result/resultPage") | 139 result= dom.xpath("//result/resultPage") |
140 docinfo['numPages']=int(getTextFromNode(result[0])) | 140 docinfo['numPages']=int(getTextFromNode(result[0])) |
141 return docinfo | 141 return docinfo |
142 | 142 |
143 def getGisPlases(self, docinfo): | |
144 """ Show all Gis Places of whole Page""" | |
145 xpath='//place' | |
146 text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'], xpath)) | |
147 pagedom = Parse(text) | |
148 result =pagedom.xpath("//result/resultPage/place") | |
149 docinfo['place']=getTextFromNode(result[0]) | |
150 return docinfo | |
151 | |
143 def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=""): | 152 def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=""): |
144 """returns single page from fulltext""" | 153 """returns single page from fulltext""" |
145 docpath = docinfo['textURLPath'] | 154 docpath = docinfo['textURLPath'] |
146 path = docinfo['textURLPath'] | 155 path = docinfo['textURLPath'] |
147 url = docinfo['url'] | 156 url = docinfo['url'] |
193 hrefNode =l.getAttributeNodeNS(None, u"href") | 202 hrefNode =l.getAttributeNodeNS(None, u"href") |
194 if hrefNode: | 203 if hrefNode: |
195 href=hrefNode.nodeValue | 204 href=hrefNode.nodeValue |
196 if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'): | 205 if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'): |
197 hrefNode.nodeValue =href.replace('chinagis_REST','chinagis') | 206 hrefNode.nodeValue =href.replace('chinagis_REST','chinagis') |
207 hrefNode.nodeValue=href.replace('chgis','') | |
198 l.setAttributeNS(None, 'target', '_blank') | 208 l.setAttributeNS(None, 'target', '_blank') |
199 return serializeNode(pagenode) | 209 return serializeNode(pagenode) |
200 | 210 |
201 if mode == "pureXml": | 211 if mode == "pureXml": |
202 # first div contains text | 212 # first div contains text |