Diff for /zogiLib/zogiLib.py between versions 1.20 and 1.21

version 1.20, 2004/06/02 19:01:36 version 1.21, 2004/06/02 21:53:15
Line 427  class zogiLib(Folder): Line 427  class zogiLib(Folder):
             {'label':'Main Config','action':'changeZogiLibForm'},              {'label':'Main Config','action':'changeZogiLibForm'},
             )              )
   
     def __init__(self, id,title,digilibBaseUrl, localFileBase,version="book"):      def __init__(self, id, title, digilibBaseUrl, localFileBase, version="book", basePath=""):
         """init"""          """init"""
   
         self.id=id          self.id=id
         self.title=title          self.title=title
         self.digilibBaseUrl=digilibBaseUrl          self.digilibBaseUrl=digilibBaseUrl
         self.localFileBase=localFileBase          self.localFileBase=localFileBase
           self.basePath=basePath
         self.layout=version          self.layout=version
   
   
Line 463  class zogiLib(Folder): Line 464  class zogiLib(Folder):
         return pt()          return pt()
                   
                                                   
     def createScalerImg(self, requestString = None):      def createScalerImg(self, requestString = None, bottom = 0, side = 0):
         """generate Scaler IMG Tag"""          """generate Scaler IMG Tag"""
     self.checkQuery()      self.checkQuery()
     bt = self.REQUEST.SESSION['browserType']      bt = self.REQUEST.SESSION['browserType']
         if not requestString:          if not requestString:
             requestString = self.REQUEST.QUERY_STRING              requestString = self.getAllDLParams()
         url = self.digilibBaseUrl+requestString          url = self.digilibBaseUrl+requestString
         tag = ""          tag = ""
         if bt.isN4:          if bt.isN4:
Line 477  class zogiLib(Folder): Line 478  class zogiLib(Folder):
             tag += '<div id="scaler">'              tag += '<div id="scaler">'
         tag += '<script type="text/javascript">'          tag += '<script type="text/javascript">'
         tag += "var ps = bestPicSize(getElement('scaler'));"          tag += "var ps = bestPicSize(getElement('scaler'));"
         tag += 'document.write(\'<img id="pic" src="%s&dw=\'+ps.width+\'&dh=\'+ps.height+\'" />\')'%url          b_par = ""
           s_par = ""
           if (bottom != 0) or (side != 0):
               b_par = "-" + str(int(bottom))
               s_par = "-" + str(int(side))
           tag += 'document.write(\'<img id="pic" src="%s&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 577  class zogiLib(Folder): Line 583  class zogiLib(Folder):
   
   
   
     def storeQuery(self):      def storeQuery(self, more = None):
         """storeQuery in session"""          """storeQuery in session"""
         dlParams = {}          dlParams = {}
         for fm in self.REQUEST.form.keys():          for fm in self.REQUEST.form.keys():
             dlParams[fm] = self.REQUEST.form[fm]              dlParams[fm] = self.REQUEST.form[fm]
           # look for more
           if more:
               for fm in more.split('&'):
                   try:
                       pv = fm.split('=')
                       dlParams[pv[0]] = pv[1]
                   except:
                       print "ouch!"
           # parse digilib mode parameter
         if 'mo' in dlParams:          if 'mo' in dlParams:
             if len(dlParams['mo']) > 0:              if len(dlParams['mo']) > 0:
                 modes=dlParams['mo'].split(',')                  modes=dlParams['mo'].split(',')
Line 596  class zogiLib(Folder): Line 610  class zogiLib(Folder):
   
     def checkQuery(self):      def checkQuery(self):
     """check if the query has been stored"""      """check if the query has been stored"""
     if not (self.REQUEST.SESSION and 'query' in self.REQUEST.SESSION):      if not (self.REQUEST.SESSION):
         print "ZOGILIB: have to store query!!"          print "ZOGILIB: have to store query!!"
         storeQuery(self)          storeQuery(self)
                   
Line 639  class zogiLib(Folder): Line 653  class zogiLib(Folder):
             self.setDLParam('cont', cont)              self.setDLParam('cont', cont)
   
         if pn:          if pn:
               # unmark
               self.setDLParam('mk', None)
             self.setDLParam('pn', pn)              self.setDLParam('pn', pn)
   
         if ws:          if ws:
Line 653  class zogiLib(Folder): Line 669  class zogiLib(Folder):
     def display(self):      def display(self):
         """(re)display page"""          """(re)display page"""
         params = self.getAllDLParams()          params = self.getAllDLParams()
           if self.basePath:
               self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?'+params)
           else:
         self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params)          self.REQUEST.RESPONSE.redirect(self.REQUEST['URL1']+'?'+params)
   
     def getPT(self):      def getPT(self):
Line 788  class zogiLib(Folder): Line 807  class zogiLib(Folder):
         pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/changeZogiLibForm.zpt')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/changeZogiLibForm.zpt')).__of__(self)
         return pt()          return pt()
           
     def changeZogiLib(self,title,digilibBaseUrl, localFileBase, version, RESPONSE=None):      def changeZogiLib(self,title,digilibBaseUrl, localFileBase, version, basePath, RESPONSE=None):
         """change it"""          """change it"""
         self.title=title          self.title=title
         self.digilibBaseUrl=digilibBaseUrl          self.digilibBaseUrl=digilibBaseUrl
         self.localFileBase=localFileBase          self.localFileBase=localFileBase
           self.basePath = basePath
         self.layout=version          self.layout=version
   
         if RESPONSE is not None:          if RESPONSE is not None:
Line 804  def manage_addZogiLibForm(self): Line 824  def manage_addZogiLibForm(self):
     pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/addZogiLibForm')).__of__(self)      pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/addZogiLibForm')).__of__(self)
     return pt()      return pt()
   
 def manage_addZogiLib(self,id,title,digilibBaseUrl, localFileBase,version="book",RESPONSE=None):  def manage_addZogiLib(self,id,title,digilibBaseUrl, localFileBase,version="book",basePath="",RESPONSE=None):
     """add dgilib"""      """add dgilib"""
     newObj=zogiLib(id,title,digilibBaseUrl, localFileBase, version)      newObj=zogiLib(id,title,digilibBaseUrl, localFileBase, version, basePath)
     self.Destination()._setObject(id,newObj)      self.Destination()._setObject(id,newObj)
     if RESPONSE is not None:      if RESPONSE is not None:
         RESPONSE.redirect('manage_main')          RESPONSE.redirect('manage_main')

Removed from v.1.20  
changed lines
  Added in v.1.21


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