--- ECHO_content/ECHO_collection.py 2005/11/25 18:46:40 1.255 +++ ECHO_content/ECHO_collection.py 2005/11/29 13:48:44 1.256 @@ -83,6 +83,90 @@ def setECHO_collectionInformation(self,t self.credits=toList(credits) self.weight=weight +class ECHO_partner(Image,Persistent,ECHO_basis): + """ECHO Partner""" + + meta_type="ECHO_partner" + + def __init__(self, id, title,url, file, copyrightType, person, email, country, color, content_type='', precondition=''): + self.__name__=id + self.title=title + self.url=url + self.person=person + self.email=email + self.country=country + self.color=color + self.precondition=precondition + self.copyrightType=copyrightType + data, size = self._read_data(file) + content_type=self._get_content_type(file, data, id, content_type) + self.update_data(data, content_type, size) + + manage_options = Image.manage_options+( + {'label':'Partner Information','action':'ECHO_partner_config'}, + ) + + + def changeECHO_partner(self,url,copyrightType,person, email, country, color, RESPONSE=None): + """Change main information""" + self.url=url + self.person=person + self.email=email + self.country=country + self.color=color + self.copyrightType=copyrightType + if RESPONSE is not None: + RESPONSE.redirect('manage_main') + + + + def ECHO_partner_config(self): + """Main configuration""" + if not hasattr(self,'url'): + self.url="" + pt=zptFile(self, 'zpt/ChangeECHO_partner.zpt') + return pt() + + +manage_addECHO_partnerForm=DTMLFile('dtml/ECHO_partnerAdd',globals(), + Kind='ECHO_partner',kind='ECHO_partner') + + + +def manage_addECHO_partner(self, id, url, person, email, country, color, file=None, copyrightType='', title='', precondition='', content_type='', + REQUEST=None): + """ + Add a new ECHO_partner object. + + Creates a new ECHO_partner object 'id' with the contents of 'file'. + Based on Image.manage_addImage + """ + + id=str(id) + title=str(title) + content_type=str(content_type) + precondition=str(precondition) + + id, title = OFS.Image.cookId(id, title, file) + + self=self.this() + + # First, we create the image without data: + self._setObject(id, ECHO_partner(id,title,url,'',copyrightType, person, email, country, color, content_type, precondition)) + + # Now we "upload" the data. By doing this in two steps, we + # can use a database trick to make the upload more efficient. + if file: + self._getOb(id).manage_upload(file) + if content_type: + self._getOb(id).content_type=content_type + + if REQUEST is not None: + try: url=self.DestinationURL() + except: url=REQUEST['URL1'] + REQUEST.RESPONSE.redirect('%s/manage_main' % url) + return id + class ECHO_locale(ZopePageTemplate): """localisierung""" @@ -1625,16 +1709,22 @@ def manage_addECHO_link(self,id,title,la RESPONSE.redirect('manage_main') -class ECHO_collection(Folder, Persistent, Implicit, Cacheable,ECHO_basis): +class ECHO_collection(CatalogAware, Folder, Persistent, Implicit, Cacheable,ECHO_basis): """ECHO Collection""" security=ClassSecurityInfo() meta_type='ECHO_collection' + default_catalog='resourceCatalog' + # viewClassificationList=viewClassificationListMaster displayTypes=displayTypes path="/mpiwg/online/permanent/shipbuilding" + def getMDValueSimpleSearchField(self): + """returns value for simple search""" + return " ".join([self.title,self.description]) + def getTitleAndLabel(self): """gibt title und label zurueck""" return (getattr(self,'title',''),getattr(self,'label','')) @@ -2115,14 +2205,19 @@ class ECHO_collection(Folder, Persistent areas = self.getAllMapAreas() return self.createJSAreas(areas) + + emptyPartner=ECHO_partner("", "","", "", "", "", "", "", "") + security.declarePublic('getCreditObject') def getCreditObject(self,name): """credit id to credititem""" try: return getattr(self.partners,name) except: - return "" - + + return self.emptyPartner + + security.declarePublic('ECHO_generateNavBar') def ECHO_generateNavBar(self): """Erzeuge Navigationsbar""" @@ -2685,7 +2780,7 @@ class ECHO_root(Folder,Persistent,Implic for resource in resources: resource[1].reindex() - print "

done %s

\n" + #print "

done %s

\n" if RESPONSE: RESPONSE.write("

done %s

\n"%resource[0]) @@ -3509,89 +3604,6 @@ def manage_addECHO_copyrightType(self,id -class ECHO_partner(Image,Persistent,ECHO_basis): - """ECHO Partner""" - - meta_type="ECHO_partner" - - def __init__(self, id, title,url, file, copyrightType, person, email, country, color, content_type='', precondition=''): - self.__name__=id - self.title=title - self.url=url - self.person=person - self.email=email - self.country=country - self.color=color - self.precondition=precondition - self.copyrightType=copyrightType - data, size = self._read_data(file) - content_type=self._get_content_type(file, data, id, content_type) - self.update_data(data, content_type, size) - - manage_options = Image.manage_options+( - {'label':'Partner Information','action':'ECHO_partner_config'}, - ) - - - def changeECHO_partner(self,url,copyrightType,person, email, country, color, RESPONSE=None): - """Change main information""" - self.url=url - self.person=person - self.email=email - self.country=country - self.color=color - self.copyrightType=copyrightType - if RESPONSE is not None: - RESPONSE.redirect('manage_main') - - - - def ECHO_partner_config(self): - """Main configuration""" - if not hasattr(self,'url'): - self.url="" - pt=zptFile(self, 'zpt/ChangeECHO_partner.zpt') - return pt() - - -manage_addECHO_partnerForm=DTMLFile('dtml/ECHO_partnerAdd',globals(), - Kind='ECHO_partner',kind='ECHO_partner') - - - -def manage_addECHO_partner(self, id, url, person, email, country, color, file=None, copyrightType='', title='', precondition='', content_type='', - REQUEST=None): - """ - Add a new ECHO_partner object. - - Creates a new ECHO_partner object 'id' with the contents of 'file'. - Based on Image.manage_addImage - """ - - id=str(id) - title=str(title) - content_type=str(content_type) - precondition=str(precondition) - - id, title = OFS.Image.cookId(id, title, file) - - self=self.this() - - # First, we create the image without data: - self._setObject(id, ECHO_partner(id,title,url,'',copyrightType, person, email, country, color, content_type, precondition)) - - # Now we "upload" the data. By doing this in two steps, we - # can use a database trick to make the upload more efficient. - if file: - self._getOb(id).manage_upload(file) - if content_type: - self._getOb(id).content_type=content_type - - if REQUEST is not None: - try: url=self.DestinationURL() - except: url=REQUEST['URL1'] - REQUEST.RESPONSE.redirect('%s/manage_main' % url) - return id class ECHO_linkList(ZopePageTemplate,ECHO_basis): """LinkList Objekt"""