"""New version of the product started February, 8th. Without scientific classification, use content-type for further classification.""" """Echo collection provides the classes for the ECHO content web-site. class ECHO_collection is the basis class for an ECHO collection. class ECHO_resource contains information on ECHO resources (e.g. an Display environment for Metadata class ECHO_externalLink contains information on externalLinks """ import string import re import os import OFS.Image from types import * from OFS.Image import Image from Globals import DTMLFile from OFS.Folder import Folder from OFS.SimpleItem import SimpleItem from AccessControl import ClassSecurityInfo from Globals import InitializeClass from Globals import DTMLFile from Products.PageTemplates.PageTemplateFile import PageTemplateFile from Products.PageTemplates.PageTemplate import PageTemplate from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate from Globals import Persistent, package_home from Acquisition import Implicit from ECHO_helpers import displayTypes try: from psycopg import libpq except: try: from pyPgSQL import libpq except: print "ECHO_collection: Warning - No libpq imported!" import xml.dom.minidom import urllib import xml.dom.minidom from ECHO_graphicalOverview import javaHandler,javaScriptMain import ECHO_helpers #List of different types for the graphical linking viewer viewClassificationListMaster=['view point','area'] def content_html(self,type): """template fuer content""" #templates = self.ZopeFind(self.aq_parent,obj_ids=[type+"_template"]) # #if templates: # return templates[0][1]() try: obj=getattr(self,type+"_template") return obj() except: pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_%s_template_standard.zpt'%type).__of__(self) pt.content_type="text/html" return pt() def toList(field): """Einzelfeld in Liste umwandeln""" if type(field)==StringType: return [field] else: return field def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc def sendFile(self, filename, type): """sends an object or a local file (in the product) as response""" paths = filename.split('/') object = self # look for an object called filename for path in paths: if hasattr(object, path): object = getattr(object, path) else: object = None break if object: # if the object exists then send it object() else: # send a local file with the given content-type fn = os.path.join(package_home(globals()), filename) self.REQUEST.RESPONSE.setHeader("Content-Type", type) self.REQUEST.RESPONSE.write(file(fn).read()) return def readMetadata(url): """Methoden zum Auslesen der Metadateninformation zu einer Resource Vorerst noch Typ bib""" metadict={} try: geturl="" for line in urllib.urlopen(url).readlines(): geturl=geturl+line except: return (None,"Cannot open: "+url) try: dom=xml.dom.minidom.parseString(geturl) except: return (None,"Cannot parse: "+url+"
"+geturl) metanode=dom.getElementsByTagName('bib') metadict['bib_type']='Book' if len(metanode)==0: metanode=dom.getElementsByTagName('archimedes') metadict['bib_type']='Archimedes' #print "HELLO" if not len(metanode)==0: metacontent=metanode[0].childNodes try: metadict['bib_type']=getText(dom.getElementsByTagName('bib')[0].attributes['type'].childNodes) except: """nothing""" for node in metacontent: try: metadict[node.tagName.lower()]=getText(node.childNodes) except: """nothing""" #print metadict return metadict,"" def setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordstrs,viewClassification=""): """Allegemeine Informationen zu einer ECHO Collection""" self.viewClassification=viewClassification self.label = label self.title=title self.description=description self.contentType=contentType self.responsible=responsible self.credits=toList(credits) self.weight=weight coords=[] #coordinates of for rectangles #print "cs", coordstrs if coordstrs: for coordstr in coordstrs: #print "cs", coordstr try: temco=coordstr.split(",") except: temco=[] #temco.append(angle) coords.append(temco) self.coords=coords[0:] class scientificClassification(SimpleItem,Persistent,Implicit): """outdated will be deleeted in the next versions: subclass""" security=ClassSecurityInfo() def __init__(self,context,science,practice): self.context=context self.science=science self.practice=practice self.id="scientific_Classification" 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 class scientificInformation(Folder,Persistent,Implicit): """outdated will be deleted in the next versions: subclass scientificInformation""" security=ClassSecurityInfo() def __init__(self,source_type,period): self.id="scientific_Information" self.source_type=source_type self.period=period 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 class ECHO_layoutTemplate(ZopePageTemplate): """Create a layout Template for different purposes""" meta_type="ECHO_layoutTemplate" def __init__(self, id, text=None, content_type=None,EchoType=None): self.id = str(id) self.ZBindings_edit(self._default_bindings) if text is None: self._default_content_fn = os.path.join(package_home(globals()), 'zpt/ECHO_%s_template_standard.zpt'%EchoType) text = open(self._default_content_fn).read() self.pt_edit(text, content_type) """change form""" def manage_addECHO_layoutTemplateForm(self): """Form for adding""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_layoutTemplate.zpt').__of__(self) return pt() from urllib import quote def manage_addECHO_layoutTemplate(self, EchoType,title=None,REQUEST=None): "Add a Page Template with optional file content." if type(EchoType)==StringType: EchoTypes=[EchoType] else: EchoTypes=EchoType for singleType in EchoTypes: id = str(singleType)+"_template" if REQUEST is None: self._setObject(id, ECHO_layoutTemplate(id, text,EchoType=singleType)) ob = getattr(self, id) if title: ob.pt_setTitle(title) return ob else: file = REQUEST.form.get('file') headers = getattr(file, 'headers', None) if headers is None or not file.filename: zpt = ECHO_layoutTemplate(id,EchoType=singleType) else: zpt = ECHO_layoutTemplate(id, file, headers.get('content_type')) self._setObject(id, zpt) ob = getattr(self, id) if title: ob.pt_setTitle(title) try: u = self.DestinationURL() except AttributeError: u = REQUEST['URL1'] REQUEST.RESPONSE.redirect(u+'/manage_main') return '' class ECHO_resource(Folder): """ECHO Ressource""" meta_type='ECHO_resource' viewClassificationList=viewClassificationListMaster getSubCols = ECHO_helpers.getSubCols def getTitle(self): """title""" return self.title.encode('utf-8') def getLabel(self): """title""" return self.label.encode('utf-8') def content_html(self): """template fuer content""" return content_html(self,'resource') def getViewClassification(self): if hasattr(self,'viewClassification'): return self.viewClassification else: return "" def getCredits(self): """Ausgabe der credits""" if self.credits: return self.credits else: return [] def __init__(self,id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords): self.id = id """Festlegen der ID""" self.label = label self.link= link self.metalink=metalink self.title=title self.weight=weight self.credits=toList(credits) self.description=description self.contentType=contentType self.responsible=responsible if coords: coordsnew=[ string.split(x,",") for x in coords] else: coordsnew=[] self.coords=coordsnew def getCoords(self): try: return [string.join(x,",") for x in self.coords] except: return [] def getContentType(self): try: return self.contentType except: return "" def ECHO_resource_config(self): """Main configuration""" if not hasattr(self,'weight'): self.weight="" 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,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None): """Änderung der Properties""" try: coordsnew=[ string.split(x,",") for x in coords] except: coordsnew=[] setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) self.viewClassification=viewClassification self.coords=coordsnew[0:] self.link=link self.metalink=metalink if RESPONSE is not None: RESPONSE.redirect('manage_main') manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_resource_config'}, {'label':'Metadata','action':'ECHO_getResourceMD'}, {'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""" 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: return "NO OVERVIEW GRAPHICS" def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None): """Enter coords""" coords=self.coords temco=coordstr.split(",") temco.append(angle) coords.append(temco) self.coords=coords[0:] if RESPONSE is not None: RESPONSE.redirect('ECHO_graphicEntry') def ECHO_getResourceMD(self,template="yes"): """Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource""" (metadict, error)=readMetadata(self.metalink) if not error=="": #Fehler beim Auslesen des Metafiles return "ERROR:",error for key in metadict.keys():#Hinzufügen der Felder setattr(self,key,metadict[key].encode('ascii','replace')) self.metadata=metadict.keys() self.label=self.generate_label() if template=="yes": pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_resourceMD.zpt').__of__(self) return pt() def ECHO_getMD(self,item): """Ausgabe der MD""" return getattr(self,item) def index_html(self): """standard page""" return self.REQUEST.RESPONSE.redirect(self.link) def generate_label(self): """Erzeugt_standard_Label aus Template""" pt=getattr(self,"label_template_"+self.bib_type) return pt() def manage_addECHO_resourceForm(self): """Form for adding a ressource""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_resourceForm.zpt').__of__(self) return pt() def manage_addECHO_resource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None): """addaresource""" newObj=ECHO_resource(id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords) self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main') class ECHO_externalLink(Folder): """Link zu einer externen Ressource""" security=ClassSecurityInfo() meta_type='ECHO_externalLink' def getTitle(self): """title""" return self.title.encode('utf-8') def getLabel(self): """title""" return self.label.encode('utf-8') def content_html(self): """template fuer content""" return content_html(self,'externalLink') def __init__(self,id,link,title,label,description,contentType,responsible,credits,weight,coords): self.id = id """Festlegen der ID""" self.credits=toList(credits) self.label = label self.link= link self.title=title self.weight=weight self.description=description self.contentType=contentType self.responsible=responsible coordsnew=[ string.split(x,",") for x in coords] self.coords=coordsnew def ECHO_externalLink_config(self): """Main configuration""" if not hasattr(self,'weight'): self.weight="" if not hasattr(self,'coords'): self.coords=[''] #print "G",self.coords pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_externalLink.zpt').__of__(self) return pt() def changeECHO_externalLink(self,link,title,label,description,contentType,responsible,weight,coords=None,credits=None,RESPONSE=None): """Änderung der Properties""" try: coordsnew=[ string.split(x,",") for x in coords] except: coordsnew=[] setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coords) self.coords=coordsnew[0:] self.link=link if RESPONSE is not None: RESPONSE.redirect('manage_main') 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""" return self.REQUEST.RESPONSE.redirect(self.link) def manage_addECHO_externalLinkForm(self): """Form for external Links""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_externalLinkForm.zpt').__of__(self) return pt() def manage_addECHO_externalLink(self,id,title,label,description,contentType,responsible,link,weight,coords=None,credits=None,RESPONSE=None): """Add an external Link""" newObj=ECHO_externalLink(id,link,title,label,description,contentType,responsible,credits,weight,coords) self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main') class ECHO_link(ECHO_externalLink): """external_link""" meta_type="ECHO_link" def content_html(self): """template fuer content""" return content_html(self,'link') def manage_addECHO_linkForm(self): """Form for external Links""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_linkForm.zpt').__of__(self) return pt() def manage_addECHO_link(self,id,title,label,description,contentType,responsible,link,weight,coords=None,credits=None,RESPONSE=None): """Add an external Link""" newObj=ECHO_link(id,link,title,label,description,contentType,responsible,credits,weight,coords) self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main') class ECHO_collection(Folder, Persistent, Implicit): """ECHO Collection""" security=ClassSecurityInfo() meta_type='ECHO_collection' viewClassificationList=viewClassificationListMaster displayTypes=displayTypes def getViewClassification(self): if hasattr(self,'viewClassification'): return self.viewClassification else: return "" def getTitle(self): """title""" return self.title.encode('utf-8') def getLabel(self): """title""" return self.label.encode('utf-8') def createRessourcesFromXMLForm(self): """form""" pt=PageTemplateFile('Products/ECHO_content/zpt/createRessourcesFromXMLForm.zpt').__of__(self) return pt() def createRessourcesFromXML(self,fileupload): """read an XML file for generating resources""" dom=xml.dom.minidom.parse(fileupload) ret="

