Mercurial > hg > documentViewer
changeset 428:672f8857ece8
bibliograpfical info
author | abukhman |
---|---|
date | Mon, 14 Feb 2011 15:41:12 +0100 |
parents | 70db19d7b3b1 |
children | ebe50e81710f |
files | MpdlXmlTextServer.py zpt/page_main_double.zpt zpt/page_main_thumbi.zpt |
diffstat | 3 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/MpdlXmlTextServer.py Thu Jan 20 17:04:21 2011 +0100 +++ b/MpdlXmlTextServer.py Mon Feb 14 15:41:12 2011 +0100 @@ -85,6 +85,7 @@ selfurl = self.absolute_url() pagexml=href.replace('mode=text','mode=texttool&viewMode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&tocMode=%s&searchPN=%s&tocPN=%s&optionToggle=%s&characterNormalization=%s'%(viewMode,queryType,urllib.quote(query),pagesize,pn,tocMode,pn,tocPN,optionToggle,characterNormalization)) hrefNode.nodeValue = pagexml.replace('page-fragment.xql','%s'%selfurl) + logging.debug("PUREXML :%s"%(serializeNode(pagenode))) return serializeNode(pagenode) if (queryType=="fulltextMorph"): pagedivs = pagedom.xpath("//div[@class='queryResult']") @@ -175,7 +176,7 @@ return myList - def getTextPage(self, docinfo=None, pageinfo=None): + def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None): """returns single page from fulltext""" docpath = docinfo['textURLPath'] path = docinfo['textURLPath'] @@ -185,7 +186,7 @@ viewMode= pageinfo['viewMode'] sn = pageinfo['sn'] highlightQuery = pageinfo['highlightQuery'] - mode = pageinfo ['viewMode'] + #mode = pageinfo ['viewMode'] tocMode = pageinfo['tocMode'] characterNormalization=pageinfo['characterNormalization'] tocPN = pageinfo['tocPN'] @@ -362,7 +363,22 @@ 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 "no text here" - + + def getText(self, mode="text", pn=1, docinfo=None, pageinfo=None): + data = self.getTextPage(mode="text", pn=1 ,docinfo=docinfo, pageinfo=pageinfo) + logging.debug("TEXT ALL data: %s"%(data)) + return data + + def getXML(self, mode="xml", pn=1, docinfo=None, pageinfo=None): + data = self.getTextPage(mode="xml", pn=1 ,docinfo=docinfo, pageinfo=pageinfo) + logging.debug("TEXT ALL data: %s"%(data)) + return data + + def getDictionary(self, mode="text_dict", pn=1, docinfo=None, pageinfo=None): + data = self.getTextPage(mode="text_dict", pn=1 ,docinfo=docinfo, pageinfo=pageinfo) + logging.debug("TEXT ALL data: %s"%(data)) + return data + def getTranslate(self, query=None, language=None): """translate into another languages""" data = self.getServerData("lt/lex.xql","document=&language="+str(language)+"&query="+urllib.quote(query)) @@ -455,7 +471,7 @@ page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) text = page.replace('mode=image','mode=texttool') #logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization)) - + logging.debug("TEXT %s"%(text)) return text def manage_changeMpdlXmlTextServer(self,title="",serverUrl="http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/",timeout=40,RESPONSE=None):
--- a/zpt/page_main_double.zpt Thu Jan 20 17:04:21 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - -<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) "> - <div tal:content="structure python:here.getTextPage(mode='image',pn=pageinfo['current'],docinfo=docinfo, pageinfo=pageinfo)"></div> -</tal:block> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/zpt/page_main_thumbi.zpt Mon Feb 14 15:41:12 2011 +0100 @@ -0,0 +1,3 @@ +<tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');sn python:pageinfo.get('sn',''); characterNormalization python:pageinfo.get('characterNormalization',''); optionToggle python:pageinfo.get('optionToggle','');"> + <div tal:content="structure python:pageinfo['textPage']"></div> +</tal:block> \ No newline at end of file