annotate MpdlXmlTextServer.py @ 495:ede0c93de798 metalify-1

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