version 1.24, 2006/06/15 20:08:44
|
version 1.25, 2006/06/15 22:02:40
|
Line 233 class uploadATFThread(Thread):
|
Line 233 class uploadATFThread(Thread):
|
"""upload an atf file""" |
"""upload an atf file""" |
#TODO: add comments |
#TODO: add comments |
#TODO: finish uploadATF |
#TODO: finish uploadATF |
self.result="<html><body><h2>I am loading your file...</h2>" |
self.result="<html><body><h2>I got your file, start now to split it into single atf-files!</h2><p>" |
|
|
#make sure that id is a string and not an integer |
#make sure that id is a string and not an integer |
basketId=str(basketId) |
basketId=str(basketId) |
|
|
Line 250 class uploadATFThread(Thread):
|
Line 251 class uploadATFThread(Thread):
|
psNotInCatalog=[] # files not in the catalog |
psNotInCatalog=[] # files not in the catalog |
|
|
#split the uploadedd atf file |
#split the uploadedd atf file |
basketNameFromFile, numberOfFiles=splitatf(upload,dir) |
basketNameFromFile, numberOfFiles=splitatf(upload,dir,ext=self) |
|
|
#find basketId if not set |
#find basketId if not set |
|
|
Line 269 class uploadATFThread(Thread):
|
Line 270 class uploadATFThread(Thread):
|
basketLen=getattr(ctx2.basketContainer,basketId).getLastVersion().numberOfItems() |
basketLen=getattr(ctx2.basketContainer,basketId).getLastVersion().numberOfItems() |
|
|
|
|
self.result+="<html><body><h2>I got the files</h2><p>I am checking now the files</p>" |
self.result+="""<html><body><h2>I got the files</h2>< |
|
p>I am computing the differences to the exisiting files</p>""" |
|
|
#start to check the files |
#start to check the files |
for fn in os.listdir(dir): |
for fn in os.listdir(dir): |
|
|
self.result+="<p>check:%s</p>"%fn |
self.result+="<p>process:%s</p>"%fn |
|
|
# check if file is in the catalog |
# check if file is in the catalog |
#TODO: checkCatalog is not implemented yet |
#TODO: checkCatalog is not implemented yet |
Line 1052 def manage_addCDLIBasketVersion(self,use
|
Line 1054 def manage_addCDLIBasketVersion(self,use
|
else: |
else: |
return ob |
return ob |
|
|
class CDLIFileObject(versionedFileObject): |
class CDLIFileObject(versionedFileObject,CatalogAware): |
"""CDLI file object""" |
"""CDLI file object""" |
|
|
meta_type="CDLI File Object" |
meta_type="CDLI File Object" |
|
default_catalog='CDLIObjectsCatalog' |
|
|
security=ClassSecurityInfo() |
security=ClassSecurityInfo() |
|
|
Line 1230 def manage_addCDLIFile(self,id,title,loc
|
Line 1233 def manage_addCDLIFile(self,id,title,loc
|
|
|
|
|
|
|
def splitatf(fh,dir=None): |
def splitatf(fh,dir=None,ext=None): |
"""split it""" |
"""split it""" |
ret=None |
ret=None |
nf=None |
nf=None |
|
i=0 |
for line in fh.readlines(): |
for line in fh.readlines(): |
|
if ext: |
|
i+=1 |
|
if (i%100)==0: |
|
ext.result+="." |
|
if i==10000: |
|
i=0 |
|
ext.result+="<br>" |
#check if basket name is in the first line |
#check if basket name is in the first line |
if line.find("#atf basket")>=0: |
if line.find("#atf basket")>=0: |
ret=line.replace('#atf basket ','') |
ret=line.replace('#atf basket ','') |
Line 1265 class CDLIFileFolder(versionedFileFolder
|
Line 1276 class CDLIFileFolder(versionedFileFolder
|
filesMetaType=['CDLI file'] |
filesMetaType=['CDLI file'] |
folderMetaType=['CDLI Folder'] |
folderMetaType=['CDLI Folder'] |
default_catalog='CDLICatalog' |
default_catalog='CDLICatalog' |
|
defaultFileCatalog=default_catalog #wenn dieses definiert ist, wird beim hinzufgen einer neuen version eines files dieser catalog neuiniziert |
|
|
tmpStore2={} |
tmpStore2={} |
def setTemp(self,name,value): |
def setTemp(self,name,value): |
"""set tmp""" |
"""set tmp""" |
Line 1310 class CDLIFileFolder(versionedFileFolder
|
Line 1323 class CDLIFileFolder(versionedFileFolder
|
|
|
|
|
|
|
def findObjectsFromList(self,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): |
"""findObjectsFromList (, TAB oder LINE separated)""" |
"""findObjectsFromList (, TAB oder LINE separated)""" |
|
|
|
|
Line 1347 class CDLIFileFolder(versionedFileFolder
|
Line 1360 class CDLIFileFolder(versionedFileFolder
|
|
|
ret+=self.CDLICatalog({'title':fileId}) |
ret+=self.CDLICatalog({'title':fileId}) |
#TODO: get rid of one of these.. |
#TODO: get rid of one of these.. |
self.REQUEST.SESSION['fileIds']=[x.getObject().getId() for x in ret]#store fieldIds in session for further usage |
ids=[x.getObject().getId() for x in ret] |
|
self.REQUEST.SESSION['fileIds']=ids#store fieldIds in session for further usage |
self.REQUEST.SESSION['searchList']=self.REQUEST.SESSION['fileIds'] |
self.REQUEST.SESSION['searchList']=self.REQUEST.SESSION['fileIds'] |
|
|
|
if display: |
|
pt=getattr(self,'filelist.html') |
|
|
|
return pt(search=ids) |
|
else: |
return ret |
return ret |
|
|
|
|
|
|
if start: |
if start: |
RESPONSE.redirect("filelist.html?start:int="+str(start)) |
RESPONSE.redirect("filelist.html?start:int="+str(start)) |
|
|
Line 1471 class CDLIRoot(Folder):
|
Line 1493 class CDLIRoot(Folder):
|
|
|
meta_type="CDLIRoot" |
meta_type="CDLIRoot" |
|
|
|
def getChangesByAuthor(self,author): |
|
"""getChangesByAuthor""" |
|
zcat=self.CDLICatalog |
|
return zcat({'lastEditor':author, |
|
'sort_on':'getTime', |
|
'sort_order':'descending', |
|
'sort_limit':n})[:n ] |
|
|
|
def getLastChanges(self,n=100): |
|
"""get the last n changes""" |
|
n=int(n) |
|
zcat=self.CDLICatalog |
|
return zcat({'sort_on':'getLastChangeDate', |
|
'sort_order':'descending', |
|
'sort_limit':n})[:n ] |
|
|
|
|
|
def getLastChanges_html(self,n=100): |
|
"""get the last n changes""" |
|
list = [x.getId for x in self.getLastChanges(n)] |
|
return self.cdli_main.findObjectsFromList(list=list,display=True) |
|
|
def refreshTxt(self,txt="",threadName=None): |
def refreshTxt(self,txt="",threadName=None): |
"""txt fuer refresh""" |
"""txt fuer refresh""" |
|
|