--- ECHO_content/ECHO_collection.py 2004/07/16 17:55:43 1.140
+++ ECHO_content/ECHO_collection.py 2004/07/18 14:14:42 1.142
@@ -29,7 +29,7 @@ from Products.PageTemplates.ZopePageTemp
from Globals import Persistent, package_home
from Acquisition import Implicit
from ECHO_helpers import displayTypes
-
+import urllib
try:
from psycopg import libpq
@@ -46,7 +46,33 @@ import xml.dom.minidom
from ECHO_graphicalOverview import javaHandler,javaScriptMain
import ECHO_helpers
-def getCopyrightsFromForm(self,argv):
+def getRDFDescription(self,linkURL,urn=None):
+ """rdf"""
+ ret=""
+ about=""""""
+ name="""%s"""
+ #link="""%s"""
+ link=""""""
+ type="""%s"""
+
+ if not urn:
+ urn="urn:"+re.sub('/',':',self.absolute_url())
+
+ about2=about%urn
+ if hasattr(self,'label') and not (self.label==""):
+ name2=name%urllib.quote(self.label)
+ elif not self.title=="":
+ name2=name%urllib.quote(self.title)
+ else:
+ name2=name%self.getId()
+
+ link2=link%urllib.quote(linkURL)
+ type2=type%self.meta_type
+
+ ret=about2+"\n"+name2+"\n"+link2+"\n"+type2+"\n"
+ return ret
+
+def getCopyrightsFromForm(self,argv):
medias={}
partners={}
copyrights={}
@@ -477,6 +503,8 @@ def manage_addECHO_layoutTemplate(self,
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''
+
+
class ECHO_resource(Folder,Persistent):
"""ECHO Ressource"""
security=ClassSecurityInfo()
@@ -489,18 +517,7 @@ class ECHO_resource(Folder,Persistent):
security.declareProtected('View','index_html')
def getRDF(self):
"""rdf"""
- ret=""
- about=""""""
- name="""%s"""
- link="""%s"""
- urn="urn:"+re.sub('/',':',self.absolute_url())
-
- about2=about%urn
- name2=name%self.getId()
- link2=link%self.link
-
- ret=about2+"\n"+name2+"\n"+link2+"\n"+""
- return ret
+ return getRDFDescription(self,self.link)
def getAccessRightSelectorHTML(self,outlook="select"):
@@ -1490,36 +1507,35 @@ class ECHO_collection(Folder, Persistent
path="/mpiwg/online/permanent/shipbuilding"
def showRDF(self):
- ret="""\n"""
- ret+=self.getRDF()+"\n"
+ """showrdf"""
+ self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
+ ret="""\n\n"""
+ ret+=self.getRDF(urn="echo:collectionroot")+"\n"
ret+=""""""
-
- def getRDF(self):
+ return ret
+
+ def getRDF(self,urn=None):
"""rdf of the collection"""
contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
- about=""""""
- name="""%s"""
-
- urn="urn:"+re.sub('/',':',self.absolute_url())
-
- about2=about%urn
- name2=name%self.getId()
-
+ ret=getRDFDescription(self,self.absolute_url(),urn)
- ret=about2+"\n"+name2+"\n"+""
- urn="urn:"+re.sub('/',':',self.absolute_url())
+ if not urn:
+ urn="urn:"+re.sub('/',':',self.absolute_url())
+ else:
+ urn="urn:"+urn
+
li="""\n"""
for content in contents:
ret+=content[1].getRDF()+"\n"
- ret+="""\n"""%urn
+ ret+="""\n"""%urn
for content in contents:
nurn="urn:"+re.sub('/',':',content[1].absolute_url())
ret+=li%nurn
- return ret+""
+ return ret+""
def changeLabels(self):
@@ -2228,19 +2244,23 @@ class ECHO_group(ECHO_collection):
def getRDF(self):
"""rdf of the collection"""
contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
+
+ ret=getRDFDescription(self,self.absolute_url())
+
+
urn="urn:"+re.sub('/',':',self.absolute_url())
li="""\n"""
- ret=""
+
for content in contents:
ret+=content[1].getRDF()+"\n"
- ret+="""\n"""%urn
+ ret+="""\n"""%urn
for content in contents:
nurn="urn:"+re.sub('/',':',content[1].absolute_url())
ret+=li%nurn
- return ret+""
+ return ret+""
def index_html(self):
"""standard page"""
@@ -2457,6 +2477,42 @@ class ECHO_root(Folder,Persistent,Implic
security=ClassSecurityInfo()
meta_type="ECHO_root"
+
+ def showRDF(self):
+ """showrdf"""
+ self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml')
+ ret="""\n"""
+ ret+=self.getRDF()+"\n"
+ ret+=""""""
+ return ret
+
+ def getRDF(self):
+ """rdf of the collection"""
+ contents=self.ZopeFind(self,obj_metatypes=['ECHO_group','ECHO_resource','ECHO_collection'])
+
+ about=""""""
+ name="""%s"""
+
+ urn="urn:"+re.sub('/',':',self.absolute_url())
+
+ about2=about%urn
+ name2=name%self.getId()
+
+
+ ret=about2+"\n"+name2+"\n"+""
+
+ li="""\n"""
+
+
+ for content in contents:
+ ret+=content[1].getRDF()+"\n"
+
+ ret+="""\n"""%urn
+ for content in contents:
+ nurn="urn:"+re.sub('/',':',content[1].absolute_url())
+ ret+=li%nurn
+ return ret+""
+
def showContent(self,path):
"""return content/html"""