Diff for /cdli/cdli_files.py between versions 1.25 and 1.26

version 1.25, 2006/06/15 22:02:40 version 1.26, 2006/06/17 14:53:35
Line 1062  class CDLIFileObject(versionedFileObject Line 1062  class CDLIFileObject(versionedFileObject
           
     security=ClassSecurityInfo()      security=ClassSecurityInfo()
           
    
       security.declarePublic('makeThisVersionCurrent')
       
       def makeThisVersionCurrent_html(self):
           """form for making this version current"""
           
           pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','makeThisVersionCurrent.zpt')).__of__(self)
           return pt()                 
       def makeThisVersionCurrent(self,comment,author):
           """copy this version to current"""
           parent=self.aq_parent
           
           
           newversion=parent.manage_addCDLIFileObject('',comment,author)
           newversion.data=self.data[0:]
           return True
       
       security.declarePublic('view')
                                           
     def view(self):      def view(self):
         """view file"""          """view file"""
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','viewCDLIFile.zpt')).__of__(self)          pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','viewCDLIFile.zpt')).__of__(self)
Line 1121  class CDLIFile(versionedFile,CatalogAwar Line 1140  class CDLIFile(versionedFile,CatalogAwar
     meta_type="CDLI file"      meta_type="CDLI file"
     default_catalog='CDLICatalog'      default_catalog='CDLICatalog'
           
       #security.declarePublic('history')
       def history(self):
           """history"""  
   
           ext=self.ZopeFind(self.aq_parent,obj_ids=["history_template.html"])
           if ext:
               return getattr(self,ext[0][1].getId())()
           
           pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','versionHistory')).__of__(self)
           return pt()
   
           
     
     def isContainedInBaskets(self,context=None):      def isContainedInBaskets(self,context=None):
Line 1321  class CDLIFileFolder(versionedFileFolder Line 1351  class CDLIFileFolder(versionedFileFolder
                     
                   
                                                                         
       def findObjectsFromListWithVersion(self,list):
           """find objects from a list with versions
           @param list: list of tuples  (cdliFile,version)
           """
           
          
          
           #self.REQUEST.SESSION['fileIds']=list#store fieldIds in session for further usage
           #self.REQUEST.SESSION['searchList']=self.REQUEST.SESSION['fileIds']
           
           
           pt=getattr(self,'filelistVersioned.html')
               
           return pt(search=list)
       
   
   
     def findObjectsFromList(self,display=False,start=None,upload=None,list=None,basketName=None,numberOfObjects=None,RESPONSE=None):      def findObjectsFromList(self,display=False,start=None,upload=None,list=None,basketName=None,numberOfObjects=None,RESPONSE=None):
Line 1493  class CDLIRoot(Folder): Line 1538  class CDLIRoot(Folder):
           
     meta_type="CDLIRoot"      meta_type="CDLIRoot"
           
     def getChangesByAuthor(self,author):      def forceunlock(self):
           "break all locks"
           ret=[]
           for f in self.ZopeFind(self,obj_metatypes="CDLI file",search_sub=1):
              un=f[1].forceunlock()
              print un
              if un and un !="":
                  ret.append((f[0],un))
           print ret
           return ret                       
       
       def getChangesByAuthor(self,author,n=100):
         """getChangesByAuthor"""          """getChangesByAuthor"""
         zcat=self.CDLICatalog          zcat=self.CDLIObjectsCatalog
         return zcat({'lastEditor':author,          res=zcat({'lastEditor':author,
                      'sort_on':'getTime',                       'sort_on':'getTime',
                      'sort_order':'descending',                       'sort_order':'descending',
                      'sort_limit':n})[:n ]                       'sort_limit':n})[:n ]
                                                                                 
           return res
       
       def getChangesByAuthor_html(self,author,n=100):
           """html output for changes by author"""
           tmp={}
           list=[]                         
           for x in self.getChangesByAuthor(author):
              nr=x.getObject().getVersionNumber()
              id=x.getObject().aq_parent.getId()
              #hinzufuegen, wenn Version neuer als die 
              if tmp.get(id,(0,0))[1] < nr:
                   tmp[id]=(x.getObject().aq_parent,nr)
   
        
           return self.cdli_main.findObjectsFromListWithVersion(list=tmp.values())           
           
     def getLastChanges(self,n=100):      def getLastChanges(self,n=100):
         """get the last n changes"""           """get the last n changes""" 
         n=int(n)                             n=int(n)                   

Removed from v.1.25  
changed lines
  Added in v.1.26


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