--- ECHO_content/ECHO_collection.py 2004/02/11 17:45:29 1.14 +++ ECHO_content/ECHO_collection.py 2004/03/30 15:30:58 1.21 @@ -24,7 +24,8 @@ from Products.PageTemplates.PageTemplate from Products.PageTemplates.PageTemplate import PageTemplate from Globals import Persistent from Acquisition import Implicit -from pyPgSQL import libpq +#from psycopg import libpq +#from pyPgSQL import libpq import xml.dom.minidom import urllib @@ -230,19 +231,21 @@ class ECHO_resource(Folder): if not hasattr(self,'coords'): self.coords=[] + print "vorher",self.coords pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_resource.zpt').__of__(self) return pt() def changeECHO_resource(self,metalink,link,title,label,description,content_type,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None): - - """Änderung der Properties""" - - setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coords,viewClassification) - + coordsnew=[ string.split(x,",") for x in coords] + + + setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordsnew) + + self.coords=coordsnew[0:] self.link=link self.metalink=metalink @@ -256,9 +259,15 @@ class ECHO_resource(Folder): {'label':'Graphics','action':'ECHO_graphicEntry'}, ) + def getOverview(self): + """overview graphics""" + + return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1] + def ECHO_graphicEntry(self): """DO nothing""" - if 'overview' in self.aq_parent.__dict__.keys(): + overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview']) + if overview: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self) return pt() else: @@ -369,11 +378,11 @@ class ECHO_externalLink(Folder): def changeECHO_externalLink(self,link,title,label,description,content_type,responsible,weight,coords=None,credits=None,RESPONSE=None): """Änderung der Properties""" - + coordsnew=[ string.split(x,",") for x in coords] setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coords) - + self.coords=coordsnew[0:] self.link=link if RESPONSE is not None: RESPONSE.redirect('manage_main') @@ -382,7 +391,14 @@ class ECHO_externalLink(Folder): manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_externalLink_config'}, ) - + + def getCredits(self): + """Ausgabe der credits""" + if self.credits: + return self.credits + else: + return [] + def index_html(self): """standard page""" @@ -415,8 +431,11 @@ class ECHO_collection(Folder, Persistent security.declarePublic('getCreditObject') def getCreditObject(self,name): """credit id to credititem""" - return getattr(self.partners,name) - + try: + return getattr(self.partners,name) + except: + return "" + security.declarePublic('ECHO_generateNavBar') def ECHO_generateNavBar(self): """Erzeuge Navigationsbar""" @@ -454,6 +473,8 @@ class ECHO_collection(Folder, Persistent """nothing""" return "Rerenderd all links to resources in: "+self.title + + security.declarePublic('ECHO_newViewerLink') def getCoords(self): @@ -491,9 +512,18 @@ class ECHO_collection(Folder, Persistent ) + def getOverview(self): + """overview graphics""" + + return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1] + + def ECHO_graphicEntry(self): """DO nothing""" - if 'overview' in self.aq_parent.__dict__.keys(): + overview = self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview']) + + + if overview: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_draw.zpt').__of__(self) return pt() else: @@ -534,10 +564,12 @@ class ECHO_collection(Folder, Persistent def changeECHO_collection(self,title,label,description,content_type,responsible,weight,credits=None,sortfield="weight",coords=None,RESPONSE=None): """Änderung der Properties""" + coordsnew=[ string.split(x,",") for x in coords] setECHO_collectionInformation(self,title,label,description,content_type,responsible,credits,weight,coordsnew) - + + self.coords=coordsnew[0:] self.sortfield=sortfield if RESPONSE is not None: @@ -545,7 +577,7 @@ class ECHO_collection(Folder, Persistent security.declarePublic('index_html') - showOverview=DTMLFile('ECHO_content_overview',globals()) + showOverview=DTMLFile('dtml/ECHO_content_overview',globals()) def index_html(self): @@ -649,6 +681,26 @@ class ECHO_root(Folder,Persistent,Implic """ECHO Root Folder""" meta_type="ECHO_root" + def ECHO_newViewerLink(self,obj=None): + """change links (:86 faellt weg)""" + + if not obj: + obj = self + + entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection']) + + for entry in entries: + + if entry[1].meta_type == 'ECHO_resource': + + entry[1].link=re.sub('\:86','',entry[1].link) + + else: + + entry[1].ECHO_newViewerLink(entry[1]) + + return "Rerenderd all links to resources in: "+self.title + def __init__(self,id,title): """init""" self.id = id