Diff for /documentViewer/MpdlXmlTextServer.py between versions 1.240 and 1.245

version 1.240, 2011/07/18 14:02:37 version 1.245, 2012/03/20 14:09:17
Line 21  class MpdlXmlTextServer(SimpleItem): Line 21  class MpdlXmlTextServer(SimpleItem):
           
     manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())      manage_changeMpdlXmlTextServerForm = PageTemplateFile("zpt/manage_changeMpdlXmlTextServer", globals())
                   
     def __init__(self,id,title="",serverUrl="http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):      def __init__(self,id,title="",serverUrl="http://mpdl-test.mpiwg-berlin.mpg.de/mpdl/interface/", serverName=None, timeout=40):
     #def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40):          #def __init__(self,id,title="",serverUrl="http://mpdl-text.mpiwg-berlin.mpg.de:30030/mpdl/interface/", serverName=None, timeout=40):    
                   
         """constructor"""          """constructor"""
Line 48  class MpdlXmlTextServer(SimpleItem): Line 48  class MpdlXmlTextServer(SimpleItem):
         url = docinfo['url']          url = docinfo['url']
         pagesize = pageinfo['queryPageSize']          pagesize = pageinfo['queryPageSize']
         pn = pageinfo.get('searchPN',1)          pn = pageinfo.get('searchPN',1)
         sn = pageinfo['sn']          #sn = pageinfo['sn']
           s = pageinfo['s']
           highlightElementPos =pageinfo ['highlightElementPos']
           highlightElement = pageinfo ['highlightElement']
           
         highlightQuery = pageinfo['highlightQuery']          highlightQuery = pageinfo['highlightQuery']
         query =pageinfo['query']          query =pageinfo['query']
         queryType =pageinfo['queryType']          queryType =pageinfo['queryType']
Line 58  class MpdlXmlTextServer(SimpleItem): Line 62  class MpdlXmlTextServer(SimpleItem):
         #optionToggle = pageinfo['optionToggle']          #optionToggle = pageinfo['optionToggle']
         tocPN = pageinfo['tocPN']          tocPN = pageinfo['tocPN']
         selfurl = self.absolute_url()          selfurl = self.absolute_url()
         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)))          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)))
           #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)))
         pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)          pagexml = data.replace('?document=%s'%str(docpath),'?url=%s'%url)
         pagedom = Parse(pagexml)          pagedom = Parse(pagexml)
                   
Line 185  class MpdlXmlTextServer(SimpleItem): Line 190  class MpdlXmlTextServer(SimpleItem):
         url = docinfo.get('url',None)          url = docinfo.get('url',None)
         name = docinfo.get('name',None)          name = docinfo.get('name',None)
         pn =pageinfo['current']          pn =pageinfo['current']
         sn = pageinfo['sn']          #sn = pageinfo['sn']
           s = pageinfo['s']
           highlightElementPos =pageinfo ['highlightElementPos']
           highlightElement = pageinfo ['highlightElement']
         #optionToggle =pageinfo ['optionToggle']          #optionToggle =pageinfo ['optionToggle']
         highlightQuery = pageinfo['highlightQuery']          highlightQuery = pageinfo['highlightQuery']
         #mode = pageinfo ['viewMode']          #mode = pageinfo ['viewMode']
         tocMode = pageinfo['tocMode']          tocMode = pageinfo['tocMode']
           xpointer = pageinfo['xpointer']
         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
                   
         textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s"%(docpath,textmode,pn,characterNormalization)          textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s&xpointer=%s"%(docpath,textmode,pn,characterNormalization, xpointer)
           #textParam = "document=%s&mode=%s&pn=%s&characterNormalization=%s&xpointer=%s&options=withIdentifier"%(docpath,textmode,pn,characterNormalization, xpointer)
         if highlightQuery is not None:          if highlightQuery is not None:
             textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn)                         #textParam +="&highlightQuery=%s&sn=%s"%(urllib.quote(highlightQuery),sn)
               textParam +="&highlightQuery=%s&s=%s&highlightElement=%s&highlightElementPos=%s"%(urllib.quote(highlightQuery),s, highlightElement, highlightElementPos)           
                   
         pagexml = self.getServerData("page-fragment.xql",textParam)          pagexml = self.getServerData("page-fragment.xql",textParam)
         dom = Parse(pagexml)          dom = Parse(pagexml)
