--- ECHO_content/ECHO_collection.py 2004/04/16 10:24:09 1.43 +++ ECHO_content/ECHO_collection.py 2004/04/18 17:36:02 1.47 @@ -525,6 +525,24 @@ class ECHO_collection(Folder, Persistent security=ClassSecurityInfo() meta_type='ECHO_collection' + 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: @@ -579,7 +597,11 @@ class ECHO_collection(Folder, Persistent dynamical="" for ob in self.getGraphicCoords(): - dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0]) + if ob[4][4] == "": + dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0]) + else: + 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 return ret @@ -667,6 +689,7 @@ class ECHO_collection(Folder, Persistent {'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'}, ) @@ -742,9 +765,11 @@ class ECHO_collection(Folder, Persistent self.coords=None setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) - - self.coords=coordsnew[0:] # HACK fehler in setECHO_collection - + try: + self.coords=coordsnew[0:] # HACK fehler in setECHO_collection + except: + """none""" + self.sortfield=sortfield if RESPONSE is not None: @@ -801,14 +826,14 @@ class ECHO_collection(Folder, Persistent if len(coordtemp)>3: coord=coordtemp[0:4] if hasattr(object,'label') and not object.label=="": - ids.append([string.join(coord,", "),object.getId(),object.label,object]) + ids.append([string.join(coord,", "),object.getId(),object.label,object,coordtemp]) elif hasattr(object,'title'): if not object.title=="": - ids.append([string.join(coord,", "),object.getId(),object.title,object]) + ids.append([string.join(coord,", "),object.getId(),object.title,object,coordtemp]) else: - ids.append([string.join(coord,", "),object.getId(),object.getId(),object]) + ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp]) else: - ids.append([string.join(coord,", "),object.getId(),object.getId(),object]) + ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp]) except: """nothing"""