Diff for /zogiLib/zogiLib.py between versions 1.67 and 1.73

version 1.67, 2006/11/14 09:47:20 version 1.73, 2011/02/14 16:33:43
Line 69  class zogiImage(SimpleItem): Line 69  class zogiImage(SimpleItem):
         if baseUrl:          if baseUrl:
             self.baseUrl=baseUrl              self.baseUrl=baseUrl
         else:          else:
             self.baseUrl="http://nausikaa.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?"              self.baseUrl="http://digilib.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?"
                           
         self.queryString=queryString          self.queryString=queryString
         self.content_type=content_type          self.content_type=content_type
Line 187  class zogiLib(Folder): Line 187  class zogiLib(Folder):
     main_book      = PageTemplateFile('zpt/main_book', globals())      main_book      = PageTemplateFile('zpt/main_book', globals())
     main_image     = PageTemplateFile('zpt/main_image', globals())      main_image     = PageTemplateFile('zpt/main_image', globals())
     main_metaData  = PageTemplateFile('zpt/main_metadata', globals())      main_metaData  = PageTemplateFile('zpt/main_metadata', globals())
       main_embed      = PageTemplateFile('zpt/main_embed', globals())
     #main_static    = PageTemplateFile('zpt/main_static', globals())      #main_static    = PageTemplateFile('zpt/main_static', globals())
     options        = PageTemplateFile('zpt/options', globals())      options        = PageTemplateFile('zpt/options', globals())
     #changeForm     = PageTemplateFile('zpt/changeForm', globals())      #changeForm     = PageTemplateFile('zpt/changeForm', globals())
Line 358  class zogiLib(Folder): Line 359  class zogiLib(Folder):
             return {}              return {}
   
   
     def zogilibPath(self, otherbase=None):      def zogilibPathOLD(self, otherbase=None):
         """returns an URL to the zogiLib instance"""          """returns an URL to the zogiLib instance"""
         url = self.REQUEST['URL1']          url = self.REQUEST['URL1']
         # should end with "/"          # should end with "/"
Line 373  class zogiLib(Folder): Line 374  class zogiLib(Folder):
             url += '/'              url += '/'
         return url          return url
   
       def zogilibPath(self, otherbase=None):
           """returns an URL to the zogiLib instance"""
           url = self.absolute_url()
           # should end with "/"
           if len(url) > 0 and url[-1] != '/':
               url += '/'
           if type(otherbase) is str:
               url += otherbase
           else:
               url += self.basePath
           # should still end with "/"
           if len(url) > 0 and url[-1] != '/':
               url += '/'
           return url
     def zogilibAction(self, action, otherbase=None):      def zogilibAction(self, action, otherbase=None):
         """returns a URL with zogilib path and action"""          """returns a URL with zogilib path and action"""
         url = self.zogilibPath(otherbase)          url = self.zogilibPath(otherbase)
Line 396  class zogiLib(Folder): Line 411  class zogiLib(Folder):
   
     def getScalerUrl(self,requestString=""):      def getScalerUrl(self,requestString=""):
         """send scaler url"""          """send scaler url"""
           if requestString is None:
               requestString = ""
         if self.dlServerURL[-1] == '?':          if self.dlServerURL[-1] == '?':
             # full Servlet URL              # full Servlet URL
             return self.dlServerURL + requestString              return self.dlServerURL + requestString
Line 421  class zogiLib(Folder): Line 438  class zogiLib(Folder):
         if  self.REQUEST.SESSION.has_key('scalerDiv'):          if  self.REQUEST.SESSION.has_key('scalerDiv'):
             (requestString, bottom, side, width, height) = self.REQUEST.SESSION['scalerDiv']              (requestString, bottom, side, width, height) = self.REQUEST.SESSION['scalerDiv']
         # if not explicitly defined take normal request          # if not explicitly defined take normal request
         if not requestString:  
             requestString = self.getAllDLParams()  
         url = self.getScalerUrl(requestString=requestString)          url = self.getScalerUrl(requestString=requestString)
         # take insets from options if present          # take insets from options if present
         if options is not None:          if options is not None:
Line 446  class zogiLib(Folder): Line 461  class zogiLib(Folder):
             tag += '<script type="text/javascript">'              tag += '<script type="text/javascript">'
             tag += "var ps = bestPicSize(getElement('scaler'));"              tag += "var ps = bestPicSize(getElement('scaler'));"
             # write img tag with javascript              # write img tag with javascript
               if requestString:
                   # take all parameters from requestString
             tag += 'document.write(\'<img id="pic" src="%s&dw=\'+(ps.width%s)+\'&dh=\'+(ps.height%s)+\'" />\');'%(url, s_par, b_par)              tag += 'document.write(\'<img id="pic" src="%s&dw=\'+(ps.width%s)+\'&dh=\'+(ps.height%s)+\'" />\');'%(url, s_par, b_par)
               else:
                   # use javascript to filter digilib parameters
                   tag += """document.write('<img id="pic" src="%s'+getAllParameters(31)+'&dw='+(ps.width%s)+'&dh='+(ps.height%s)+'" />');"""%(url, s_par, b_par)
                   
             tag += '</script>'              tag += '</script>'
             if bt['isN4']:              if bt['isN4']:
                 tag += '</ilayer>'                  tag += '</ilayer>'
Line 464  class zogiLib(Folder): Line 485  class zogiLib(Folder):
                 # make shure to remove unused parameter                  # make shure to remove unused parameter
                 del self.REQUEST.SESSION['scalerDiv']                  del self.REQUEST.SESSION['scalerDiv']
                                   
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/zogilib_img_div')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt/img_div')).__of__(self)
         return pt()          return pt()
   
     def index_html(self):      def index_html(self):
Line 901  def manage_addZogiLibPageTemplate(self, Line 922  def manage_addZogiLibPageTemplate(self,
     id = 'main_%s'%layout      id = 'main_%s'%layout
     self._setObject(id, zogiLibPageTemplate(id))      self._setObject(id, zogiLibPageTemplate(id))
     ob = getattr(self, id)      ob = getattr(self, id)
     ob.pt_edit(open(os.path.join(package_home(globals()),'zpt/main_%s.zpt'%layout)).read(),None)      ob.pt_edit(open(os.path.join(package_home(globals()),'zpt/main_%s.zpt'%layout)).read(),'text/html')
     if title:      if title:
         ob.pt_setTitle(title)          ob.pt_setTitle(title)
     try:      try:

Removed from v.1.67  
changed lines
  Added in v.1.73


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