Mercurial > hg > documentViewer
comparison MpdlXmlTextServer.py @ 440:3940845b2474
*** empty log message ***
author | abukhman |
---|---|
date | Tue, 19 Apr 2011 16:21:32 +0200 |
parents | 3e78973773c0 |
children | 542d0aaf30bb |
comparison
equal
deleted
inserted
replaced
439:f549aafee32b | 440:3940845b2474 |
---|---|
18 {'label':'Config','action':'manage_changeMpdlXmlTextServerForm'}, | 18 {'label':'Config','action':'manage_changeMpdlXmlTextServerForm'}, |
19 )+SimpleItem.manage_options | 19 )+SimpleItem.manage_options |
20 | 20 |
21 manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals()) | 21 manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals()) |
22 | 22 |
23 def __init__(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40): | 23 def __init__(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40): |
24 #def __init__(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40): | 24 #def __init__(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40): |
25 | 25 |
26 """constructor""" | 26 """constructor""" |
27 self.id=id | 27 self.id=id |
28 self.title=title | 28 self.title=title |
202 textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn) | 202 textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn) |
203 | 203 |
204 pagexml = self.getServerData("page-fragment.xql",textParam) | 204 pagexml = self.getServerData("page-fragment.xql",textParam) |
205 dom = Parse(pagexml) | 205 dom = Parse(pagexml) |
206 #original Pages | 206 #original Pages |
207 pagedivs = dom.xpath("//div[@class='pageNumberOrig']") | 207 pagedivs = dom.xpath("//div[@class='pageNumberOrig']") |
208 """if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"): | 208 """if pagedivs == dom.xpath("//div[@class='pageNumberOrig']"): |
209 if len(pagedivs)>0: | 209 if len(pagedivs)>0: |
210 docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0]) | 210 docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0]) |
211 logging.debug("ORIGINAL PAGE: %s"%(docinfo['pageNumberOrig'])) | 211 logging.debug("ORIGINAL PAGE: %s"%(docinfo['pageNumberOrig'])) |
212 | 212 |
346 for l in links: | 346 for l in links: |
347 hrefNode = l.getAttributeNodeNS(None, u"href") | 347 hrefNode = l.getAttributeNodeNS(None, u"href") |
348 if hrefNode: | 348 if hrefNode: |
349 # is link with href | 349 # is link with href |
350 href = hrefNode.nodeValue | 350 href = hrefNode.nodeValue |
351 if href.startswith('lt/lex.xql'): | 351 if href.startswith('../lt/wordInfo.xql'): |
352 # is pollux link | 352 # is pollux link |
353 selfurl = self.absolute_url() | 353 selfurl = self.absolute_url() |
354 # change href | 354 # change href |
355 hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl) | 355 hrefNode.nodeValue = href.replace('../lt/wordInfo.xql','%s/template/voc'%selfurl) |
356 # add target | 356 # add target |
357 l.setAttributeNS(None, 'target', '_blank') | 357 l.setAttributeNS(None, 'target', '_blank') |
358 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") | 358 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") |
359 l.setAttributeNS(None, 'onClick', 'popupWin.focus();') | 359 l.setAttributeNS(None, 'onClick', 'popupWin.focus();') |
360 if href.startswith('lt/lemma.xql'): | 360 if href.startswith('lt/lemma.xql'): |
481 data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=regPlusNorm&optionToggle=1"%(docpath,queryType, pagesize, pn)) | 481 data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=regPlusNorm&optionToggle=1"%(docpath,queryType, pagesize, pn)) |
482 page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) | 482 page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) |
483 text = page.replace('mode=image','mode=texttool') | 483 text = page.replace('mode=image','mode=texttool') |
484 return text | 484 return text |
485 | 485 |
486 def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): | 486 def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |
487 #def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/",timeout=40,RESPONSE=None): | 487 #def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/",timeout=40,RESPONSE=None): |
488 """change settings""" | 488 """change settings""" |
489 self.title=title | 489 self.title=title |
490 self.timeout = timeout | 490 self.timeout = timeout |
491 self.serverUrl = serverUrl | 491 self.serverUrl = serverUrl |
496 def manage_addMpdlXmlTextServerForm(self): | 496 def manage_addMpdlXmlTextServerForm(self): |
497 """Form for adding""" | 497 """Form for adding""" |
498 pt = PageTemplateFile("zpt/manage_addMpdlXmlTextServer", globals()).__of__(self) | 498 pt = PageTemplateFile("zpt/manage_addMpdlXmlTextServer", globals()).__of__(self) |
499 return pt() | 499 return pt() |
500 | 500 |
501 def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): | 501 def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |
502 #def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/",timeout=40,RESPONSE=None): | 502 #def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de:30030/mpdl/interface/",timeout=40,RESPONSE=None): |
503 """add zogiimage""" | 503 """add zogiimage""" |
504 newObj = MpdlXmlTextServer(id,title,serverUrl,timeout) | 504 newObj = MpdlXmlTextServer(id,title,serverUrl,timeout) |
505 self.Destination()._setObject(id, newObj) | 505 self.Destination()._setObject(id, newObj) |
506 if RESPONSE is not None: | 506 if RESPONSE is not None: |