version 1.60, 2004/05/06 16:59:35
|
version 1.66, 2004/05/07 15:07:22
|
Line 76 def getText(nodelist):
|
Line 76 def getText(nodelist):
|
return rc |
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): |
def readMetadata(url): |
"""Methoden zum Auslesen der Metadateninformation zu einer Resource |
"""Methoden zum Auslesen der Metadateninformation zu einer Resource |
Vorerst noch Typ bib""" |
Vorerst noch Typ bib""" |
Line 354 class ECHO_resource(Folder):
|
Line 376 class ECHO_resource(Folder):
|
coordsnew=[] |
coordsnew=[] |
|
|
setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) |
setECHO_collectionInformation(self,title,label,description,contentType,responsible,credits,weight,coordsnew) |
|
self.viewClassification=viewClassification |
self.coords=coordsnew[0:] |
self.coords=coordsnew[0:] |
self.link=link |
self.link=link |
self.metalink=metalink |
self.metalink=metalink |
Line 655 class ECHO_collection(Folder, Persistent
|
Line 677 class ECHO_collection(Folder, Persistent
|
|
|
def createJavaScript(self): |
def createJavaScript(self): |
"""CreateJava""" |
"""CreateJava""" |
ret=javaScriptMain |
#ret=javaScriptMain |
|
ret="" |
|
|
dynamical="" |
dynamical="\n" |
for ob in self.getGraphicCoords(): |
for ob in self.getGraphicCoords(): |
if ob[4][4] == "": |
if ob[4][4] == "": |
dynamical+="""Coords.push(new Coord('%s', Img, %s));\n"""%(ob[1],ob[0]) |
#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: |
else: |
dynamical+="""Coords.push(new Coord('%s', Img, %s));//%s\n"""%(ob[1],ob[0],ob[4][4]) |
dynamical+="""addArea('%s', 'overview', %s, 'arrow');\n"""%(ob[1],ob[0]) |
dynamical+="ShowArrow(new getObj('i.%s'),Img,%s);\n"%(ob[1],ob[0]) |
#dynamical+="""Coords.push(new Coord('%s', Img, %s));//%s\n"""%(ob[1],ob[0],ob[4][4]) |
ret+=javaHandler%dynamical |
#dynamical+="ShowArrow(new getObj('i.%s'),Img,%s);\n"%(ob[1],ob[0]) |
|
#ret+=javaHandler%dynamical |
|
ret+=dynamical |
return ret |
return ret |
|
|
security.declarePublic('getCreditObject') |
security.declarePublic('getCreditObject') |
Line 876 class ECHO_collection(Folder, Persistent
|
Line 902 class ECHO_collection(Folder, Persistent
|
else: |
else: |
return [] |
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): |
def getGraphicCoords(self): |
"""Give list of coordinates""" |
"""Give list of coordinates""" |
subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource'] |
subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource'] |
ids=[] |
ids=[] |
for entry in self.__dict__.keys(): |
for entrySearch in self.ZopeFind(self,obj_metatypes=subcolTypes): |
object=getattr(self,entry) |
object=entrySearch[1] |
try: |
if hasattr(object,'coords'): |
if object.meta_type in subColTypes: |
|
for coordtemp in object.coords: |
for coordtemp in object.coords: |
if len(coordtemp)>3: |
if len(coordtemp)>3: |
coord=coordtemp[0:4] |
coord=coordtemp[0:4] |
|
label="" |
if hasattr(object,'label') and not object.label=="": |
if hasattr(object,'label') and not object.label=="": |
ids.append([string.join(coord,", "),object.getId(),object.label,object,coordtemp]) |
label=object.label |
elif hasattr(object,'title'): |
elif hasattr(object,'title') and not object.title=="": |
if not object.title=="": |
label=object.title |
ids.append([string.join(coord,", "),object.getId(),object.title,object,coordtemp]) |
|
else: |
|
ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp]) |
|
else: |
else: |
ids.append([string.join(coord,", "),object.getId(),object.getId(),object,coordtemp]) |
label=object.getId() |
|
ids.append([string.join(coord,", "),object.getId(),label,object,coordtemp,object.getViewClassification()]) |
except: |
|
"""nothing""" |
|
|
|
return ids |
return ids |
|
|
|
|
Line 942 class ECHO_group(ECHO_collection):
|
Line 976 class ECHO_group(ECHO_collection):
|
def index_html(self): |
def index_html(self): |
"""standard page""" |
"""standard page""" |
displayedObjects=self.ZopeFind(self,obj_metatypes=displayTypes) |
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 |
#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()) |
# return self.REQUEST.RESPONSE.redirect(displayedObjects[0][1].absolute_url()) |
|
|
if 'index.html' in self.__dict__.keys(): |
if 'index.html' in self.__dict__.keys(): |
return getattr(self,'index.html')() |
return getattr(self,'index.html')() |
Line 1056 class ECHO_root(Folder,Persistent,Implic
|
Line 1090 class ECHO_root(Folder,Persistent,Implic
|
else: |
else: |
retStr="<option>\n" |
retStr="<option>\n" |
|
|
try: |
try: # erste version contentTypes exists |
for contentType in self.ZopeFind(self.contentTypes,obj_metatypes=["ECHO_contentType"]): |
for contentType in self.ZopeFind(self.contentTypes,obj_metatypes=["ECHO_contentType"]): |
if selected and (contentType[0]==selected): |
if selected and (contentType[0]==selected): |
retStr+="""<option selected value="%s">%s\n"""%(contentType[0],contentType[0]) |
retStr+="""<option selected value="%s">%s\n"""%(contentType[0],contentType[0]) |
else: |
else: |
retStr+="""<option value="%s">%s\n"""%(contentType[0],contentType[0]) |
retStr+="""<option value="%s">%s\n"""%(contentType[0],contentType[0]) |
except: |
except: |
|
try: |
|
for contentType in self.ZopeFind(self.standardMD,obj_metatypes=["OSAS_MetadataMapping"]): |
|
if selected and (contentType[0]==selected): |
|
retStr+="""<option selected value="%s">%s\n"""%(contentType[0],contentType[0]) |
|
else: |
|
retStr+="""<option value="%s">%s\n"""%(contentType[0],contentType[0]) |
|
except: |
"""nothing""" |
"""nothing""" |
|
|
return retStr |
return retStr |
|
|
def patchContentType(self,obj=None): |
def patchContentType(self,obj=None): |
Line 1085 class ECHO_root(Folder,Persistent,Implic
|
Line 1127 class ECHO_root(Folder,Persistent,Implic
|
|
|
return "changed all contenttypes in: "+self.title |
return "changed all contenttypes in: "+self.title |
|
|
|
|
|
def patchViewClassification(self,obj=None): |
|
"""setze viewClassification heuristisch""" |
|
|
|
def checkIfArrow(obj): |
|
if hasattr(obj,'coords'): |
|
for coordtemp in obj.coords: |
|
print obj.title,len(coordtemp) |
|
if (len(coordtemp)>4) and not (coordtemp[4]==''): |
|
return 4 |
|
return None |
|
return None |
|
|
|
if not obj: |
|
obj = self |
|
|
|
entries=obj.ZopeFind(obj,obj_metatypes=['ECHO_resource','ECHO_collection','ECHO_group']) |
|
|
|
for entry in entries: |
|
|
|
if checkIfArrow(entry[1]): |
|
print "VP" |
|
setattr(entry[1],'viewClassification','view point') |
|
else: |
|
print "area" |
|
setattr(entry[1],'viewClassification','area') |
|
|
|
#entry[1].contentType == entry[1].content_type |
|
|
|
if entry[1].meta_type in ['ECHO_collection','ECHO_group']: |
|
entry[1].patchViewClassification(entry[1]) |
|
|
|
|
|
return "changed all contenttypes in: "+self.title |
|
|
def ECHO_newViewerLink(self,obj=None): |
def ECHO_newViewerLink(self,obj=None): |
"""change links (:86 faellt weg)""" |
"""change links (:86 faellt weg)""" |
|
|