Line 310  class MpdlXmlTextServer(SimpleItem): Line 322  class MpdlXmlTextServer(SimpleItem):
                         href= hrefNode.nodeValue                          href= hrefNode.nodeValue
                         if href.startswith('#note-'):                          if href.startswith('#note-'):
                             hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=text&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,tocMode,tocPN,pn))                              hrefNode.nodeValue = href.replace('#note-',"?url=%s&viewMode=text&tocMode=%s&tocPN=%s&pn=%s#note-"%(url,tocMode,tocPN,pn))
                           #if href.startswith():
                 return serializeNode(pagenode)                  return serializeNode(pagenode)
         if mode == "xml":          if mode == "xml":
               # first div contains text                # first div contains text
Line 327  class MpdlXmlTextServer(SimpleItem): Line 340  class MpdlXmlTextServer(SimpleItem):
                       hrefNode =l.getAttributeNodeNS(None, u"href")                        hrefNode =l.getAttributeNodeNS(None, u"href")
                       if hrefNode:                        if hrefNode:
                           href=hrefNode.nodeValue                            href=hrefNode.nodeValue
                           if href.startswith('http://chinagis.mpiwg-berlin.mpg.de'):                            if href.startswith('http://mappit.mpiwg-berlin.mpg.de'):
                               hrefNode.nodeValue =href.replace('chinagis_REST/REST/db/chgis/mpdl','chinagis/REST/db/mpdl/%s'%name)                                hrefNode.nodeValue =href.replace('db/REST/db/chgis/mpdl','db/RESTdb/db/mpdl/%s'%name)
                               l.setAttributeNS(None, 'target', '_blank')                                 l.setAttributeNS(None, 'target', '_blank') 
                   return serializeNode(pagenode)                    return serializeNode(pagenode)
                                           
Line 354  class MpdlXmlTextServer(SimpleItem): Line 367  class MpdlXmlTextServer(SimpleItem):
                     if hrefNode:                      if hrefNode:
                         # is link with href                          # is link with href
                         href = hrefNode.nodeValue                          href = hrefNode.nodeValue
                         if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'):                          if href.startswith('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql'):
                             # is pollux link                              # is pollux link
                             selfurl = self.absolute_url()                              selfurl = self.absolute_url()
                             # change href                              # change href
                             hrefNode.nodeValue = href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl)                              hrefNode.nodeValue = href.replace('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/interface/lt/wordInfo.xql','%s/head_main_voc'%selfurl)
                             # add target                              # add target
                             l.setAttributeNS(None, 'target', '_blank')                              l.setAttributeNS(None, 'target', '_blank')
                             #l.setAttributeNS(None, 'onclick',"popupWin = window.open(this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=no, scrollbars=1'); return false;")                              #l.setAttributeNS(None, 'onclick',"popupWin = window.open(this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=no, scrollbars=1'); return false;")
                             #l.setAttributeNS(None, "ondblclick", "popupWin.focus();")                              #l.setAttributeNS(None, "ondblclick", "popupWin.focus();")
                             #window.open("this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=yes, scrollbars=1'"); return false;")                               #window.open("this.href, 'InfoWindow', 'menubar=no, location,width=500,height=600,top=180, left=700, toolbar=yes, scrollbars=1'"); return false;") 
                                                                                                                       
                         if href.startswith('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'):                              if href.startswith('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql'):    
                             selfurl = self.absolute_url()                              selfurl = self.absolute_url()
                             hrefNode.nodeValue = href.replace('http://mpdl-proto.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl)                              hrefNode.nodeValue = href.replace('http://mpdl-text.mpiwg-berlin.mpg.de/mpdl/lt/lemma.xql','%s/head_main_lemma'%selfurl)
                             l.setAttributeNS(None, 'target', '_blank')                              l.setAttributeNS(None, 'target', '_blank')
                             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;")                              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;")
                             l.setAttributeNS(None, 'ondblclick', 'popupWin.focus();')                                 l.setAttributeNS(None, 'ondblclick', 'popupWin.focus();')   

Removed from v.1.240  
changed lines
  Added in v.1.245


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>