Mercurial > hg > documentViewer
changeset 442:9148eac0cab3
*** empty log message ***
author | abukhman |
---|---|
date | Thu, 28 Apr 2011 11:58:39 +0200 |
parents | 542d0aaf30bb |
children | ad5c3dedfc18 |
files | MpdlXmlTextServer.py documentViewer.py |
diffstat | 2 files changed, 36 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/MpdlXmlTextServer.py Tue Apr 19 16:27:35 2011 +0200 +++ b/MpdlXmlTextServer.py Thu Apr 28 11:58:39 2011 +0200 @@ -41,7 +41,7 @@ url = self.serverUrl+method return documentViewer.getHttpData(url,data,timeout=self.timeout) - def getSearch(self, pageinfo=None, docinfo=None, lemma=None): + def getSearch(self, pageinfo=None, docinfo=None): """get search list""" docpath = docinfo['textURLPath'] url = docinfo['url'] @@ -103,10 +103,10 @@ pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s&optionToggle=%s&characterNormalization=%s'%(viewMode,queryType,urllib.quote(query),pagesize,pn,tocMode,pn,tocPN,optionToggle,characterNormalization)) hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) if href.startswith('../lt/lemma.xql'): - hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma_New'%(selfurl)) + hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_query'%(selfurl)) l.setAttributeNS(None, 'target', '_blank') l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") - l.setAttributeNS(None, 'onClick', 'popupWin.focus();') + l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') pagedivs = pagedom.xpath("//div[@class='queryResultMorphExpansion']") return serializeNode(pagenode) if (queryType=="ftIndex")or(queryType=="ftIndexMorph"): @@ -120,15 +120,15 @@ href = hrefNode.nodeValue hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s&optionToggle=%s&characterNormalization=%s'%(viewMode,tocMode,tocPN,pn,optionToggle,characterNormalization)) if href.startswith('../lt/lex.xql'): - hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl) + hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_lex'%selfurl) l.setAttributeNS(None, 'target', '_blank') l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") - l.setAttributeNS(None, 'onClick', 'popupWin.focus();') + l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') if href.startswith('../lt/lemma.xql'): - hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl) + hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%(selfurl)) l.setAttributeNS(None, 'target', '_blank') l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;") - l.setAttributeNS(None, 'onClick', 'popupWin.focus();') + l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') return serializeNode(pagenode) return "no text here" @@ -348,21 +348,24 @@ if hrefNode: # is link with href href = hrefNode.nodeValue - if href.startswith('../lt/wordInfo.xql'): + if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'): # is pollux link selfurl = self.absolute_url() # change href - hrefNode.nodeValue = href.replace('../lt/wordInfo.xql','%s/template/voc'%selfurl) + hrefNode.nodeValue = href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl) # add target l.setAttributeNS(None, 'target', '_blank') - l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") - l.setAttributeNS(None, 'onClick', 'popupWin.focus();') - if href.startswith('lt/lemma.xql'): + l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=no, scrollbars=1'); return false;") + l.setAttributeNS(None, "onDblclick", "popupWin.focus();") + #window.open("this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=yes, scrollbars=1'"); return false;") + + if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'): selfurl = self.absolute_url() - hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl) + hrefNode.nodeValue = href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl) l.setAttributeNS(None, 'target', '_blank') - l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") - l.setAttributeNS(None, 'onClick', 'popupWin.focus();') + l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=no, scrollbars=1'); return false;") + l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();') + if href.startswith('#note-'): hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=text_dict&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,tocMode,tocPN,pn)) return serializeNode(pagenode) @@ -393,22 +396,25 @@ return docinfo['pageNumberOrigNorm'] - def getTranslate(self, query=None, language=None): + def getTranslate(self, word=None, language=None): """translate into another languages""" - data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query)) + data = self.getServerData("lt/wordInfo.xql","language="+str(language)+"&word="+urllib.quote(word)+"&output=html") #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lex.xql","document=&language="+str(language)+"&query="+url_quote(str(query))) return data def getLemma(self, lemma=None, language=None): """simular words lemma """ - data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(lemma)) - #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(lemma))) + data = self.getServerData("lt/lemma.xql","language="+str(language)+"&lemma="+urllib.quote(lemma)+"&output=html") return data - def getLemmaNew(self, query=None, language=None): + def getLemmaQuery(self, query=None, language=None): """simular words lemma """ - data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(query)) - #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query))) + data = self.getServerData("lt/lemma.xql","language="+str(language)+"&query="+urllib.quote(query)+"&output=html") + return data + + def getLex(self, query=None, language=None): + #simular words lemma + data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query)) return data def getQuery (self, docinfo=None, pageinfo=None, query=None, queryType=None, pn=1, optionToggle=None):
--- a/documentViewer.py Tue Apr 19 16:27:35 2011 +0200 +++ b/documentViewer.py Thu Apr 28 11:58:39 2011 +0200 @@ -263,6 +263,14 @@ """get lemma""" return self.template.fulltextclient.getLemma(**args) + def getLemmaQuery(self, **args): + """get query""" + return self.template.fulltextclient.getLemmaQuery(**args) + + def getLex(self, **args): + """get lex""" + return self.template.fulltextclient.getLex(**args) + def getToc(self, **args): """get toc""" return self.template.fulltextclient.getToc(**args)