Diff for /ImageArchive/ImageArchive.py between versions 1.103 and 1.104

version 1.103, 2007/01/31 14:24:17 version 1.104, 2008/08/15 14:10:23
Line 1 Line 1
   """version 1 des Imageservers, wird ersetzt durch version2"""
   
 genericServerPath="http://www.mpiwg-berlin.mpg.de/zogilib_images" #can be changed with main config  genericServerPath="http://www.mpiwg-berlin.mpg.de/zogilib_images" #can be changed with main config
   
   
Line 34  def logger(txt,method,txt2): Line 36  def logger(txt,method,txt2):
     """logging"""      """logging"""
     logging.info(txt+ txt2)      logging.info(txt+ txt2)
   
   def logTime(msg=""):
       """log the time"""
       logging.info("%s %s"%(msg,time.clock()))
   
   
 from AccessControl import ClassSecurityInfo, getSecurityManager  from AccessControl import ClassSecurityInfo, getSecurityManager
Line 316  class ImageDigilib(Folder,Persistent,Imp Line 321  class ImageDigilib(Folder,Persistent,Imp
           
     def isAccessible(self):      def isAccessible(self):
         """gives true if obejct is accessible taking the rights of the user into account"""          """gives true if obejct is accessible taking the rights of the user into account"""
                   logTemp("isaccessible")
         #TODO: implement rights, currently  true if external and false if internal, and true if user has role authenticated          #TODO: implement rights, currently  true if external and false if internal, and true if user has role authenticated
           
         username=self.REQUEST['AUTHENTICATED_USER']          username=self.REQUEST['AUTHENTICATED_USER']
Line 637  class ImageDigilib(Folder,Persistent,Imp Line 642  class ImageDigilib(Folder,Persistent,Imp
                   
   
           
         self.REQUEST.SESSION['string']="<img border=\"0\" src=\"%s\">"% path          imageString="<img border=\"0\" src=\"%s\">"% path
           self.REQUEST.SESSION['string']=imageString
         if url:          if url:
             return "<img border=\"0\" src=\"%s\">"% path              return "<img border=\"0\" src=\"%s\">"% path
         else:          else:
Line 647  class ImageDigilib(Folder,Persistent,Imp Line 653  class ImageDigilib(Folder,Persistent,Imp
                 return getattr(self,overview[0][0])()                  return getattr(self,overview[0][0])()
             else:              else:
                 pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbMD.zpt')).__of__(self)                  pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbMD.zpt')).__of__(self)
                 return pt()                  return pt(imageString=imageString)
   
   
     def image(self,dw=None,dh=None):      def image(self,dw=None,dh=None):
Line 1686  class ImageCollection(OrderedFolder, Per Line 1692  class ImageCollection(OrderedFolder, Per
         if showall=='yes':          if showall=='yes':
             rows=int(idsnumber/cols)+1              rows=int(idsnumber/cols)+1
                           
           logTime("getColTimesRow finished")
         return (cols,rows)          return (cols,rows)
                                   
                   
Line 1729  class ImageCollection(OrderedFolder, Per Line 1736  class ImageCollection(OrderedFolder, Per
         self.REQUEST.SESSION['ids']=ids          self.REQUEST.SESSION['ids']=ids
         number=int(len(ids)/numberOfColumns)+1          number=int(len(ids)/numberOfColumns)+1
           
           logTime("show_thumbs_rows finished (%s)"%str(number))
         return range(number+1)          return range(number+1)
   
     def show_thumbs_columns(self,row,numberOfColumns):      def show_thumbs_columns(self,row,numberOfColumns):
         """Ausgabe einer Liste der Reihe"""          """Ausgabe einer Liste der Reihe"""
         ids=self.REQUEST.SESSION['ids']          ids=self.REQUEST.SESSION['ids']
         max=len(ids)          max=len(ids)
           logTime("show_thumb_columns finishes row: %s"%row)
         if (row*numberOfColumns)<max:          if (row*numberOfColumns)<max:
             return ids[(row-1)*numberOfColumns:row*numberOfColumns]              return ids[(row-1)*numberOfColumns:row*numberOfColumns]
         else:          else:
Line 2083  class ImageCollectionMD(ImageCollection, Line 2092  class ImageCollectionMD(ImageCollection,
     def index_html(self,fn=None,selection=None,generic='No',REQUEST=None,RESPONSE=None):      def index_html(self,fn=None,selection=None,generic='No',REQUEST=None,RESPONSE=None):
         """main template collection"""          """main template collection"""
   
                   logTime("index_html %s"%self.REQUEST['QUERY_STRING'])
         mode=self.REQUEST.get('mode','view')          mode=self.REQUEST.get('mode','view')
         if fn:          if fn:
             ret=[]              ret=[]
Line 2234  class ImageCollectionMD(ImageCollection, Line 2243  class ImageCollectionMD(ImageCollection,
   
     def thumblistMD(self):      def thumblistMD(self):
         """main template collection"""          """main template collection"""
           logTime("thumbList MD %s"%self.REQUEST['QUERY_STRING'])
           
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbListMD.zpt')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','thumbListMD.zpt')).__of__(self)
           self.REQUEST.RESPONSE.setHeader('Cache-Control','max-age=3600')
           self.REQUEST.RESPONSE.setHeader('Last-Modified',self.bobobase_modification_time().toZone('GMT').rfc822())
         return pt()          return pt()
           
       
     def getRights(self,id):      def getRights(self,id):
         """get the rights from a database"""          """get the rights from a database"""
         #print self.rightsQuery%id          #print self.rightsQuery%id
         results=self.ZSQLSimpleSearch(self.getRightsQuery()%id)          results=self.ZSQLSimpleSearch(self.getRightsQuery()%id)
           logging.error("rightsQuery: %s"%(self.getRightsQuery()%id))
         if results:          if results:
             result = getattr(results[0],self.getRightsQueryField())              result = getattr(results[0],self.getRightsQueryField())
         else:          else:

Removed from v.1.103  
changed lines
  Added in v.1.104


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