version 1.19, 2004/03/19 22:17:01
|
version 1.22, 2004/04/02 08:02:15
|
Line 4
|
Line 4
|
from OSAS_helpers import readArchimedesXML, getISO, getText |
from OSAS_helpers import readArchimedesXML, getISO, getText |
import os |
import os |
import xml.dom.minidom |
import xml.dom.minidom |
from Products.ECHO_content import ECHO_collection |
|
import urllib |
import urllib |
import OSAS_add |
import OSAS_add |
import OSAS_show |
import OSAS_show |
Line 16 from Products.PageTemplates.PageTemplate
|
Line 16 from Products.PageTemplates.PageTemplate
|
from Products.PageTemplates.PageTemplate import PageTemplate |
from Products.PageTemplates.PageTemplate import PageTemplate |
import archive # check if this is necessary |
import archive # check if this is necessary |
|
|
|
|
|
from xml.sax import make_parser |
|
from xml.sax.handler import ContentHandler |
|
|
|
def spaces(depth): |
|
"""needed in XMLtoTree""" |
|
tmp="" |
|
k=0 |
|
while k<2*depth: |
|
k+=1 |
|
tmp=tmp+" "+" " |
|
return tmp |
|
|
|
|
class OSAS_add_Document(Folder): |
class OSAS_add_Document(Folder): |
"""Hinzufuegen eines Dokumentes zum Storage""" |
"""Hinzufuegen eines Dokumentes zum Storage""" |
security=ClassSecurityInfo() |
security=ClassSecurityInfo() |
Line 149 def manage_AddOSAS_add_Text(self,id,RESP
|
Line 163 def manage_AddOSAS_add_Text(self,id,RESP
|
|
|
InitializeClass(OSAS_add_Text) |
InitializeClass(OSAS_add_Text) |
|
|
|
|
class OSAS_add_contextData(Folder): |
class OSAS_add_contextData(Folder): |
"""Einfuegen eines Documentes in eine Collection""" |
"""Einfuegen eines Documentes in eine Collection""" |
|
|
Line 157 class OSAS_add_contextData(Folder):
|
Line 172 class OSAS_add_contextData(Folder):
|
|
|
meta_type='OSAS_add_contextData' |
meta_type='OSAS_add_contextData' |
|
|
|
def XmlToTree(self,URL): |
|
"""Collection XML to Tree""" |
|
|
|
|
|
class requestHandler(ContentHandler): |
|
def __init__(self): |
|
self.depth=0 |
|
self.retStr="" |
|
|
|
def startElement(self,name,attrs): |
|
if name=="element": |
|
self.depth+=1 |
|
self.retStr+=spaces(self.depth)+"<input type='checkbox' name='collection' value='%s'>%s</input>"%(attrs.get('url'),attrs.get('name'))+"<br>\n" |
|
|
|
|
|
|
|
def endElement(self,name): |
|
if name=="element": |
|
self.depth-=1 |
|
|
|
|
|
parser=make_parser() |
|
curHandler=requestHandler() |
|
parser.setContentHandler(curHandler) |
|
#return urllib.urlopen(URL).read() |
|
parser.parse(urllib.urlopen(URL)) |
|
return curHandler.retStr |
|
|
def __init__(self,id,collection): |
def __init__(self,id,collection): |
self.id=id |
self.id=id |
self.collection=collection |
self.collection=collection |
Line 168 class OSAS_add_contextData(Folder):
|
Line 211 class OSAS_add_contextData(Folder):
|
list.append(object) |
list.append(object) |
return list |
return list |
|
|
def printChilds(self,startItem,depth,items,enddepth): |
|
|
|
|
|
|
def printChilds(self,startItem,depth,items,enddepth): |
|
"""NOT USED ANYMORE""" |
def spaces(depth): |
def spaces(depth): |
tmp="" |
tmp="" |
k=0 |
k=0 |
Line 195 class OSAS_add_contextData(Folder):
|
Line 240 class OSAS_add_contextData(Folder):
|
|
|
return tmp |
return tmp |
|
|
|
|
def generateTree(self,depth=10): |
def generateTree(self,depth=10): |
"""Erzeugt HTML-Tree der Collection""" |
"""Erzeugt HTML-Tree der Collection NOTE USED ANYMORE""" |
|
|
exec("items=self.getPhysicalRoot()."+self.collection+".getCollectionTree()") |
exec("items=self.getPhysicalRoot()."+self.collection+".getCollectionTree()") |
#print items[0][0] |
#print items[0][0] |
Line 209 class OSAS_add_contextData(Folder):
|
Line 255 class OSAS_add_contextData(Folder):
|
"""Zeige Partnerliste""" |
"""Zeige Partnerliste""" |
exec("items=self.getPhysicalRoot()."+self.collection+".partners.getPartners()") |
exec("items=self.getPhysicalRoot()."+self.collection+".partners.getPartners()") |
return items |
return items |
|
|
def addContextData(self,path): |
def addContextData(self,path): |
"""Hinzufügen zu einer Sammlung""" |
"""Hinzufügen zu einer Sammlung""" |
try: |
try: |
Line 227 class OSAS_add_contextData(Folder):
|
Line 274 class OSAS_add_contextData(Folder):
|
return pt() |
return pt() |
|
|
|
|
def addContextData2(self,path,collection,context,science,practice,source_type,period,link,label,description,content_type,responsible,weight,credits=None): |
def addContextData2(self,path,collection,context,link,label,description,content_type,responsible,weight,credits=None): |
"""Hinzufuegen der Resource""" |
"""Hinzufuegen der Resource""" |
splitted=path.split("/") |
splitted=path.split("/") |
#print "BLU" |
#print "BLU" |
Line 238 class OSAS_add_contextData(Folder):
|
Line 285 class OSAS_add_contextData(Folder):
|
#link=TOBEDONE" |
#link=TOBEDONE" |
"""Hinzufügen der Ressource""" |
"""Hinzufügen der Ressource""" |
|
|
|
params=urllib.urlencode({'id':id,'title':title,'link':link,'label':label,'description':description,'content_type':content_type,'responsible':responsible,'weight':weight,'credits':credits,'metalink':metalink}) |
|
|
|
retStr=urllib.urlopen(collection+"/addResource",params).read() |
|
if not retStr: |
|
return "An Error occured adding the resource\n" |
|
|
exec("collection_object=self"+collection) |
urllib.urlopen(collection+"/"+id+"/ECHO_getResourceMD").read() |
|
#exec("collection_object=self"+collection) |
|
|
ECHO_collection.manage_addECHO_resource(collection_object,id,title,label,description,content_type,responsible,link,metalink,credits,weight,RESPONSE=None) |
|
|
|
|
#ECHO_collection.manage_addECHO_resource(collection_object,id,title,label,description,content_type,responsible,link,metalink,credits,weight,RESPONSE=None) |
#print "HI5" |
#print "HI5" |
try: |
#try: |
getattr(collection_object,id).ECHO_getResourceMD() |
# getattr(collection_object,id).ECHO_getResourceMD() |
except: |
#except: |
"""nothing""" |
# """nothing""" |
#return "BLUByy" |
#return "BLUByy" |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path) |
return self.REQUEST.RESPONSE.redirect(self.REQUEST['URL2']+'?path='+path) |
|
|
Line 440 class OSAS_combineTextImage(Folder):
|
Line 495 class OSAS_combineTextImage(Folder):
|
OSAS_add.combineTextImage2(self,path) # Add images |
OSAS_add.combineTextImage2(self,path) # Add images |
splitted=path.split("/") |
splitted=path.split("/") |
linkPath=splitted[len(splitted)-1] |
linkPath=splitted[len(splitted)-1] |
linkViewerEnvironment="http://nausikaa2.mpiwg-berlin.mpg.de:86/cgi-bin/toc/toc.x.cgi?dir=%s&step=thumb" % linkPath |
linkViewerEnvironment="http://nausikaa2.mpiwg-berlin.mpg.de/cgi-bin/toc/toc.x.cgi?dir=%s&step=thumb" % linkPath |
self.REQUEST.SESSION['linkViewerEnvironment']=linkViewerEnvironment |
self.REQUEST.SESSION['linkViewerEnvironment']=linkViewerEnvironment |
|
|
writeToContext(path,linkViewerEnvironment,"ECHO standard environment") |
writeToContext(path,linkViewerEnvironment,"ECHO standard environment") |