Diff for /ImageArchive/ImageArchive.py between versions 1.67 and 1.68

version 1.67, 2005/10/17 19:20:49 version 1.68, 2005/10/25 18:57:59
Line 24  from threading import Thread Line 24  from threading import Thread
 import Queue  import Queue
 import cgi  import cgi
   
 from AccessControl import ClassSecurityInfo  from AccessControl import ClassSecurityInfo, getSecurityManager
   
 try:  try:
     from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder      from Products.ZSQLExtend.ZSQLExtend import ZSQLExtendFolder
Line 278  class ImageDigilib(Folder,Persistent,Imp Line 278  class ImageDigilib(Folder,Persistent,Imp
                   
         )          )
   
       def getAccessRight(self):
           """get the accessright, return is string "extern" or "intern" """
           return self.getRights(self.filename.split('.')[0])
            
    
       def isAccessible(self):
           """gives true if obejct is accessible taking the rights of the user into account"""
           
           #TODO: implement rights, currently  true if external and false if internal, and true if user has role authenticated
       
           username=self.REQUEST['AUTHENTICATED_USER']
           #print username
           #print self.acl_users.getUserNames()
           user=getSecurityManager().getUser()
   
           roles=user.getRoles()
           if 'Authenticated' in roles:
               return True
           
           if self.getAccessRight()=="extern":
               return True
           else:
               return False
           
     def addMetaObject(self,id,RESPONSE=None):      def addMetaObject(self,id,RESPONSE=None):
         """Add an MetaObject"""          """Add an MetaObject"""
         objectType=getattr(self.Control_Panel.Products.ImageMetaData,self.genericMetaDataType)          objectType=getattr(self.Control_Panel.Products.ImageMetaData,self.genericMetaDataType)
Line 1539  class ImageCollectionMD(ImageCollection, Line 1563  class ImageCollectionMD(ImageCollection,
     meta_type="ImageCollection MD"      meta_type="ImageCollection MD"
     #scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn="      #scalerPath="http://127.0.0.1:18080/digitallibrary/servlet/Scaler/?fn="
     scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="      scalerPath="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?fn="
       rightsQueryDefault="SELECT accessibility from vision_main where id_image=(SELECT id from vision_images where filename ~ '%s*' )"
       rightsQueryFieldDefault="accessibility"
       
     manage_options=ImageCollection.manage_options+(      manage_options=ImageCollection.manage_options+(
         {'label':'ZSQLExtend','action':'changeZSQLExtendForm'},          {'label':'ZSQLExtend','action':'changeZSQLExtendForm'},
           {'label':'Change Rights Query','action':'changeRightsQueryForm'},
        )         )
   
     try:              try:        
Line 1548  class ImageCollectionMD(ImageCollection, Line 1576  class ImageCollectionMD(ImageCollection,
     except:      except:
       pass        pass
   
       def changeRightsQueryForm(self):
           """change Rights Query"""
           pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','ChangeRightsQueryForm.zpt')).__of__(self)
           return pt()
     
       def changeRightsQuery(self,rightsQuery,rightsQueryField,RESPONSE=None):
           """change Rightsquery"""
           
           self.rightsQuery=rightsQuery
           self.rightsQueryField=rightsQueryField
           
           if RESPONSE is not None:
                   RESPONSE.redirect('manage_main')
   
       
           
       def getRightsQuery(self):
           """get Query"""
           return getattr(self,'rightsQuery',self.rightsQueryDefault)
       
       def getRightsQueryField(self):
           """get Query Fiueld"""
           return getattr(self,'rightsQueryField',self.rightsQueryFieldDefault)
       
       
       
     def setGenericSearchStringForm(self):      def setGenericSearchStringForm(self):
         """form setze generischen search string fuer MD"""          """form setze generischen search string fuer MD"""
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','setGenericSearchStringForm.zpt')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','setGenericSearchStringForm.zpt')).__of__(self)
Line 1562  class ImageCollectionMD(ImageCollection, Line 1616  class ImageCollectionMD(ImageCollection,
         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)
         return pt()          return pt()
   
       def getRights(self,id):
           """get the rights from a database"""
           #print self.rightsQuery%id
           results=self.ZSQLSimpleSearch(self.getRightsQuery()%id)
           if results:
               result = getattr(results[0],self.getRightsQueryField())
           else:
               result = ''
           return result
           
   
 def manage_AddImageCollectionMDForm(self):  def manage_AddImageCollectionMDForm(self):
     """Nothing yet"""      """Nothing yet"""

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


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