version 1.10, 2010/08/19 13:13:27
|
version 1.15, 2010/08/24 09:22:31
|
Line 130 class MpdlXmlTextServer(SimpleItem):
|
Line 130 class MpdlXmlTextServer(SimpleItem):
|
docinfo['numPages'] = text.count("<pb ") |
docinfo['numPages'] = text.count("<pb ") |
return docinfo |
return docinfo |
|
|
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization=""): |
def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, highlightQuery=None,sn=None, viewMode=None, tocMode=None, tocPN=None): |
"""returns single page from fulltext""" |
"""returns single page from fulltext""" |
docpath = docinfo['textURLPath'] |
docpath = docinfo['textURLPath'] |
path = docinfo['textURLPath'] |
path = docinfo['textURLPath'] |
url = docinfo['url'] |
url = docinfo['url'] |
viewMode= pageinfo['viewMode'] |
viewMode= pageinfo['viewMode'] |
tocMode = pageinfo['tocMode'] |
tocMode = pageinfo['tocMode'] |
characterNormalization = pageinfo ['characterNormalization'] |
#characterNormalization = pageinfo ['characterNormalization'] |
tocPN = pageinfo['tocPN'] |
tocPN = pageinfo['tocPN'] |
selfurl = self.absolute_url() |
selfurl = self.absolute_url() |
if mode == "text_dict": |
if mode == "text_dict": |
textmode = "textPollux" |
textmode = "textPollux" |
else: |
else: |
textmode = mode |
textmode = mode |
logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
#logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn) |
textParam = "document=%s&mode=%s&pn=%s"%(docpath,textmode,pn) |
if highlightQuery is not None: |
if highlightQuery is not None: |
textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn) |
textParam +="&highlightQuery=%s&sn=%s"%(highlightQuery,sn) |
Line 165 class MpdlXmlTextServer(SimpleItem):
|
Line 165 class MpdlXmlTextServer(SimpleItem):
|
if hrefNode: |
if hrefNode: |
href= hrefNode.nodeValue |
href= hrefNode.nodeValue |
if href.startswith('#note-'): |
if href.startswith('#note-'): |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&characterNormalization=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,characterNormalization,tocPN,pn)) |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn)) |
return serializeNode(pagenode) |
return serializeNode(pagenode) |
if mode == "xml": |
if mode == "xml": |
# first div contains text |
# first div contains text |
Line 215 class MpdlXmlTextServer(SimpleItem):
|
Line 215 class MpdlXmlTextServer(SimpleItem):
|
l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") |
l.setAttributeNS(None, 'onClick',"popupWin = window.open(this.href, 'contacts', 'location,width=500,height=600,top=180, left=700, scrollbars=1'); return false;") |
l.setAttributeNS(None, 'onClick', 'popupWin.focus();') |
l.setAttributeNS(None, 'onClick', 'popupWin.focus();') |
if href.startswith('#note-'): |
if href.startswith('#note-'): |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&characterNormalization=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,characterNormalization,tocPN,pn)) |
hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,viewMode,tocMode,tocPN,pn)) |
return serializeNode(pagenode) |
return serializeNode(pagenode) |
return "no text here" |
return "no text here" |
|
|
Line 310 class MpdlXmlTextServer(SimpleItem):
|
Line 310 class MpdlXmlTextServer(SimpleItem):
|
|
|
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&characterNormalization=%s'%(selfurl,url, viewMode, tocMode, tocPN, characterNormalization)) |
page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&characterNormalization=%s'%(selfurl,url, viewMode, tocMode, tocPN, characterNormalization)) |
text = page.replace('mode=image','mode=texttool') |
text = page.replace('mode=image','mode=texttool') |
|
logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
|
logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) |
return text |
return text |
|
|
def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |
def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None): |