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