--- ECHO_content/ECHO_collection.py 2003/12/03 19:01:23 1.2 +++ ECHO_content/ECHO_collection.py 2003/12/10 10:53:55 1.5 @@ -90,7 +90,7 @@ def readMetadata(url): return metadict,"" -def setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,credits,weight,coords): +def setECHO_CollectionInformation(self,context,science,practice,source_type,period,id,title,label,description,content_type,responsible,credits,weight,coordstrs): """Allegemeine Informationen zu einer ECHO Collection""" @@ -108,9 +108,14 @@ def setECHO_CollectionInformation(self,c self.scientific_Information.scientific_Classification.science=science self.scientific_Information.scientific_Classification.practice=practice - + coords=[] #coordinates of for rectangles - self.coords=coords + for coordstr in coordstrs: + + temco=coordstr.split(",") + #temco.append(angle) + coords.append(temco) + self.coords=coords[0:] class scientificClassification(SimpleItem,Persistent,Implicit): @@ -181,7 +186,14 @@ class ECHO_resource(Folder): coordsnew=[ string.split(x,",") for x in coords] self.coords=coordsnew - + + def getCoords(self): + try: + print + return [string.join(x,",") for x in self.coords] + except: + return [] + def ECHO_resource_config(self): """Main configuration""" @@ -213,10 +225,29 @@ class ECHO_resource(Folder): manage_options = Folder.manage_options+( {'label':'Main Config','action':'ECHO_resource_config'}, {'label':'Metadata','action':'ECHO_getResourceMD'}, - + {'label':'Graphics','action':'ECHO_graphicEntry'}, ) - + def ECHO_graphicEntry(self): + """DO nothing""" + if 'overview' in self.aq_parent.__dict__.keys(): + pt=PageTemplateFile('Products/ECHO_content/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:] + #pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self) + 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) @@ -418,9 +449,13 @@ class ECHO_collection(Folder, Persistent def getCoords(self): try: - return [ string.join(x,",") for x in self.coords] + print self.coords + return [string.join(x,",") for x in self.coords] + + except: return [] + def __init__(self,id,title,label,description,content_type,responsible,credits,weight,sortfield,coords): print "CO",coords @@ -454,10 +489,12 @@ class ECHO_collection(Folder, Persistent else: return "NO OVERVIEW GRAPHICS" - def ECHO_enterCoords(self,coordstr,RESPONSE=None): + def ECHO_enterCoords(self,coordstr,angle="",RESPONSE=None): """Enter coords""" coords=self.coords - coords.append(coordstr.split(",")) + temco=coordstr.split(",") + temco.append(angle) + coords.append(temco) self.coords=coords[0:] #pt=PageTemplateFile('Products/ECHO_content/ECHO_draw.zpt').__of__(self) if RESPONSE is not None: @@ -507,7 +544,7 @@ class ECHO_collection(Folder, Persistent if 'index.html' in self.__dict__.keys(): return getattr(self,'index.html')() elif 'overview' in self.__dict__.keys(): - print "HI" + #print "HI" return self.showOverview() @@ -525,12 +562,19 @@ class ECHO_collection(Folder, Persistent #print "OB:",object try: - print "MT:",object.meta_type + #print "MT:",object.meta_type if object.meta_type in subColTypes: - for coord in object.coords: - if len(coord)==4: - ids.append([string.join(coord,", "),object.getId()]) - + #print "MT:",object.meta_type,object.getId() + for coordtemp in object.coords: + if len(coordtemp)>3: + coord=coordtemp[0:4] + if hasattr(object,'title'): + if not object.title=="": + ids.append([string.join(coord,", "),object.getId(),object.title]) + else: + ids.append([string.join(coord,", "),object.getId(),object.getId()]) + else: + ids.append([string.join(coord,", "),object.getId(),object.getId()]) except: """nothing"""