Diff for /versionedFile/versionedFile.py between versions 1.58 and 1.63

version 1.58, 2006/05/21 17:40:38 version 1.63, 2006/06/17 16:32:12
Line 539  class versionedFileObject(File): Line 539  class versionedFileObject(File):
     manage_editForm._setName('manage_editForm')      manage_editForm._setName('manage_editForm')
   
   
       
    
     security.declarePublic('getTitle')      security.declarePublic('getTitle')
   
     def getTitle(self):      def getTitle(self):
Line 665  class versionedFileObject(File): Line 667  class versionedFileObject(File):
             except:#old version of versionded file sometimes stored the user object and not only the name the following corrects this              except:#old version of versionded file sometimes stored the user object and not only the name the following corrects this
                 ret=str(self.author).replace("-","\n")                  ret=str(self.author).replace("-","\n")
             ret=ret.replace("\r","\n")              ret=ret.replace("\r","\n")
             return ret              return ret.lstrip().rstrip()
   
         else:          else:
             jar=self._p_jar              jar=self._p_jar
Line 720  class versionedFile(CatalogAware,Folder) Line 722  class versionedFile(CatalogAware,Folder)
   
     default_catalog='fileCatalog'      default_catalog='fileCatalog'
           
       security= ClassSecurityInfo()   
       
       security.declarePublic('getTitle')
     def getTitle(self):      def getTitle(self):
         """get title"""          """get title"""
         return self.title          return self.title
Line 784  class versionedFile(CatalogAware,Folder) Line 789  class versionedFile(CatalogAware,Folder)
         else:          else:
             return images              return images
                                                             
               security.declarePublic('getComment')
     def getComment(self):      def getComment(self):
         """get the comment of this file"""          """get the comment of this file"""
         if not hasattr(self,'comment') or (not self.comment) or (self.comment.lstrip()==""):          if not hasattr(self,'comment') or (not self.comment) or (self.comment.lstrip()==""):
Line 814  class versionedFile(CatalogAware,Folder) Line 819  class versionedFile(CatalogAware,Folder)
   
         return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url())          return REQUEST.RESPONSE.redirect(self.aq_parent.absolute_url())
           
       security.declarePublic('getLastChangeDate')
       
       def getLastChangeDate(self):
           """get last change date"""
           lv=self.getLastVersion()
           time=lv.getTime()
           return time
       
       def getLastEditor(self):
           """get last change date"""
           lv=self.getLastVersion()
           le=lv.lastEditor()
           return le
       
       def getLockedBy(self):
           """get locked by"""
           return str(self.lockedBy)
           
       security.declarePublic('getLastVersion')
     def getLastVersion(self):      def getLastVersion(self):
         """Last Version"""          """Last Version"""
         tmp=0          tmp=0
Line 850  class versionedFile(CatalogAware,Folder) Line 874  class versionedFile(CatalogAware,Folder)
                   
                   
         return max([plus,minus]),l          return max([plus,minus]),l
           security.declarePublic('index_html')
     def index_html(self):      def index_html(self):
         """main view"""          """main view"""
         lastVersion=self.getLastVersion()          lastVersion=self.getLastVersion()
         #return "File:"+self.title+"  Version:%i"%lastVersion.versionNumber," modified:",lastVersion.bobobase_modification_time()," size:",lastVersion.getSize(),"modified by:",lastVersion.lastEditor()          #return "File:"+self.title+"  Version:%i"%lastVersion.versionNumber," modified:",lastVersion.bobobase_modification_time()," size:",lastVersion.getSize(),"modified by:",lastVersion.lastEditor()
         return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor())          return "File: %s Version:%i modified:%s size:%s modified by:%s"%(self.title,lastVersion.versionNumber,lastVersion.getTime(),lastVersion.getSize(),lastVersion.lastEditor())
     security= ClassSecurityInfo()     
   
             
     security.declarePublic('getVersion')                                                    security.declarePublic('getVersion')                                              
Line 893  class versionedFile(CatalogAware,Folder) Line 917  class versionedFile(CatalogAware,Folder)
         return ret          return ret
   
     security.declareProtected('AUTHENTICATED_USER','forceunlock')         security.declareProtected('AUTHENTICATED_USER','forceunlock')   
     def forceunlock(self,RESPONSE):      def forceunlock(self,RESPONSE=None):
         """unlock"""          """unlock"""
           #safe who had the lock
           if self.lockedBy:
               self.brokenLock=str(self.lockedBy)
           else:
               self.brokenLock=""
         self.lockedBy=''          self.lockedBy=''
           return self.brokenLock
   
     security.declareProtected('AUTHENTICATED_USER','unlock')         security.declareProtected('AUTHENTICATED_USER','unlock')   
     def unlock(self,RESPONSE):      def unlock(self,RESPONSE):
Line 916  class versionedFile(CatalogAware,Folder) Line 946  class versionedFile(CatalogAware,Folder)
         if str(self.REQUEST['AUTHENTICATED_USER']) in ["Anonymous User"]:          if str(self.REQUEST['AUTHENTICATED_USER']) in ["Anonymous User"]:
             return "please login first"              return "please login first"
         if (self.lockedBy==self.REQUEST['AUTHENTICATED_USER']) or (self.lockedBy==''):          if (self.lockedBy==self.REQUEST['AUTHENTICATED_USER']) or (self.lockedBy==''):
             ext=self.ZopeFind(self,obj_ids=["addNewVersion.dtml"])              ext=self.ZopeFind(self.aq_parent,obj_ids=["addNewVersion.dtml"])
             if ext:              if ext:
                 return ext[0][1]('',globals(),version='1',AUTHENTICATED_USER=self.REQUEST.AUTHENTICATED_USER)                  return ext[0][1]('',globals(),version=self.getVersion(),lastComment=self.getLastVersion().getVersionComment(),AUTHENTICATED_USER=self.REQUEST.AUTHENTICATED_USER)
             else:              else:
                 out=DTMLFile('dtml/fileAdd', globals(),Kind='VersionedFileObject',kind='versionedFileObject',version=self.getVersion()).__of__(self)                  out=DTMLFile('dtml/fileAdd', globals(),Kind='VersionedFileObject',kind='versionedFileObject',version=self.getVersion()).__of__(self)
                 return out()                  return out()
Line 965  class versionedFile(CatalogAware,Folder) Line 995  class versionedFile(CatalogAware,Folder)
         objs=self.ZopeFind(self,obj_ids=[id])[0][1].setVersionNumber(int(self.getVersion()))          objs=self.ZopeFind(self,obj_ids=[id])[0][1].setVersionNumber(int(self.getVersion()))
         self.REQUEST.SESSION['objID_parent']=self.getId()          self.REQUEST.SESSION['objID_parent']=self.getId()
   
           if getattr(self,'defaultFileCatalog',None):
               
               self.reindex_object()
               
         if RESPONSE:          if RESPONSE:
             obj=self.ZopeFind(self,obj_ids=[id])[0][1]              obj=self.ZopeFind(self,obj_ids=[id])[0][1]
             if obj.getSize()==0:              if obj.getSize()==0:

Removed from v.1.58  
changed lines
  Added in v.1.63


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