Annotation of documentViewer/MpdlXmlTextServer.py, revision 1.204
1.2 casties 1:
2: from OFS.SimpleItem import SimpleItem
3: from Products.PageTemplates.PageTemplateFile import PageTemplateFile
4: from Ft.Xml import EMPTY_NAMESPACE, Parse
5:
6: import sys
7: import logging
1.5 casties 8: import urllib
1.2 casties 9: import documentViewer
10: from documentViewer import getTextFromNode, serializeNode
11:
12: class MpdlXmlTextServer(SimpleItem):
13: """TextServer implementation for MPDL-XML eXist server"""
14: meta_type="MPDL-XML TextServer"
15:
16: manage_options=(
17: {'label':'Config','action':'manage_changeMpdlXmlTextServerForm'},
18: )+SimpleItem.manage_options
19:
20: manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())
21:
1.3 casties 22: def __init__(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):
1.2 casties 23: """constructor"""
24: self.id=id
25: self.title=title
26: self.timeout = timeout
1.3 casties 27: if serverName is None:
28: self.serverUrl = serverUrl
29: else:
30: self.serverUrl = "http://%s/mpdl/interface/"%serverName
1.2 casties 31:
32: def getHttpData(self, url, data=None):
33: """returns result from url+data HTTP request"""
34: return documentViewer.getHttpData(url,data,timeout=self.timeout)
35:
36: def getServerData(self, method, data=None):
37: """returns result from text server for method+data"""
38: url = self.serverUrl+method
39: return documentViewer.getHttpData(url,data,timeout=self.timeout)
40:
1.203 abukhman 41: def getSearch(self, pn=1, pageinfo=None, docinfo=None, query=None, queryType=None, lemma=None, characterNormalization=None, optionsClose=None):
1.2 casties 42: """get search list"""
43: docpath = docinfo['textURLPath']
44: url = docinfo['url']
45: pagesize = pageinfo['queryPageSize']
46: pn = pageinfo['searchPN']
47: sn = pageinfo['sn']
48: highlightQuery = pageinfo['highlightQuery']
1.34 abukhman 49: query =pageinfo['query']
1.2 casties 50: queryType =pageinfo['queryType']
51: viewMode= pageinfo['viewMode']
52: tocMode = pageinfo['tocMode']
1.24 abukhman 53: characterNormalization = pageinfo['characterNormalization']
1.2 casties 54: tocPN = pageinfo['tocPN']
55: selfurl = self.absolute_url()
56:
1.185 abukhman 57: data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&characterNormalization=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, sn, viewMode,characterNormalization ,urllib.quote(highlightQuery)))
1.2 casties 58: #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)
59:
60: pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)
61: pagedom = Parse(pagexml)
62: if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"):
63: pagedivs = pagedom.xpath("//div[@class='queryResultPage']")
64: if len(pagedivs)>0:
65: pagenode=pagedivs[0]
66: links=pagenode.xpath("//a")
67: for l in links:
68: hrefNode = l.getAttributeNodeNS(None, u"href")
69: if hrefNode:
70: href = hrefNode.nodeValue
71: if href.startswith('page-fragment.xql'):
72: selfurl = self.absolute_url()
1.30 abukhman 73: 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,urllib.quote(query),pagesize,pn,tocMode,pn,tocPN))
1.2 casties 74: hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)
75: return serializeNode(pagenode)
76: if (queryType=="fulltextMorph"):
77: pagedivs = pagedom.xpath("//div[@class='queryResult']")
78: if len(pagedivs)>0:
79: pagenode=pagedivs[0]
80: links=pagenode.xpath("//a")
81: for l in links:
82: hrefNode = l.getAttributeNodeNS(None, u"href")
83: if hrefNode:
84: href = hrefNode.nodeValue
85: if href.startswith('page-fragment.xql'):
86: selfurl = self.absolute_url()
1.30 abukhman 87: 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,urllib.quote(query),pagesize,pn,tocMode,pn,tocPN))
1.2 casties 88: hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)
89: if href.startswith('../lt/lemma.xql'):
90: hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma_New'%(selfurl))
91: l.setAttributeNS(None, 'target', '_blank')
92: l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
1.6 abukhman 93: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 94: pagedivs = pagedom.xpath("//div[@class='queryResultMorphExpansion']")
95: return serializeNode(pagenode)
96: if (queryType=="ftIndex")or(queryType=="ftIndexMorph"):
97: pagedivs= pagedom.xpath("//div[@class='queryResultPage']")
98: if len(pagedivs)>0:
99: pagenode=pagedivs[0]
100: links=pagenode.xpath("//a")
101: for l in links:
102: hrefNode = l.getAttributeNodeNS(None, u"href")
103: if hrefNode:
104: href = hrefNode.nodeValue
1.18 abukhman 105: hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn))
1.2 casties 106: if href.startswith('../lt/lex.xql'):
107: hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl)
108: l.setAttributeNS(None, 'target', '_blank')
109: l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
1.6 abukhman 110: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 111: if href.startswith('../lt/lemma.xql'):
112: hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl)
113: l.setAttributeNS(None, 'target', '_blank')
114: l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
1.6 abukhman 115: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 116: return serializeNode(pagenode)
117: return "no text here"
118:
1.58 abukhman 119: """def getNumPages(self, docinfo):
120: ""get list of pages from fulltext and put in docinfo""
1.2 casties 121: if 'numPages' in docinfo:
122: # already there
1.43 abukhman 123: return docinfo
1.2 casties 124: xquery = '//pb'
125: text = self.getServerData("xquery.xql","document=%s&xquery=%s"%(docinfo['textURLPath'],xquery))
126: docinfo['numPages'] = text.count("<pb ")
127: return docinfo
1.58 abukhman 128: """
1.43 abukhman 129: def getNumTextPages (self, docinfo):
130: """get list of pages from fulltext (texts without images) and put in docinfo"""
1.56 abukhman 131: if 'numPages' in docinfo:
1.43 abukhman 132: # allredy there
1.56 abukhman 133: return docinfo
134: xpath ='/count(//pb)'
135: text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'], xpath))
136: dom = Parse(text)
137: result= dom.xpath("//result/resultPage")
1.202 abukhman 138:
1.56 abukhman 139: docinfo['numPages']=int(getTextFromNode(result[0]))
1.43 abukhman 140: return docinfo
1.58 abukhman 141:
1.204 ! abukhman 142: #def getQueryResultHits(self, docinfo=None, pageinfo=None):
! 143:
! 144:
1.89 abukhman 145: def getGisPlaces(self, docinfo=None, pageinfo=None):
1.58 abukhman 146: """ Show all Gis Places of whole Page"""
1.100 abukhman 147: xpath='//place'
1.89 abukhman 148: docpath = docinfo['textURLPath']
149: url = docinfo['url']
150: selfurl = self.absolute_url()
1.93 abukhman 151: pn = pageinfo['current']
1.127 abukhman 152: hrefList=[]
1.142 abukhman 153: myList= ""
1.100 abukhman 154: text=self.getServerData("xpath.xql", "document=%s&xpath=%s&pn=%s"%(docinfo['textURLPath'],xpath,pn))
155: dom = Parse(text)
1.101 abukhman 156: result = dom.xpath("//result/resultPage/place")
1.72 abukhman 157: for l in result:
1.86 abukhman 158: hrefNode= l.getAttributeNodeNS(None, u"id")
1.108 abukhman 159: href= hrefNode.nodeValue
1.128 abukhman 160: hrefList.append(href)
1.145 abukhman 161: myList = ",".join(hrefList)
162: logging.debug("getGisPlaces :%s"%(myList))
1.143 abukhman 163: return myList
164:
165: def getAllGisPlaces (self, docinfo=None, pageinfo=None):
166: """Show all Gis Places of whole Book """
167: xpath ='//echo:place'
168: docpath =docinfo['textURLPath']
169: url = docinfo['url']
170: selfurl =self.absolute_url()
171: pn =pageinfo['current']
172: hrefList=[]
173: myList=""
174: text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'],xpath))
175: dom =Parse(text)
176: result = dom.xpath("//result/resultPage/place")
177: for l in result:
178: hrefNode = l.getAttributeNodeNS(None, u"id")
179: href= hrefNode.nodeValue
180: hrefList.append(href)
1.136 abukhman 181: myList = ",".join(hrefList)
1.145 abukhman 182: logging.debug("getALLGisPlaces :%s"%(myList))
183: return myList
184:
1.200 abukhman 185:
186: def getPDF (self, docinfo=None, pageinfo=None):
187: """Show and Save different Pages as PDF in Options"""
188: selfurl=self.absolute_url()
189: pn=pageinfo['current']
190:
1.201 abukhman 191: viewMode =pageinfo['viewMode']
192:
193: #text = ("page-fragment.xql","document=%s&mode=%s&pn=%s&export=%s"%(docinfo['textURLPath'], 'text', pn,'pdf'))
194: #text = self.getServerData("page-fragment.xql", "document=%s&mode=%s&pn=%s&export=%s"(docinfo['textURLPath'],'text', pn,'pdf'))
195: #logging.debug("text :%s"%(text))
196: #dom =Parse(text)
197: #logging.debug("text :%s"%(text))
1.202 abukhman 198: #return text
199:
1.183 abukhman 200: def getOrigPages (self, docinfo=None, pageinfo=None):
1.146 abukhman 201: """Show original page """
1.183 abukhman 202: docpath = docinfo['textURLPath']
1.201 abukhman 203: logging.debug ("docinfo['textURLPath']=%s"%(docinfo['textURLPath']))
1.181 abukhman 204: #url = docinfo['url']
1.146 abukhman 205: selfurl = self.absolute_url()
1.174 abukhman 206: pn =pageinfo['current']
1.161 abukhman 207:
1.174 abukhman 208: viewMode= pageinfo['viewMode']
209: text = self.getServerData("page-fragment.xql","document=%s&mode=%s&pn=%s"%(docinfo['textURLPath'], 'text', pn))
1.146 abukhman 210: dom =Parse(text)
211: pagedivs = dom.xpath("//div[@class='pageNumberOrig']")
1.184 abukhman 212: logging.debug("YYYYYYpagedivs :%s"%(pagedivs))
1.160 abukhman 213: if len(pagedivs)>0:
1.183 abukhman 214: originalPage= getTextFromNode(pagedivs[0])
1.181 abukhman 215: #return docinfo['originalPage']
1.179 abukhman 216: return originalPage
1.183 abukhman 217:
1.184 abukhman 218:
1.203 abukhman 219: def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="", highlightQuery=None, sn=None, optionsClose=None):
1.2 casties 220: """returns single page from fulltext"""
221: docpath = docinfo['textURLPath']
222: path = docinfo['textURLPath']
223: url = docinfo['url']
1.73 abukhman 224: name = docinfo['name']
1.2 casties 225: viewMode= pageinfo['viewMode']
1.196 abukhman 226: sn = pageinfo['sn']
1.187 abukhman 227: highlightQuery = pageinfo['highlightQuery']
1.196 abukhman 228:
1.2 casties 229: tocMode = pageinfo['tocMode']
1.20 abukhman 230: characterNormalization=pageinfo['characterNormalization']
1.2 casties 231: tocPN = pageinfo['tocPN']
232: selfurl = self.absolute_url()
233: if mode == "text_dict":
234: textmode = "textPollux"
235: else:
236: textmode = mode
1.196 abukhman 237: #logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.193 abukhman 238: textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)
1.190 abukhman 239: if highlightQuery is not None:
1.196 abukhman 240: textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn)
1.198 abukhman 241: #logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.38 abukhman 242: pagexml = self.getServerData("page-fragment.xql",textParam)
1.198 abukhman 243: logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.2 casties 244: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/page-fragment.xql", textParam, outputUnicode=False)
245:
1.39 abukhman 246: pagedom = Parse(pagexml)
1.2 casties 247: # plain text mode
248: if mode == "text":
249: # first div contains text
250: pagedivs = pagedom.xpath("/div")
251: if len(pagedivs) > 0:
252: pagenode = pagedivs[0]
253: links = pagenode.xpath("//a")
254: for l in links:
255: hrefNode = l.getAttributeNodeNS(None, u"href")
256: if hrefNode:
257: href= hrefNode.nodeValue
258: if href.startswith('#note-'):
1.27 abukhman 259: hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
1.2 casties 260: return serializeNode(pagenode)
261: if mode == "xml":
262: # first div contains text
263: pagedivs = pagedom.xpath("/div")
264: if len(pagedivs) > 0:
265: pagenode = pagedivs[0]
266: return serializeNode(pagenode)
1.7 abukhman 267: if mode == "gis":
268: # first div contains text
269: pagedivs = pagedom.xpath("/div")
270: if len(pagedivs) > 0:
271: pagenode = pagedivs[0]
1.28 abukhman 272: links =pagenode.xpath("//a")
273: for l in links:
274: hrefNode =l.getAttributeNodeNS(None, u"href")
275: if hrefNode:
276: href=hrefNode.nodeValue
277: if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'):
1.75 abukhman 278: hrefNode.nodeValue =href.replace('chinagis_REST/REST/db/chgis/mpdl','chinagis/REST/db/mpdl/%s'%name)
1.62 abukhman 279: l.setAttributeNS(None, 'target', '_blank')
1.61 abukhman 280: return serializeNode(pagenode)
1.7 abukhman 281:
1.2 casties 282: if mode == "pureXml":
283: # first div contains text
284: pagedivs = pagedom.xpath("/div")
285: if len(pagedivs) > 0:
286: pagenode = pagedivs[0]
287: return serializeNode(pagenode)
288: # text-with-links mode
289: if mode == "text_dict":
290: # first div contains text
291: pagedivs = pagedom.xpath("/div")
292: if len(pagedivs) > 0:
293: pagenode = pagedivs[0]
294: # check all a-tags
295: links = pagenode.xpath("//a")
296: for l in links:
297: hrefNode = l.getAttributeNodeNS(None, u"href")
298: if hrefNode:
299: # is link with href
300: href = hrefNode.nodeValue
301: if href.startswith('lt/lex.xql'):
302: # is pollux link
303: selfurl = self.absolute_url()
304: # change href
305: hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)
306: # add target
307: l.setAttributeNS(None, 'target', '_blank')
308: l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")
1.6 abukhman 309: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 310: if href.startswith('lt/lemma.xql'):
311: selfurl = self.absolute_url()
312: hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)
313: l.setAttributeNS(None, 'target', '_blank')
314: l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")
1.6 abukhman 315: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 316: if href.startswith('#note-'):
1.19 abukhman 317: hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
1.2 casties 318: return serializeNode(pagenode)
319: return "no text here"
320:
321: def getTranslate(self, query=None, language=None):
322: """translate into another languages"""
1.5 casties 323: data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query))
1.2 casties 324: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lex.xql","document=&language="+str(language)+"&query="+url_quote(str(query)))
325: return data
326:
327: def getLemma(self, lemma=None, language=None):
328: """simular words lemma """
1.5 casties 329: data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(lemma))
1.2 casties 330: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(lemma)))
331: return data
332:
333: def getLemmaNew(self, query=None, language=None):
334: """simular words lemma """
1.5 casties 335: data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(query))
1.2 casties 336: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query)))
337: return data
1.28 abukhman 338:
1.203 abukhman 339: def getQuery (self, docinfo=None, pageinfo=None, query=None, queryType=None, pn=1, optionsClose=None):
1.2 casties 340: """number of"""
341: docpath = docinfo['textURLPath']
342: pagesize = pageinfo['queryPageSize']
343: pn = pageinfo['searchPN']
1.34 abukhman 344: query =pageinfo['query']
1.2 casties 345: queryType =pageinfo['queryType']
346: tocSearch = 0
347: tocDiv = None
348:
1.32 abukhman 349: pagexml = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn))
1.2 casties 350: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath, 'text', queryType, query, pagesize, pn) ,outputUnicode=False)
351: pagedom = Parse(pagexml)
352: numdivs = pagedom.xpath("//div[@class='queryResultHits']")
353: tocSearch = int(getTextFromNode(numdivs[0]))
1.204 ! abukhman 354: logging.debug("documentViewer (gettoc) tocSearch: %s"%(tocSearch))
1.2 casties 355: tc=int((tocSearch/10)+1)
1.23 abukhman 356: logging.debug("documentViewer (gettoc) tc: %s"%(tc))
1.2 casties 357: return tc
358:
359: def getToc(self, mode="text", docinfo=None):
360: """loads table of contents and stores in docinfo"""
1.23 abukhman 361: logging.debug("documentViewer (gettoc) mode: %s"%(mode))
1.2 casties 362: if mode == "none":
363: return docinfo
364: if 'tocSize_%s'%mode in docinfo:
365: # cached toc
366: return docinfo
367:
368: docpath = docinfo['textURLPath']
369: # we need to set a result set size
370: pagesize = 1000
371: pn = 1
372: if mode == "text":
373: queryType = "toc"
374: else:
375: queryType = mode
376: # number of entries in toc
377: tocSize = 0
378: tocDiv = None
379:
380: pagexml = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))
381: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql", "document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType,pagesize,pn), outputUnicode=False)
382: # post-processing downloaded xml
383: pagedom = Parse(pagexml)
384: # get number of entries
385: numdivs = pagedom.xpath("//div[@class='queryResultHits']")
386: if len(numdivs) > 0:
387: tocSize = int(getTextFromNode(numdivs[0]))
388: docinfo['tocSize_%s'%mode] = tocSize
389: return docinfo
390:
391: def getTocPage(self, mode="text", pn=1, pageinfo=None, docinfo=None):
392: """returns single page from the table of contents"""
393: # TODO: this should use the cached TOC
394: if mode == "text":
395: queryType = "toc"
396: else:
397: queryType = mode
398: docpath = docinfo['textURLPath']
399: path = docinfo['textURLPath']
400: pagesize = pageinfo['tocPageSize']
401: pn = pageinfo['tocPN']
402: url = docinfo['url']
403: selfurl = self.absolute_url()
404: viewMode= pageinfo['viewMode']
1.26 abukhman 405: characterNormalization = pageinfo ['characterNormalization']
1.2 casties 406: tocMode = pageinfo['tocMode']
407: tocPN = pageinfo['tocPN']
408:
1.23 abukhman 409: data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=%s"%(docpath,queryType, pagesize, pn,characterNormalization))
410: page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s'%(selfurl,url, viewMode, tocMode, tocPN))
1.2 casties 411: text = page.replace('mode=image','mode=texttool')
1.21 abukhman 412: logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))
1.19 abukhman 413: #logging.debug("documentViewer (characterNormalization) text: %s"%(text))
1.2 casties 414: return text
415:
416: def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
417: """change settings"""
418: self.title=title
419: self.timeout = timeout
420: self.serverUrl = serverUrl
421: if RESPONSE is not None:
422: RESPONSE.redirect('manage_main')
423:
424: # management methods
425: def manage_addMpdlXmlTextServerForm(self):
426: """Form for adding"""
427: pt = PageTemplateFile("zpt/manage_addMpdlXmlTextServer", globals()).__of__(self)
428: return pt()
429:
430: def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
431: """add zogiimage"""
432: newObj = MpdlXmlTextServer(id,title,serverUrl,timeout)
433: self.Destination()._setObject(id, newObj)
434: if RESPONSE is not None:
435: RESPONSE.redirect('manage_main')
436:
437:
1.4 casties 438:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>