Added

" for resource in dom.getElementsByTagName('resource'): link=getText(resource.getElementsByTagName('link')[0].childNodes) label=getText(resource.getElementsByTagName('label')[0].childNodes) #splitted=link.split("?")[0].split("/") #id=splitted[len(splitted)-1].encode('ascii') id=re.sub(" ","_",label).encode('ascii') ret+="

"+label+"

" manage_addECHO_resource(self,id,label.encode('ascii'),label.encode('ascii'),"","","",link.encode('ascii'),"","") return ret def getImageTag(self): """GetTag""" try: return self.imageTag except: return "" def addResource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None): """SSS""" try: manage_addECHO_resource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None) return "done" except: return None def getSecondaryLink(self): """secondary link""" try: return self.secondaryLink except: return "" def getSecondaryLinkTitle(self): """secondary link""" try: return self.secondaryLinkTitle except: return "" def getCollectionTreeXML(self): """Tree as XML""" def getCollection(object,depth=0): depth+=1 collections="" for entry in object.__dict__.keys(): element=getattr(object,entry) try: if element.meta_type in ["ECHO_collection","ECHO_group"]: collections+="" collections+=getCollection(element,depth)+"\n" except: """nothing""" return collections ret="""""" return ret+""+getCollection(self)+"" def createJavaScript(self): """CreateJava""" #ret=javaScriptMain ret="" dynamical="\n" for ob in self.getGraphicCoords(): if ob[4][4] == "": #dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0]) dynamical+="""addArea('%s', 'overview', %s, 'area');\n"""%(ob[1],ob[0]) else: dynamical+="""addArea('%s', 'overview', %s, 'arrow');\n"""%(ob[1],ob[0]) #dynamical+="""Coords.push(new Coord('%s', Img, %s));//%s\n"""%(ob[1],ob[0],ob[4][4]) #dynamical+="ShowArrow(new getObj('i.%s'),Img,%s);\n"%(ob[1],ob[0]) #ret+=javaHandler%dynamical ret+=dynamical return ret security.declarePublic('getCreditObject') def getCreditObject(self,name): """credit id to credititem""" try: return getattr(self.partners,name) except: return "" security.declarePublic('ECHO_generateNavBar') def ECHO_generateNavBar(self): """Erzeuge Navigationsbar""" link="" object="self" ret=[] path=self.getPhysicalPath() for element in path: if not element=="": object+="."+element label=eval(object).label link+="/"+element if not label=="": ret.append((label,link)) return ret security.declarePublic('ECHO_rerenderLinksMD') def ECHO_rerenderLinksMD(self,obj=None): """Rerender all Links""" 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].ECHO_getResourceMD(template="no") print "rerender",entry[1].getId() else: self.ECHO_rerenderLinksMD(entry[1]) return "Rerenderd all links to resources in: "+self.title security.declarePublic('ECHO_newViewerLink') def getCoords(self): try: x= [string.join(x,",") for x in self.coords] return x except: return [] def __init__(self,id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle,secondaryLink,imageTag="",bgcolour=""): #print "CO",coords self.id = id """Festlegen der ID""" self.credits=toList(credits) self.label = label self.title=title self.description=description self.contentType=contentType self.responsible=responsible self.imageTag=imageTag self.weight=weight self.sortfield=sortfield coordsnew=[ string.split(x,",") for x in coords] self.coords=coordsnew self.secondaryLinkTitle=secondaryLinkTitle self.secondaryLink=secondaryLink self.bgcolour=bgcolour manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_collection_config'}, {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'}, {'label':'Graphics','action':'ECHO_graphicEntry'}, {'label':'create resources from XML','action':'createRessourcesFromXMLForm'}, ) def getOverview(self): """overview graphics""" return self.aq_parent.ZopeFind(self.aq_parent,obj_ids=['overview'])[0][1] def ECHO_graphicEntry(self): """DO nothing""" 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: return "NO OVERVIEW GRAPHICS" def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None): """Enter coords""" coords=self.coords temco=coordstr.split(",") temco.append(angle) coords.append(temco) self.coords=coords[0:] if RESPONSE is not None: RESPONSE.redirect('ECHO_graphicEntry') security.declarePublic('ECHO_collection_config') def ECHO_collection_config(self): """Main configuration""" if not hasattr(self,'weight'): self.weight="" if not hasattr(self,'sortfield'): self.sortfield="weight" if not hasattr(self,'coords'): self.coords=[] pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_collection.zpt').__of__(self) return pt() security.declarePublic('changeECHO_collection') def getBgcolour(self): """colour""" if hasattr(self,'bgcolour') and not (self.bgcolour==""): return self.bgcolour else: return "#dddddd" def changeECHO_collection(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",viewClassification=None): """Änderung der Properties""" self.secondaryLink=secondaryLink self.secondaryLinkTitle=secondaryLinkTitle self.imageTag=imageTag self.bgcolour=bgcolour self.viewClassification=viewClassification if coords: coordsnew=[ string.split(x,",") for x in coords] self.coords=coordsnew[0:] else: coordsnew=None self.coords=None setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) try: self.coords=coordsnew[0:] # HACK fehler in setECHO_collection except: """none""" self.sortfield=sortfield if RESPONSE is not None: RESPONSE.redirect('manage_main') security.declarePublic('index_html') def showOverview(self): """overview""" if 'ECHO_overview.html' in self.__dict__.keys(): return getattr(self,'ECHO_overview.html')() pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_content_overview.zpt').__of__(self) return pt() def index_html(self): """standard page""" if 'index.html' in self.__dict__.keys(): return getattr(self,'index.html')() elif 'overview' in self.__dict__.keys(): return self.showOverview() elif hasattr(self,'collection_index_template'): return self.collection_index_template() elif hasattr(self,'main_index_template'): return self.main_index_template() pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_main_index_template_standard.zpt').__of__(self) pt.content_type="text/html" return pt() def content_html(self): """template fuer content""" return content_html(self,'collection') def getCredits(self): """Ausgabe der credits""" if self.credits: return self.credits else: return [] def area_img(self): """area image""" sendFile(self, 'images/red.gif', 'image/gif') return def hl_lib_js(self): """javascript""" sendFile(self, 'js/hl_lib.js', 'text/plain') return def js_lib_js(self): """javascript""" sendFile(self, 'js/js_lib.js', 'text/plain') return def getGraphicCoords(self): """Give list of coordinates""" subColTypes=['ECHO_collection','ECHO_resource'] ids=[] for entrySearch in self.ZopeFind(self,obj_metatypes=subColTypes): object=entrySearch[1] if hasattr(object,'coords'): for coordtemp in object.coords: if len(coordtemp)>3: coord=coordtemp[0:4] label="" if hasattr(object,'label') and not object.label=="": label=object.label elif hasattr(object,'title') and not object.title=="": label=object.title else: label=object.getId() ids.append([string.join(coord,", "),object.getId(),label,object,coordtemp,object.viewClassification]) return ids getSubCols = ECHO_helpers.getSubCols def manage_addECHO_collectionForm(self): """Add collection form""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_collectionForm.zpt').__of__(self) return pt() def manage_addECHO_collection(self,id,title,label,description,contentType,responsible,weight,sortfield,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour=""): """add a echo collection""" newObj=ECHO_collection(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="") self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main') class ECHO_group(ECHO_collection): """ECHO Gruppe""" meta_type="ECHO_group" manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_group_config'}, {'label':'Rerender Links','action':'ECHO_rerenderLinksMD'}, {'label':'Graphics','action':'ECHO_graphicEntry'}, ) def index_html(self): """standard page""" displayedObjects=self.ZopeFind(self,obj_metatypes=displayTypes) #if (len(displayedObjects)==1) and (displayedObjects[0][1].meta_type=="ECHO_collection"): # nur ein Object dann redirect auf dieses Object # return self.REQUEST.RESPONSE.redirect(displayedObjects[0][1].absolute_url()) if 'index.html' in self.__dict__.keys(): return getattr(self,'index.html')() elif 'overview' in self.__dict__.keys(): return self.showOverview() elif hasattr(self,'group_index_template'): return self.group_index_template() elif hasattr(self,'collection_index_template'): return self.collection_index_template() elif hasattr(self,'main_index_template'): return self.main_index_template() pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_main_index_template_standard.zpt').__of__(self) pt.content_type="text/html" return pt() def ECHO_group_config(self): """Main configuration""" if not hasattr(self,'weight'): self.weight="" if not hasattr(self,'sortfield'): self.sortfield="weight" if not hasattr(self,'coords'): self.coords=[] pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_group.zpt').__of__(self) return pt() def changeECHO_group(self,title,label,description,contentType,responsible,weight,secondaryLink,secondaryLinkTitle,credits=None,sortfield="weight",coords=None,RESPONSE=None,imageTag="",bgcolour="",logo=""): """Änderung der Properties""" self.secondaryLink=secondaryLink self.secondaryLinkTitle=secondaryLinkTitle self.imageTag=imageTag self.bgcolour=bgcolour self.logo=logo if coords: coordsnew=[ string.split(x,",") for x in coords] self.coords=coordsnew[0:] else: coordsnew=None self.coords=None setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) self.sortfield=sortfield if RESPONSE is not None: RESPONSE.redirect('manage_main') def getLogo(self): """logo ausgeben""" try: return self.logo except: return "ECHO_groups" def content_html(self): """template fuer content""" return content_html(self,'group') def manage_addECHO_groupForm(self): """Add group form""" pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_groupForm.zpt').__of__(self) return pt() def manage_addECHO_group(self,id,title,label,description,contentType,responsible,weight,sortfield,coords="",secondaryLinkTitle="",secondaryLink="",credits=None,RESPONSE=None,imageTag="",bgcolour="",logo=""): """add a echo group""" newObj=ECHO_group(id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle=secondaryLinkTitle,secondaryLink=secondaryLink,imageTag=imageTag,bgcolour="") setattr(newObj,'logo',logo) self._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main') class ECHO_root(Folder,Persistent,Implicit): """ECHO Root Folder""" meta_type="ECHO_root" def getImageTag(self): """needed by main_template""" return "" secondaryLink="" #needed by main_template secondaryLinkTitle="" #needed by main_template def getBgcolour(self): """hack""" return "#dddddd" def contentTypeSelector_HTML(self,selected=None): """give type selector""" if not selected: retStr="