annotate MpdlXmlTextServer.py @ 496:f83ffab77502 metalify-1

last version from HEAD new zogilib version
author casties
date Fri, 18 Jun 2010 21:41:28 +0200
parents ede0c93de798
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
1
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
2 from OFS.SimpleItem import SimpleItem
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
3 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
4
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
5 from Ft.Xml import EMPTY_NAMESPACE, Parse
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
6
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
7 import sys
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
8 import logging
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
9 import urllib
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
10 import documentViewer
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
11 from documentViewer import getTextFromNode, serializeNode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
12
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
13
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
14 class MpdlXmlTextServer(SimpleItem):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
15 """TextServer implementation for MPDL-XML eXist server"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
16 meta_type="MPDL-XML TextServer"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
17
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
18 manage_options=(
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
19 {'label':'Config','action':'manage_changeMpdlXmlTextServerForm'},
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
20 )+SimpleItem.manage_options
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
21
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
22 manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
23
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
24 def __init__(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
25 """constructor"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
26 self.id=id
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
27 self.title=title
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
28 self.timeout = timeout
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
29 if serverName is None:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
30 self.serverUrl = serverUrl
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
31 else:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
32 self.serverUrl = "http://%s/mpdl/interface/"%serverName
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
33
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
34
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
35 def getHttpData(self, url, data=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
36 """returns result from url+data HTTP request"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
37 return documentViewer.getHttpData(url,data,timeout=self.timeout)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
38
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
39
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
40 def getServerData(self, method, data=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
41 """returns result from text server for method+data"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
42 url = self.serverUrl+method
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
43 return documentViewer.getHttpData(url,data,timeout=self.timeout)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
44
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
45
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
46 def getSearch(self, pn=1, pageinfo=None, docinfo=None, query=None, queryType=None, lemma=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
47 """get search list"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
48 docpath = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
49 url = docinfo['url']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
50 logging.debug("documentViewer (gettoc) docpath: %s"%(docpath))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
51 logging.debug("documentViewer (gettoc) url: %s"%(url))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
52 pagesize = pageinfo['queryPageSize']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
53 pn = pageinfo['searchPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
54 sn = pageinfo['sn']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
55 highlightQuery = pageinfo['highlightQuery']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
56 query =pageinfo['query']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
57 queryType =pageinfo['queryType']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
58 viewMode= pageinfo['viewMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
59 tocMode = pageinfo['tocMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
60 tocPN = pageinfo['tocPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
61 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
62
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
63 data = self.getServerData("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))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
64 #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)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
65
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
66 pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
67 pagedom = Parse(pagexml)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
68 if (queryType=="fulltext")or(queryType=="xpath")or(queryType=="xquery")or(queryType=="fulltextMorphLemma"):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
69 pagedivs = pagedom.xpath("//div[@class='queryResultPage']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
70 if len(pagedivs)>0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
71 pagenode=pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
72 links=pagenode.xpath("//a")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
73 for l in links:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
74 hrefNode = l.getAttributeNodeNS(None, u"href")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
75 if hrefNode:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
76 href = hrefNode.nodeValue
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
77 if href.startswith('page-fragment.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
78 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
79 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,query,pagesize,pn,tocMode,pn,tocPN))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
80 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
81 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
82 if (queryType=="fulltextMorph"):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
83 pagedivs = pagedom.xpath("//div[@class='queryResult']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
84 if len(pagedivs)>0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
85 pagenode=pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
86 links=pagenode.xpath("//a")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
87 for l in links:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
88 hrefNode = l.getAttributeNodeNS(None, u"href")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
89 if hrefNode:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
90 href = hrefNode.nodeValue
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
91 if href.startswith('page-fragment.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
92 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
93 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,query,pagesize,pn,tocMode,pn,tocPN))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
94 hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
95 if href.startswith('../lt/lemma.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
96 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma_New'%(selfurl))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
97 l.setAttributeNS(None, 'target', '_blank')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
98 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
99 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
100 pagedivs = pagedom.xpath("//div[@class='queryResultMorphExpansion']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
101 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
102 if (queryType=="ftIndex")or(queryType=="ftIndexMorph"):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
103 pagedivs= pagedom.xpath("//div[@class='queryResultPage']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
104 if len(pagedivs)>0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
105 pagenode=pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
106 links=pagenode.xpath("//a")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
107 for l in links:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
108 hrefNode = l.getAttributeNodeNS(None, u"href")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
109 if hrefNode:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
110 href = hrefNode.nodeValue
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
111 hrefNode.nodeValue=href.replace('mode=text','mode=texttool&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s'%(viewMode,tocMode,tocPN,pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
112 if href.startswith('../lt/lex.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
113 hrefNode.nodeValue = href.replace('../lt/lex.xql','%s/template/head_main_voc'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
114 l.setAttributeNS(None, 'target', '_blank')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
115 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
116 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
117 if href.startswith('../lt/lemma.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
118 hrefNode.nodeValue = href.replace('../lt/lemma.xql','%s/template/head_main_lemma'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
119 l.setAttributeNS(None, 'target', '_blank')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
120 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=400, scrollbars=1'); return false;")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
121 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
122 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
123 return "no text here"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
124
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
125 def getNumPages(self, docinfo):
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
126 """get list of pages from fulltext and put in docinfo"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
127 if 'numPages' in docinfo:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
128 # already there
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
129 return docinfo
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
130
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
131 xquery = '//pb'
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
132 text = self.getServerData("xquery.xql","document=%s&xquery=%s"%(docinfo['textURLPath'],xquery))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
133 #text = self.template.fulltextclient.eval("/mpdl/interface/xquery.xql", "document=%s&xquery=%s"%(docinfo['textURLPath'],xquery))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
134 docinfo['numPages'] = text.count("<pb ")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
135 return docinfo
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
136
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
137 def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
138 """returns single page from fulltext"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
139 docpath = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
140 path = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
141 url = docinfo['url']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
142 viewMode= pageinfo['viewMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
143 tocMode = pageinfo['tocMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
144 tocPN = pageinfo['tocPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
145 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
146 if mode == "text_dict":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
147 textmode = "textPollux"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
148 else:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
149 textmode = mode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
150
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
151 textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
152 if highlightQuery is not None:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
153 textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
154
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
155 pagexml = self.getServerData("page-fragment.xql",textParam)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
156 #pagexml=self.template.fulltextclient.eval("/mpdl/interface/page-fragment.xql", textParam, outputUnicode=False)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
157
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
158 pagedom = Parse(pagexml)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
159 # plain text mode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
160 if mode == "text":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
161 # first div contains text
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
162 pagedivs = pagedom.xpath("/div")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
163 if len(pagedivs) > 0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
164 pagenode = pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
165 links = pagenode.xpath("//a")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
166 for l in links:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
167 hrefNode = l.getAttributeNodeNS(None, u"href")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
168 if hrefNode:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
169 href= hrefNode.nodeValue
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
170 if href.startswith('#note-'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
171 hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
172 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
173 if mode == "xml":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
174 # first div contains text
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
175 pagedivs = pagedom.xpath("/div")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
176 if len(pagedivs) > 0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
177 pagenode = pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
178 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
179 if mode == "pureXml":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
180 # first div contains text
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
181 pagedivs = pagedom.xpath("/div")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
182 if len(pagedivs) > 0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
183 pagenode = pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
184 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
185 # text-with-links mode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
186 if mode == "text_dict":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
187 # first div contains text
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
188 pagedivs = pagedom.xpath("/div")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
189 if len(pagedivs) > 0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
190 pagenode = pagedivs[0]
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
191 # check all a-tags
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
192 links = pagenode.xpath("//a")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
193 for l in links:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
194 hrefNode = l.getAttributeNodeNS(None, u"href")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
195 if hrefNode:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
196 # is link with href
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
197 href = hrefNode.nodeValue
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
198 if href.startswith('lt/lex.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
199 # is pollux link
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
200 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
201 # change href
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
202 hrefNode.nodeValue = href.replace('lt/lex.xql','%s/template/head_main_voc'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
203 # add target
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
204 l.setAttributeNS(None, 'target', '_blank')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
205 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
206 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
207 if href.startswith('lt/lemma.xql'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
208 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
209 hrefNode.nodeValue = href.replace('lt/lemma.xql','%s/template/head_main_lemma'%selfurl)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
210 l.setAttributeNS(None, 'target', '_blank')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
211 l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
212 l.setAttributeNS(None, 'onDblclick', 'popupWin.focus();')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
213 if href.startswith('#note-'):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
214 hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
215 return serializeNode(pagenode)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
216 return "no text here"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
217
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
218 def getTranslate(self, query=None, language=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
219 """translate into another languages"""
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
220 data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query))
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
221 #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lex.xql","document=&language="+str(language)+"&query="+url_quote(str(query)))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
222 return data
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
223
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
224 def getLemma(self, lemma=None, language=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
225 """simular words lemma """
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
226 data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(lemma))
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
227 #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(lemma)))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
228 return data
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
229
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
230 def getLemmaNew(self, query=None, language=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
231 """simular words lemma """
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
232 data = self.getServerData("lt/lemma.xql","document=&language="+str(language)+"&lemma="+urllib.quote(query))
495
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
233 #pagexml=self.template.fulltextclient.eval("/mpdl/interface/lt/lemma.xql","document=&language="+str(language)+"&lemma="+url_quote(str(query)))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
234 return data
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
235
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
236 def getQuery (self, docinfo=None, pageinfo=None, query=None, queryType=None, pn=1):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
237 """number of"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
238 docpath = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
239 pagesize = pageinfo['queryPageSize']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
240 pn = pageinfo['searchPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
241 query =pageinfo['query']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
242 queryType =pageinfo['queryType']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
243 tocSearch = 0
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
244 tocDiv = None
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
245
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
246 pagexml = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath, 'text', queryType, query, pagesize, pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
247 #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)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
248 pagedom = Parse(pagexml)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
249 numdivs = pagedom.xpath("//div[@class='queryResultHits']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
250 tocSearch = int(getTextFromNode(numdivs[0]))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
251 tc=int((tocSearch/10)+1)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
252 logging.debug("documentViewer (gettoc) tc: %s"%(tc))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
253 return tc
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
254
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
255 def getToc(self, mode="text", docinfo=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
256 """loads table of contents and stores in docinfo"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
257 logging.debug("documentViewer (gettoc) mode: %s"%(mode))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
258 if mode == "none":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
259 return docinfo
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
260 if 'tocSize_%s'%mode in docinfo:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
261 # cached toc
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
262 return docinfo
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
263
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
264 docpath = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
265 # we need to set a result set size
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
266 pagesize = 1000
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
267 pn = 1
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
268 if mode == "text":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
269 queryType = "toc"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
270 else:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
271 queryType = mode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
272 # number of entries in toc
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
273 tocSize = 0
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
274 tocDiv = None
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
275
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
276 pagexml = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
277 #pagexml=self.template.fulltextclient.eval("/mpdl/interface/doc-query.xql", "document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType,pagesize,pn), outputUnicode=False)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
278 # post-processing downloaded xml
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
279 pagedom = Parse(pagexml)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
280 # get number of entries
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
281 numdivs = pagedom.xpath("//div[@class='queryResultHits']")
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
282 if len(numdivs) > 0:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
283 tocSize = int(getTextFromNode(numdivs[0]))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
284 docinfo['tocSize_%s'%mode] = tocSize
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
285 return docinfo
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
286
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
287 def getTocPage(self, mode="text", pn=1, pageinfo=None, docinfo=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
288 """returns single page from the table of contents"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
289 # TODO: this should use the cached TOC
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
290 if mode == "text":
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
291 queryType = "toc"
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
292 else:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
293 queryType = mode
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
294 docpath = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
295 path = docinfo['textURLPath']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
296 pagesize = pageinfo['tocPageSize']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
297 pn = pageinfo['tocPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
298 url = docinfo['url']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
299 selfurl = self.absolute_url()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
300 viewMode= pageinfo['viewMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
301 tocMode = pageinfo['tocMode']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
302 tocPN = pageinfo['tocPN']
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
303
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
304 data = self.getServerData("doc-query.xql","document=%s&queryType=%s&queryResultPageSize=%s&queryResultPN=%s"%(docpath,queryType, pagesize, pn))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
305
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
306 page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s'%(selfurl,url, viewMode, tocMode, tocPN))
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
307 text = page.replace('mode=image','mode=texttool')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
308 return text
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
309
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
310 def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
311 """change settings"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
312 self.title=title
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
313 self.timeout = timeout
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
314 self.serverUrl = serverUrl
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
315 if RESPONSE is not None:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
316 RESPONSE.redirect('manage_main')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
317
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
318 # management methods
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
319 def manage_addMpdlXmlTextServerForm(self):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
320 """Form for adding"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
321 pt = PageTemplateFile("zpt/manage_addMpdlXmlTextServer", globals()).__of__(self)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
322 return pt()
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
323
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
324 def manage_addMpdlXmlTextServer(self,id,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
325 """add zogiimage"""
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
326 newObj = MpdlXmlTextServer(id,title,serverUrl,timeout)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
327 self.Destination()._setObject(id, newObj)
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
328 if RESPONSE is not None:
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
329 RESPONSE.redirect('manage_main')
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
330
ede0c93de798 update branch to latest version of HEAD (with modularisierung branch)
casties
parents:
diff changeset
331
496
f83ffab77502 last version from HEAD
casties
parents: 495
diff changeset
332