from OFS.Folder import Folder from AccessControl import ClassSecurityInfo from Globals import InitializeClass from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate from Globals import Persistent from Acquisition import Implicit class ECHO_collection(Folder, Persistent, Implicit): """ECHO Collection""" security=ClassSecurityInfo() meta_type='ECHO_collection' class scientificInformation(Persistent,Implicit): """subclass scientificInformation""" security=ClassSecurityInfo() class scientificClassification(Persistent,Implicit): """subclass""" security=ClassSecurityInfo() def __init__(self,context,science,practice): self.context=context self.science=science self.practice=practice security.declarePublic('get_context') def get_context(self): return self.context security.declarePublic('get_science') def get_science(self): return self.science security.declarePublic('get_practice') def get_practice(self): return self.practice def __init__(self,source_type,period,scientific_classification): self.source_type=source_type self.period=period self.scientific_classification=scientific_classification security.declarePublic('get_source_type') def get_source_type(self): return self.source_type security.declarePublic('get_period') def get_period(self): return self.period security.declarePublic('get_scientific_classification') def get_scientific_classification(self): return self.scientific_classification security.declarePublic('printall') def printall(self): return self.scientific_information.__dict__.keys() def __init__(self,id,title,label,description,content_type,responsible,scientific_information): self.id = id """Festlegen der ID""" self.label = label self.title=title self.description=description self.content_type=content_type self.responsible=responsible self.scientific_information=scientific_information manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_Collection_config'}, ) security.declarePublic('ECHO_Collection_config') def ECHO_Collection_config(self): """Main configuration""" pt=PageTemplateFile('products/ECHO_content/ChangeECHO_Collection.zpt').__of__(self) return pt() security.declarePublic('changeECHO_Collection') def changeECHO_Collection(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,RESPONSE=None): """Änderung der Properties""" self.label = label self.title=title self.description=description self.content_type=content_type self.responsible=responsible self.scientific_information.source_type=source_type self.scientific_information.period=period self.scientific_information.scientific_classification.context=context self.scientific_information.scientific_classification.science=science self.scientific_information.scientific_classification.practice=practice if RESPONSE is not None: RESPONSE.redirect('manage_main') security.declarePublic('index_html') def index_html(self): """standard page""" pt=PageTemplateFile('products/ECHO_content/ECHO_content_standard.zpt').__of__(self) return pt() def getSubCols(self): ids=[] for entry in self.__dict__.keys(): object=getattr(self,entry) print "OB:",object try: print "MT:",object.meta_type if object.meta_type=='ECHO_collection': print "HI" ids.append(object) print "ID",ids except: """nothing""" return ids def manage_AddECHO_collectionForm(self): """Nothing yet""" pt=PageTemplateFile('products/ECHO_content/AddECHO_collectionForm.zpt').__of__(self) return pt() def manage_AddECHO_collection(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,RESPONSE=None): """nothing yet""" scientificClassification=ECHO_collection.scientificInformation.scientificClassification(context,science,practice) scientificInformation=ECHO_collection.scientificInformation(source_type,period,scientificClassification) newObj=ECHO_collection(id,title,label,description,content_type,responsible,scientificInformation) self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main')