Changeset 448:35e7ea6f2368 in documentViewer


Ignore:
Timestamp:
Jul 29, 2011, 10:33:17 AM (13 years ago)
Author:
abukhman
Branch:
default
Message:

* empty log message *

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • MpdlXmlTextServer.py

    r447 r448  
    2222    manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())
    2323       
    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):
    2525    #def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40):   
    2626       
     
    4949        pagesize = pageinfo['queryPageSize']
    5050        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       
    5256        highlightQuery = pageinfo['highlightQuery']
    5357        query =pageinfo['query']
     
    5963        tocPN = pageinfo['tocPN']
    6064        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)))
    6267        pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)
    6368        pagedom = Parse(pagexml)
     
    186191        name = docinfo.get('name',None)
    187192        pn =pageinfo['current']
    188         sn = pageinfo['sn']
     193        #sn = pageinfo['sn']
     194        s = pageinfo['s']
     195        highlightElementPos =pageinfo ['highlightElementPos']
     196        highlightElement = pageinfo ['highlightElement']
    189197        #optionToggle =pageinfo ['optionToggle']
    190198        highlightQuery = pageinfo['highlightQuery']
     
    201209        textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)
    202210        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)           
    204213       
    205214        pagexml = self.getServerData("page-fragment.xql",textParam)
     
    355364                        # is link with href
    356365                        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'):
    358367                            # is pollux link
    359368                            selfurl = self.absolute_url()
    360369                            # 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)
    362371                            # add target
    363372                            l.setAttributeNS(None, 'target', '_blank')
     
    366375                            #window.open("this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=yes, scrollbars=1'"); return false;")
    367376                                                         
    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'):   
    369378                            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)
    371380                            l.setAttributeNS(None, 'target', '_blank')
    372381                            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  
    596596    def getBibinfoFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
    597597        """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))
    599599       
    600600        if docinfo is None:
     
    608608        docinfo['indexMetaPath']=self.getIndexMetaPath(path);
    609609       
    610         logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))
     610        #logging.debug("documentViewer (getbibinfofromindexmeta cutted) path: %s"%(path))
    611611        # put in all raw bib fields as dict "bib"
    612612        bib = dom.xpath("//bib/*")
     
    628628        docinfo['bib_type'] = bibtype
    629629        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))
    632632        # if there is no mapping bibmap is empty (mapping sometimes has empty fields)
    633633        if len(bibmap) > 0 and len(bibmap['author'][0]) > 0:
     
    641641                docinfo['year']=getTextFromNode(dom.xpath("//bib/%s"%bibmap['year'][0])[0])
    642642            except: pass
    643             logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype)
     643            #logging.debug("documentViewer (getbibinfofromindexmeta) using mapping for %s"%bibtype)
    644644            try:
    645645                docinfo['lang']=getTextFromNode(dom.xpath("//bib/lang")[0])
     
    686686            except:
    687687                docinfo['isbn_issn']=''           
     688        #logging.debug("I NEED BIBTEX %s"%docinfo)
    688689        return docinfo
    689690   
    690      
     691   
    691692    def getNameFromIndexMeta(self,path,docinfo=None,dom=None,cut=0):
    692693        """gets name info from the index.meta file at path or given by dom"""
     
    792793        presentationUrls = dom.xpath("//texttool/presentation")
    793794        docinfo = self.getBibinfoFromIndexMeta(url, docinfo=docinfo, dom=dom)   # get info von bib tag
     795        #docinfo = self.getDownloadfromDocinfoToBibtex(url, docinfo=docinfo, dom=dom)
    794796        docinfo = self.getNameFromIndexMeta(url, docinfo=docinfo, dom=dom)
    795797       
     
    847849        #path ist the path to the images it assumes that the index.meta file is one level higher.
    848850        docinfo = self.getBibinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)
     851        #docinfo = self.getDownloadfromDocinfoToBibtex(pathorig,docinfo=docinfo,cut=cut+1)
    849852        docinfo = self.getAuthinfoFromIndexMeta(pathorig,docinfo=docinfo,cut=cut+1)
    850853        return docinfo
     
    913916        pageinfo['textPN'] = self.REQUEST.get('textPN','1')
    914917        pageinfo['highlightQuery'] = self.REQUEST.get('highlightQuery','')
     918       
     919        pageinfo ['highlightElementPos'] = self.REQUEST.get('highlightElementPos','')
     920        pageinfo ['highlightElement'] = self.REQUEST.get('highlightElement','')
     921       
     922       
    915923        pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30')
    916924        pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10')
     
    929937            pageinfo['tocPN'] = min (tocPages,toc)                   
    930938        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','')
    932941        return pageinfo
    933942   
  • 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','');sn 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','');  ">
    22  <div tal:content="structure python:pageinfo['textPage']"></div>
    33</tal:block>
  • zpt/page_main_text.zpt

    r429 r448  
    22                       docinfo python:options.get('docinfo',None);
    33                       highlightQuery python:pageinfo.get('highlightQuery','');
    4                        sn python:pageinfo.get('sn','');
     4                       s python:pageinfo.get('s','');
    55                       pn python:pageinfo.get('pn',1);
    66                       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','');sn 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') ">
    22  <div tal:content="structure python:pageinfo['textPage']"></div>
    33</tal:block>
Note: See TracChangeset for help on using the changeset viewer.