Annotation of documentViewer/MpdlXmlTextServer.py, revision 1.201
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.186 abukhman 41: def getSearch(self, pn=1, pageinfo=None, docinfo=None, query=None, queryType=None, lemma=None, characterNormalization=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")
138: docinfo['numPages']=int(getTextFromNode(result[0]))
1.43 abukhman 139: return docinfo
1.58 abukhman 140:
1.89 abukhman 141: def getGisPlaces(self, docinfo=None, pageinfo=None):
1.58 abukhman 142: """ Show all Gis Places of whole Page"""
1.100 abukhman 143: xpath='//place'
1.89 abukhman 144: docpath = docinfo['textURLPath']
145: url = docinfo['url']
146: selfurl = self.absolute_url()
1.93 abukhman 147: pn = pageinfo['current']
1.127 abukhman 148: hrefList=[]
1.142 abukhman 149: myList= ""
1.100 abukhman 150: text=self.getServerData("xpath.xql", "document=%s&xpath=%s&pn=%s"%(docinfo['textURLPath'],xpath,pn))
151: dom = Parse(text)
1.101 abukhman 152: result = dom.xpath("//result/resultPage/place")
1.72 abukhman 153: for l in result:
1.86 abukhman 154: hrefNode= l.getAttributeNodeNS(None, u"id")
1.108 abukhman 155: href= hrefNode.nodeValue
1.128 abukhman 156: hrefList.append(href)
1.145 abukhman 157: myList = ",".join(hrefList)
158: logging.debug("getGisPlaces :%s"%(myList))
1.143 abukhman 159: return myList
160:
161: def getAllGisPlaces (self, docinfo=None, pageinfo=None):
162: """Show all Gis Places of whole Book """
163: xpath ='//echo:place'
164: docpath =docinfo['textURLPath']
165: url = docinfo['url']
166: selfurl =self.absolute_url()
167: pn =pageinfo['current']
168: hrefList=[]
169: myList=""
170: text=self.getServerData("xpath.xql", "document=%s&xpath=%s"%(docinfo['textURLPath'],xpath))
171: dom =Parse(text)
172: result = dom.xpath("//result/resultPage/place")
173: for l in result:
174: hrefNode = l.getAttributeNodeNS(None, u"id")
175: href= hrefNode.nodeValue
176: hrefList.append(href)
1.136 abukhman 177: myList = ",".join(hrefList)
1.145 abukhman 178: logging.debug("getALLGisPlaces :%s"%(myList))
179: return myList
180:
1.200 abukhman 181:
182: def getPDF (self, docinfo=None, pageinfo=None):
183: """Show and Save different Pages as PDF in Options"""
184: selfurl=self.absolute_url()
185: pn=pageinfo['current']
186:
1.201 ! abukhman 187: viewMode =pageinfo['viewMode']
! 188:
! 189: #text = ("page-fragment.xql","document=%s&mode=%s&pn=%s&export=%s"%(docinfo['textURLPath'], 'text', pn,'pdf'))
! 190: #text = self.getServerData("page-fragment.xql", "document=%s&mode=%s&pn=%s&export=%s"(docinfo['textURLPath'],'text', pn,'pdf'))
! 191: #logging.debug("text :%s"%(text))
! 192: #dom =Parse(text)
! 193: #logging.debug("text :%s"%(text))
! 194: #return text
! 195:
! 196: def getBrowserType(self):
! 197: """get browser type object"""
! 198: if self.REQUEST.SESSION.has_key('browserType'):
! 199: return self.REQUEST.SESSION['browserType']
! 200: else:
! 201: bt = browserCheck(self)
! 202: self.REQUEST.SESSION.set('browserType', bt)
! 203: logging.debug("documentViewer (BROWSER TYPE) bt %s"%bt)
! 204: return bt
! 205:
1.200 abukhman 206:
1.183 abukhman 207: def getOrigPages (self, docinfo=None, pageinfo=None):
1.146 abukhman 208: """Show original page """
1.183 abukhman 209: docpath = docinfo['textURLPath']
1.201 ! abukhman 210: logging.debug ("docinfo['textURLPath']=%s"%(docinfo['textURLPath']))
1.181 abukhman 211: #url = docinfo['url']
1.146 abukhman 212: selfurl = self.absolute_url()
1.174 abukhman 213: pn =pageinfo['current']
1.161 abukhman 214:
1.174 abukhman 215: viewMode= pageinfo['viewMode']
216: text = self.getServerData("page-fragment.xql","document=%s&mode=%s&pn=%s"%(docinfo['textURLPath'], 'text', pn))
1.146 abukhman 217: dom =Parse(text)
218: pagedivs = dom.xpath("//div[@class='pageNumberOrig']")
1.184 abukhman 219: logging.debug("YYYYYYpagedivs :%s"%(pagedivs))
1.160 abukhman 220: if len(pagedivs)>0:
1.183 abukhman 221: originalPage= getTextFromNode(pagedivs[0])
1.181 abukhman 222: #return docinfo['originalPage']
1.179 abukhman 223: return originalPage
1.183 abukhman 224:
1.184 abukhman 225:
1.199 abukhman 226: def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="", highlightQuery=None, sn=None):
1.2 casties 227: """returns single page from fulltext"""
228: docpath = docinfo['textURLPath']
229: path = docinfo['textURLPath']
230: url = docinfo['url']
1.73 abukhman 231: name = docinfo['name']
1.2 casties 232: viewMode= pageinfo['viewMode']
1.196 abukhman 233: sn = pageinfo['sn']
1.187 abukhman 234: highlightQuery = pageinfo['highlightQuery']
1.196 abukhman 235:
1.2 casties 236: tocMode = pageinfo['tocMode']
1.20 abukhman 237: characterNormalization=pageinfo['characterNormalization']
1.2 casties 238: tocPN = pageinfo['tocPN']
239: selfurl = self.absolute_url()
240: if mode == "text_dict":
241: textmode = "textPollux"
242: else:
243: textmode = mode
1.196 abukhman 244: #logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.193 abukhman 245: textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)
1.190 abukhman 246: if highlightQuery is not None:
1.196 abukhman 247: textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn)
1.198 abukhman 248: #logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.38 abukhman 249: pagexml = self.getServerData("page-fragment.xql",textParam)
1.198 abukhman 250: logging.debug("documentViewer highlightQuery: %s"%(highlightQuery))
1.2 casties 251: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/page-fragment.xql", textParam, outputUnicode=False)
252:
1.39 abukhman 253: pagedom = Parse(pagexml)
1.2 casties 254: # plain text mode
255: if mode == "text":
256: # first div contains text
257: pagedivs = pagedom.xpath("/div")
258: if len(pagedivs) > 0:
259: pagenode = pagedivs[0]
260: links = pagenode.xpath("//a")
261: for l in links:
262: hrefNode = l.getAttributeNodeNS(None, u"href")
263: if hrefNode:
264: href= hrefNode.nodeValue
265: if href.startswith('#note-'):
1.27 abukhman 266: hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
1.2 casties 267: return serializeNode(pagenode)
268: if mode == "xml":
269: # first div contains text
270: pagedivs = pagedom.xpath("/div")
271: if len(pagedivs) > 0:
272: pagenode = pagedivs[0]
273: return serializeNode(pagenode)
1.7 abukhman 274: if mode == "gis":
275: # first div contains text
276: pagedivs = pagedom.xpath("/div")
277: if len(pagedivs) > 0:
278: pagenode = pagedivs[0]
1.28 abukhman 279: links =pagenode.xpath("//a")
280: for l in links:
281: hrefNode =l.getAttributeNodeNS(None, u"href")
282: if hrefNode:
283: href=hrefNode.nodeValue
284: if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'):
1.75 abukhman 285: hrefNode.nodeValue =href.replace('chinagis_REST/REST/db/chgis/mpdl','chinagis/REST/db/mpdl/%s'%name)
1.62 abukhman 286: l.setAttributeNS(None, 'target', '_blank')
1.61 abukhman 287: return serializeNode(pagenode)
1.7 abukhman 288:
1.2 casties 289: if mode == "pureXml":
290: # first div contains text
291: pagedivs = pagedom.xpath("/div")
292: if len(pagedivs) > 0:
293: pagenode = pagedivs[0]
294: return serializeNode(pagenode)
295: # text-with-links mode
296: if mode == "text_dict":
297: # first div contains text
298: pagedivs = pagedom.xpath("/div")
299: if len(pagedivs) > 0:
300: pagenode = pagedivs[0]
301: # check all a-tags
302: links = pagenode.xpath("//a")
303: for l in links:
304: hrefNode = l.getAttributeNodeNS(None, u"href")
305: if hrefNode:
306: # is link with href
307: href = hrefNode.nodeValue
308: if href.startswith('lt/lex.xql'):
309: # is pollux link
310: selfurl = self.absolute_url()
311: # change href
312: hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)
313: # add target
314: l.setAttributeNS(None, 'target', '_blank')
315: 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 316: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 317: if href.startswith('lt/lemma.xql'):
318: selfurl = self.absolute_url()
319: hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)
320: l.setAttributeNS(None, 'target', '_blank')
321: 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 322: l.setAttributeNS(None, 'onClick', 'popupWin.focus();')
1.2 casties 323: if href.startswith('#note-'):
1.19 abukhman 324: hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
1.2 casties 325: return serializeNode(pagenode)
326: return "no text here"
327:
328: def getTranslate(self, query=None, language=None):
329: """translate into another languages"""
1.5 casties 330: data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query))
1.2 casties 331: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lex.xql","document=&language="+str(language)+"&query="+url_quote(str(query)))
332: return data
333:
334: def getLemma(self, lemma=None, language=None):
335: """simular words lemma """
1.5 casties 336: data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(lemma))
1.2 casties 337: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(lemma)))
338: return data
339:
340: def getLemmaNew(self, query=None, language=None):
341: """simular words lemma """
1.5 casties 342: data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(query))
1.2 casties 343: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query)))
344: return data
1.28 abukhman 345:
1.2 casties 346: def getQuery (self, docinfo=None, pageinfo=None, query=None, queryType=None, pn=1):
347: """number of"""
348: docpath = docinfo['textURLPath']
349: pagesize = pageinfo['queryPageSize']
350: pn = pageinfo['searchPN']
1.34 abukhman 351: query =pageinfo['query']
1.2 casties 352: queryType =pageinfo['queryType']
353: tocSearch = 0
354: tocDiv = None
355:
1.32 abukhman 356: 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 357: #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)
358: pagedom = Parse(pagexml)
359: numdivs = pagedom.xpath("//div[@class='queryResultHits']")
360: tocSearch = int(getTextFromNode(numdivs[0]))
361: tc=int((tocSearch/10)+1)
1.23 abukhman 362: logging.debug("documentViewer (gettoc) tc: %s"%(tc))
1.2 casties 363: return tc
364:
365: def getToc(self, mode="text", docinfo=None):
366: """loads table of contents and stores in docinfo"""
1.23 abukhman 367: logging.debug("documentViewer (gettoc) mode: %s"%(mode))
1.2 casties 368: if mode == "none":
369: return docinfo
370: if 'tocSize_%s'%mode in docinfo:
371: # cached toc
372: return docinfo
373:
374: docpath = docinfo['textURLPath']
375: # we need to set a result set size
376: pagesize = 1000
377: pn = 1
378: if mode == "text":
379: queryType = "toc"
380: else:
381: queryType = mode
382: # number of entries in toc
383: tocSize = 0
384: tocDiv = None
385:
386: pagexml = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))
387: #pagexml=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql", "document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType,pagesize,pn), outputUnicode=False)
388: # post-processing downloaded xml
389: pagedom = Parse(pagexml)
390: # get number of entries
391: numdivs = pagedom.xpath("//div[@class='queryResultHits']")
392: if len(numdivs) > 0:
393: tocSize = int(getTextFromNode(numdivs[0]))
394: docinfo['tocSize_%s'%mode] = tocSize
395: return docinfo
396:
397: def getTocPage(self, mode="text", pn=1, pageinfo=None, docinfo=None):
398: """returns single page from the table of contents"""
399: # TODO: this should use the cached TOC
400: if mode == "text":
401: queryType = "toc"
402: else:
403: queryType = mode
404: docpath = docinfo['textURLPath']
405: path = docinfo['textURLPath']
406: pagesize = pageinfo['tocPageSize']
407: pn = pageinfo['tocPN']
408: url = docinfo['url']
409: selfurl = self.absolute_url()
410: viewMode= pageinfo['viewMode']
1.26 abukhman 411: characterNormalization = pageinfo ['characterNormalization']
1.2 casties 412: tocMode = pageinfo['tocMode']
413: tocPN = pageinfo['tocPN']
414:
1.23 abukhman 415: data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s&characterNormalization=%s"%(docpath,queryType, pagesize, pn,characterNormalization))
416: 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 417: text = page.replace('mode=image','mode=texttool')
1.21 abukhman 418: logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))
1.19 abukhman 419: #logging.debug("documentViewer (characterNormalization) text: %s"%(text))
1.2 casties 420: return text
421:
422: def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
423: """change settings"""
424: self.title=title
425: self.timeout = timeout
426: self.serverUrl = serverUrl
427: if RESPONSE is not None:
428: RESPONSE.redirect('manage_main')
429:
430: # management methods
431: def manage_addMpdlXmlTextServerForm(self):
432: """Form for adding"""
433: pt = PageTemplateFile("zpt/manage_addMpdlXmlTextServer", globals()).__of__(self)
434: return pt()
435:
436: def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
437: """add zogiimage"""
438: newObj = MpdlXmlTextServer(id,title,serverUrl,timeout)
439: self.Destination()._setObject(id, newObj)
440: if RESPONSE is not None:
441: RESPONSE.redirect('manage_main')
442:
443:
1.4 casties 444:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>