version 1.155, 2004/08/04 17:42:54
|
version 1.159, 2004/08/05 13:32:59
|
Line 274 class BrowserCheck:
|
Line 274 class BrowserCheck:
|
|
|
def writeMetadata(url,metadict,project=None,startpage=None,xslt=None,thumbtemplate=None,topbar=None,digiLibTemplate=None,xmlfrag=None,digiliburlprefix=None): |
def writeMetadata(url,metadict,project=None,startpage=None,xslt=None,thumbtemplate=None,topbar=None,digiLibTemplate=None,xmlfrag=None,digiliburlprefix=None): |
"""Einlesen der Metadaten und und erstellen des geaenderten XML file""" |
"""Einlesen der Metadaten und und erstellen des geaenderten XML file""" |
|
print "url",url |
def updateTextToolNode(tag,value): |
def updateTextToolNode(tag,value): |
#print dom,tag,value |
#print dom,tag,value |
metanode=dom.getElementsByTagName('texttool')[0] |
metanode=dom.getElementsByTagName('texttool')[0] |
Line 813 class ECHO_resource(Folder,Persistent):
|
Line 814 class ECHO_resource(Folder,Persistent):
|
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',path) # falls foxridge als server |
path=re.sub('http://foxridge.mpiwg-berlin.mpg.de','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de:8080','',path) # falls foxridge als server |
|
path=re.sub('http://content.mpiwg-berlin.mpg.de','',path) # falls content als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server |
path=re.sub('/index.meta','',path) |
path=re.sub('/index.meta','',path) |
|
|
Line 876 class ECHO_resource(Folder,Persistent):
|
Line 878 class ECHO_resource(Folder,Persistent):
|
|
|
path=re.sub('http://foxridge.rz-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de:8080','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server |
path=re.sub('http://foxridge.rz-berlin.mpg.de','',path) # falls foxridge als server |
|
path=re.sub('http://content.mpiwg-berlin.mpg.de','',path) # falls content als server |
return urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines() |
return urllib.urlopen("http://nausikaa2.rz-berlin.mpg.de:86/cgi-bin/toc/admin/reg.cgi?path=%s"%path).readlines() |
|
|
if RESPONSE is not None: |
if RESPONSE is not None: |
Line 995 class ECHO_resource(Folder,Persistent):
|
Line 997 class ECHO_resource(Folder,Persistent):
|
|
|
return ret |
return ret |
|
|
|
def getInstitutionsHTML(self): |
|
"""gibt Liste der frdernden Institutionen aus""" |
|
|
|
if hasattr(self,'support'): |
|
obj=self.support |
|
ret=obj.getSupporter() |
|
return ret |
|
else: |
|
return '' |
|
|
|
|
def getCredits(self): |
def getCredits(self): |
"""Ausgabe der credits""" |
"""Ausgabe der credits""" |
if self.credits: |
if self.credits: |
Line 3063 class ECHO_root(Folder,Persistent,Implic
|
Line 3076 class ECHO_root(Folder,Persistent,Implic
|
return [ item[1] for item in self.partners.ZopeFind(self.partners,obj_metatypes=['ECHO_partner'])] |
return [ item[1] for item in self.partners.ZopeFind(self.partners,obj_metatypes=['ECHO_partner'])] |
|
|
|
|
|
def getInstitutions(self): |
|
"""Get list of Partners. Presently only from a subfolder partners""" |
|
|
|
return [ item[1] for item in self.institutions.ZopeFind(self.institutions,obj_metatypes=['ECHO_institution'])] |
|
|
|
|
def getPartnersXML(self): |
def getPartnersXML(self): |
Line 3224 class ECHO_root(Folder,Persistent,Implic
|
Line 3240 class ECHO_root(Folder,Persistent,Implic
|
par=self.ZopeFind(self.partners, obj_ids=[id]) |
par=self.ZopeFind(self.partners, obj_ids=[id]) |
return par |
return par |
|
|
|
def getInstitutionFromID(self,id): |
|
""" find institution from id """ |
|
inst=self.ZopeFind(self.institutions, obj_ids=[id]) |
|
return inst |
|
|
|
|
def manage_addECHO_root(self,id,title,RESPONSE=None): |
def manage_addECHO_root(self,id,title,RESPONSE=None): |
Line 3371 def manage_addECHO_partner(self, id, url
|
Line 3391 def manage_addECHO_partner(self, id, url
|
REQUEST.RESPONSE.redirect('%s/manage_main' % url) |
REQUEST.RESPONSE.redirect('%s/manage_main' % url) |
return id |
return id |
|
|
|
class ECHO_linkList(ZopePageTemplate): |
|
"""LinkList Objekt""" |
|
meta_type="ECHO_linkList" |
|
|
|
_default_content_fn = os.path.join(package_home(globals()), 'html/ECHO_pageTemplateDefault.html') |
|
|
|
manage_options = ZopePageTemplate.manage_options+( |
|
{'label':'Main Config','action':'changeECHO_linkListWeightForm'}, |
|
) |
|
|
|
def content_html(self): |
|
"""content_html""" |
|
return content_html(self,'pageTemplate') |
|
|
|
def changeECHO_linkListWeightForm(self): |
|
"""change""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_linkListTemplate.zpt').__of__(self) |
|
return pt() |
|
|
|
def changeECHO_linkListWeight(self,contentType,label,RESPONSE=None): |
|
"""change""" |
|
self.contentType=contentType |
|
self.label=label |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
def getLabel(self): |
|
if hasattr(self,'label'): |
|
return self.label.encode('utf-8') |
|
else: |
|
return 0 |
|
|
|
def getcontentType(self): |
|
"""get contentType""" |
|
if hasattr(self,'contentType'): |
|
return self.contentType |
|
else: |
|
return 0 |
|
|
|
def __init__(self, id, label, title=None, text=None, contentType=None): |
|
self.id = str(id) |
|
self.title=title |
|
self.label=label |
|
self.ZBindings_edit(self._default_bindings) |
|
if text is None: |
|
text = '' |
|
self.pt_edit(text, contentType) |
|
|
|
|
|
|
|
|
|
def manage_addECHO_linkListForm(self): |
|
"""Form for adding""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_linkListTemplate.zpt').__of__(self) |
|
return pt() |
|
|
|
from urllib import quote |
|
|
|
|
|
def manage_addECHO_linkList(self, id, label,contentType=0,title=None, text=None, |
|
REQUEST=None, submit=None): |
|
"""Add a LinkList with optional file content.""" |
|
|
|
id = str(id) |
|
if REQUEST is None: |
|
self._setObject(id, ECHO_linkList(id, label, text)) |
|
ob = getattr(self, id) |
|
setattr(ob,'contentType',contentType) |
|
if title: |
|
ob.pt_setTitle(title) |
|
return ob |
|
else: |
|
file = REQUEST.form.get('file') |
|
headers = getattr(file, 'headers', None) |
|
if (headers is None) or (not file.filename): |
|
zpt = ECHO_linkList(id, file) |
|
else: |
|
zpt = ECHO_linkList(id, label,'', file, headers.get('contentType')) |
|
|
|
self._setObject(id, zpt) |
|
ob = getattr(self, id) |
|
if title: |
|
ob.pt_setTitle(title) |
|
|
|
try: |
|
u = self.DestinationURL() |
|
except AttributeError: |
|
u = REQUEST['URL1'] |
|
|
|
if submit == " Add and Edit ": |
|
u = "%s/%s" % (u, quote(id)) |
|
REQUEST.RESPONSE.redirect(u+'/manage_main') |
|
return '' |
|
|
|
|
|
class ECHO_support(Folder): |
|
"""gefrdert durch""" |
|
meta_type="ECHO_support" |
|
|
|
|
|
|
|
def __init__(self,id,institutions=None): |
|
"""init""" |
|
self.id=id |
|
self.title='' |
|
self.institutions=toList(institutions) |
|
|
|
def getSupporter(self): |
|
"""return institutions""" |
|
if self.institutions: |
|
return self.institutions |
|
else: |
|
return [] |
|
|
|
manage_options = Folder.manage_options+( |
|
{'label':'Main Config','action':'ECHO_support_configForm'}, |
|
) |
|
|
|
def ECHO_support_configForm(self): |
|
"""change form""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_support').__of__(self) |
|
pt.content_type="text/html" |
|
return pt() |
|
|
|
def ECHO_support_config(self,institutions=None,RESPONSE=None): |
|
"""change""" |
|
self.institutions=toList(institutions) |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
def manage_addECHO_supportForm(self): |
|
"""Form for adding""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_support.zpt').__of__(self) |
|
return pt() |
|
|
|
def manage_addECHO_support(self, id,institutions=None,RESPONSE=None): |
|
"""add the copyright""" |
|
|
|
meta_type="ECHO_support" |
|
|
|
|
|
self._setObject(id, ECHO_support(id,institutions)) |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
class ECHO_institution(Image,Persistent): |
|
"""ECHO Institution""" |
|
|
|
meta_type="ECHO_institution" |
|
|
|
def __init__(self, id, title,url, file, person, email, country, content_type='', precondition=''): |
|
self.__name__=id |
|
self.title=title |
|
self.url=url |
|
self.person=person |
|
self.email=email |
|
self.country=country |
|
self.precondition=precondition |
|
data, size = self._read_data(file) |
|
content_type=self._get_content_type(file, data, id, content_type) |
|
self.update_data(data, content_type, size) |
|
|
|
manage_options = Image.manage_options+( |
|
{'label':'Institution Information','action':'ECHO_institution_config'}, |
|
) |
|
|
|
|
|
def changeECHO_institution(self,url,person, email, country,RESPONSE=None): |
|
"""Change main information""" |
|
self.url=url |
|
self.person=person |
|
self.email=email |
|
self.country=country |
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
|
def ECHO_institution_config(self): |
|
"""Main configuration""" |
|
if not hasattr(self,'url'): |
|
self.url="" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_institution.zpt').__of__(self) |
|
return pt() |
|
|
|
|
|
manage_addECHO_institutionForm=DTMLFile('dtml/ECHO_institutionAdd',globals(), |
|
Kind='ECHO_institution',kind='ECHO_institution') |
|
|
|
|
|
|
|
def manage_addECHO_institution(self, id, url, person, email, country, file=None, title='', precondition='', content_type='', |
|
REQUEST=None): |
|
""" |
|
Add a new ECHO_institution object. |
|
|
|
Creates a new ECHO_institution object 'id' with the contents of 'file'. |
|
Based on Image.manage_addImage |
|
""" |
|
|
|
id=str(id) |
|
title=str(title) |
|
content_type=str(content_type) |
|
precondition=str(precondition) |
|
|
|
id, title = OFS.Image.cookId(id, title, file) |
|
|
|
self=self.this() |
|
|
|
# First, we create the image without data: |
|
self._setObject(id, ECHO_institution(id,title,url,'', person, email, country, content_type, precondition)) |
|
|
|
# Now we "upload" the data. By doing this in two steps, we |
|
# can use a database trick to make the upload more efficient. |
|
if file: |
|
self._getOb(id).manage_upload(file) |
|
if content_type: |
|
self._getOb(id).content_type=content_type |
|
|
|
if REQUEST is not None: |
|
try: url=self.DestinationURL() |
|
except: url=REQUEST['URL1'] |
|
REQUEST.RESPONSE.redirect('%s/manage_main' % url) |
|
return id |
|
|