Changeset 448:35e7ea6f2368 in documentViewer
- Timestamp:
- Jul 29, 2011, 10:33:17 AM (14 years ago)
- Branch:
- default
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
MpdlXmlTextServer.py
r447 r448 22 22 manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals()) 23 23 24 def __init__(self,id,title="",serverUrl="http://mpdl- system.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):24 def __init__(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40): 25 25 #def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40): 26 26 … … 49 49 pagesize = pageinfo['queryPageSize'] 50 50 pn = pageinfo.get('searchPN',1) 51 sn = pageinfo['sn'] 51 #sn = pageinfo['sn'] 52 s = pageinfo['s'] 53 highlightElementPos =pageinfo ['highlightElementPos'] 54 highlightElement = pageinfo ['highlightElement'] 55 52 56 highlightQuery = pageinfo['highlightQuery'] 53 57 query =pageinfo['query'] … … 59 63 tocPN = pageinfo['tocPN'] 60 64 selfurl = self.absolute_url() 61 data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&characterNormalization=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, sn, viewMode,characterNormalization, urllib.quote(highlightQuery))) 65 data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&s=%s&viewMode=%s&characterNormalization=%s&highlightElementPos=%s&highlightElement=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, s, viewMode,characterNormalization, highlightElementPos, highlightElement, urllib.quote(highlightQuery))) 66 #data = self.getServerData("doc-query.xql","document=%s&mode=%s&queryType=%s&query=%s&queryResultPageSize=%s&queryResultPN=%s&sn=%s&viewMode=%s&characterNormalization=%s&highlightQuery=%s"%(docpath, 'text', queryType, urllib.quote(query), pagesize, pn, sn, viewMode,characterNormalization, urllib.quote(highlightQuery))) 62 67 pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url) 63 68 pagedom = Parse(pagexml) … … 186 191 name = docinfo.get('name',None) 187 192 pn =pageinfo['current'] 188 sn = pageinfo['sn'] 193 #sn = pageinfo['sn'] 194 s = pageinfo['s'] 195 highlightElementPos =pageinfo ['highlightElementPos'] 196 highlightElement = pageinfo ['highlightElement'] 189 197 #optionToggle =pageinfo ['optionToggle'] 190 198 highlightQuery = pageinfo['highlightQuery'] … … 201 209 textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization) 202 210 if highlightQuery is not None: 203 textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn) 211 #textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn) 212 textParam +="&highlightQuery=%s&s=%s&highlightElement=%s&highlightElementPos=%s"%(urllib.quote(highlightQuery),s, highlightElement, highlightElementPos) 204 213 205 214 pagexml = self.getServerData("page-fragment.xql",textParam) … … 355 364 # is link with href 356 365 href = hrefNode.nodeValue 357 if href.startswith('http://mpdl- proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'):366 if href.startswith('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'): 358 367 # is pollux link 359 368 selfurl = self.absolute_url() 360 369 # change href 361 hrefNode.nodeValue = href.replace('http://mpdl- proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl)370 hrefNode.nodeValue = href.replace('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl) 362 371 # add target 363 372 l.setAttributeNS(None, 'target', '_blank') … … 366 375 #window.open("this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=yes, scrollbars=1'"); return false;") 367 376 368 if href.startswith('http://mpdl- proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'):377 if href.startswith('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'): 369 378 selfurl = self.absolute_url() 370 hrefNode.nodeValue = href.replace('http://mpdl- proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl)379 hrefNode.nodeValue = href.replace('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl) 371 380 l.setAttributeNS(None, 'target', '_blank') 372 381 l.setAttributeNS(None, 'onclick',"popupWin = window.open(this.href, 'InfoWindow', 'menubar=no, location,width=300,height=400,top=180, left=700, toolbar=no, scrollbars=1'); return false;") -
documentViewer.py
r445 r448 596 596 def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0): 597 597 """gets bibliographical info from the index.meta file at path or given by dom""" 598 logging.debug("documentViewer (getbibinfofromindexmeta) path: %s"%(path))598 #logging.debug("documentViewer (getbibinfofromindexmeta) path: %s"%(path)) 599 599 600 600 if docinfo is None: … … 608 608 docinfo['indexMetaPath']=self.getIndexMetaPath(path); 609 609 610 logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))610 #logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path)) 611 611 # put in all raw bib fields as dict "bib" 612 612 bib = dom.xpath("//bib/*") … … 628 628 docinfo['bib_type'] = bibtype 629 629 bibmap=metaData.generateMappingForType(bibtype) 630 logging.debug("documentViewer (getbibinfofromindexmeta) bibmap:"+repr(bibmap))631 logging.debug("documentViewer (getbibinfofromindexmeta) bibtype:"+repr(bibtype))630 #logging.debug("documentViewer (getbibinfofromindexmeta) bibmap:"+repr(bibmap)) 631 #logging.debug("documentViewer (getbibinfofromindexmeta) bibtype:"+repr(bibtype)) 632 632 # if there is no mapping bibmap is empty (mapping sometimes has empty fields) 633 633 if len(bibmap) > 0 and len(bibmap['author'][0]) > 0: … … 641 641 docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0]) 642 642 except: pass 643 logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype)643 #logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype) 644 644 try: 645 645 docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0]) … … 686 686 except: 687 687 docinfo['isbn_issn']='' 688 #logging.debug("I NEED BIBTEX %s"%docinfo) 688 689 return docinfo 689 690 690 691 691 692 def getNameFromIndexMeta(self,path,docinfo=None,dom=None,cut=0): 692 693 """gets name info from the index.meta file at path or given by dom""" … … 792 793 presentationUrls = dom.xpath("//texttool/presentation") 793 794 docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom) # get info von bib tag 795 #docinfo = self.getDownloadfromDocinfoToBibtex(url, docinfo=docinfo, dom=dom) 794 796 docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom) 795 797 … … 847 849 #path ist the path to the images it assumes that the index.meta file is one level higher. 848 850 docinfo = self.getBibinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1) 851 #docinfo = self.getDownloadfromDocinfoToBibtex(pathorig,docinfo=docinfo,cut=cut+1) 849 852 docinfo = self.getAuthinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1) 850 853 return docinfo … … 913 916 pageinfo['textPN'] = self.REQUEST.get('textPN','1') 914 917 pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','') 918 919 pageinfo ['highlightElementPos'] = self.REQUEST.get('highlightElementPos','') 920 pageinfo ['highlightElement'] = self.REQUEST.get('highlightElement','') 921 922 915 923 pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') 916 924 pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') … … 929 937 pageinfo['tocPN'] = min (tocPages,toc) 930 938 pageinfo['searchPN'] =self.REQUEST.get('searchPN','1') 931 pageinfo['sn'] =self.REQUEST.get('sn','') 939 #pageinfo['sn'] =self.REQUEST.get('sn','') 940 pageinfo['s'] =self.REQUEST.get('s','') 932 941 return pageinfo 933 942 -
zpt/page_main_pureXml.zpt
r429 r448 1 <tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');s n python:pageinfo.get('sn','');optionToggle python:pageinfo.get('optionToggle',''); ">1 <tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');s python:pageinfo.get('s','');optionToggle python:pageinfo.get('optionToggle',''); "> 2 2 <div tal:content="structure python:pageinfo['textPage']"></div> 3 3 </tal:block> -
zpt/page_main_text.zpt
r429 r448 2 2 docinfo python:options.get('docinfo',None); 3 3 highlightQuery python:pageinfo.get('highlightQuery',''); 4 s n python:pageinfo.get('sn','');4 s python:pageinfo.get('s',''); 5 5 pn python:pageinfo.get('pn',1); 6 6 characterNormalization python:pageinfo.get('characterNormalization',''); -
zpt/page_main_xml.zpt
r433 r448 1 <tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');s n python:pageinfo.get('sn','');optionToggle python:pageinfo.get('optionToggle',''); mode python:pageinfo.get('mode', 'xml') ">1 <tal:block tal:define="pageinfo python:options.get('pageinfo',None); docinfo python:options.get('docinfo',None) ;highlightQuery python:pageinfo.get('highlightQuery','');s python:pageinfo.get('s','');optionToggle python:pageinfo.get('optionToggle',''); mode python:pageinfo.get('mode', 'xml') "> 2 2 <div tal:content="structure python:pageinfo['textPage']"></div> 3 3 </tal:block>
Note: See TracChangeset
for help on using the changeset viewer.