version 1.86, 2004/05/13 21:28:47
|
version 1.97, 2004/06/05 10:04:33
|
Line 52 viewClassificationListMaster=['view poin
|
Line 52 viewClassificationListMaster=['view poin
|
def checkDiffs(self,metadict): |
def checkDiffs(self,metadict): |
"""check differences""" |
"""check differences""" |
|
|
|
|
|
|
|
|
def NoneToEmpty(obj): |
def NoneToEmpty(obj): |
if obj: |
if obj: |
return obj |
return obj |
else: |
else: |
return "" |
return "" |
|
|
|
|
|
|
diffs={} |
diffs={} |
|
|
tags=self.findTagsFromMapping(self.contentType) |
tags=self.findTagsFromMapping(self.contentType) |
|
self.referencetypes=tags[2] |
|
self.fields=tags[3] |
|
|
|
|
for field in tags[1]: |
for field in tags[1]: |
try: |
try: |
if (NoneToEmpty(self.getFieldValue(self.getFieldTag(tags,field)))==metadict[self.getFieldTag(tags,field)]): |
if (NoneToEmpty(self.getFieldValue(self.getFieldTag(tags,field)))==metadict[self.getFieldTag(tags,field)]): |
diffs[self.getFieldTag(tags,field)]=1 |
diffs[self.getFieldTag(tags,field)]=1 |
else: |
else: |
print "DIFF",field,self.getFieldValue(self.getFieldTag(tags,field)),metadict[self.getFieldTag(tags,field)] |
|
diffs[self.getFieldTag(tags,field)]=0 |
diffs[self.getFieldTag(tags,field)]=0 |
except: |
except: |
diffs[self.getFieldTag(tags,field)]=0 |
diffs[self.getFieldTag(tags,field)]=0 |
print "EX",field |
|
return diffs |
return diffs |
|
|
def content_html(self,type): |
def content_html(self,type): |
Line 79 def content_html(self,type):
|
Line 89 def content_html(self,type):
|
#if templates: |
#if templates: |
# return templates[0][1]() |
# return templates[0][1]() |
|
|
try: |
if hasattr(self,type+"_template"): |
obj=getattr(self,type+"_template") |
obj=getattr(self,type+"_template") |
return obj() |
return obj() |
except: |
else: |
pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_%s_template_standard.zpt'%type).__of__(self) |
pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_%s_template_standard.zpt'%type).__of__(self) |
pt.content_type="text/html" |
pt.content_type="text/html" |
return pt() |
return pt() |
Line 124 def sendFile(self, filename, type):
|
Line 134 def sendFile(self, filename, type):
|
self.REQUEST.RESPONSE.write(file(fn).read()) |
self.REQUEST.RESPONSE.write(file(fn).read()) |
return |
return |
|
|
|
class BrowserCheck: |
|
"""check the browsers request to find out the browser type""" |
|
|
|
def __init__(self, zope): |
|
self.ua = zope.REQUEST.get_header("HTTP_USER_AGENT") |
|
self.isN4 = (string.find(self.ua, 'Mozilla/4.') > -1) and (string.find(self.ua, 'MSIE') < 0) |
|
self.isIE = string.find(self.ua, 'MSIE') > -1 |
|
self.nav = self.ua[string.find(self.ua, '('):] |
|
ie = string.split(self.nav, "; ")[1] |
|
if string.find(ie, "MSIE") > -1: |
|
self.versIE = string.split(ie, " ")[1] |
|
self.isMac = string.find(self.ua, 'Macintosh') > -1 |
|
self.isWin = string.find(self.ua, 'Windows') > -1 |
|
self.isIEWin = self.isIE and self.isWin |
|
self.isIEMac = self.isIE and self.isMac |
|
|
|
|
def writeMetadata(url,metadict): |
def writeMetadata(url,metadict): |
"""Einlesen der Metadaten und und erstellen des geänderten XML file""" |
"""Einlesen der Metadaten und und erstellen des geaenderten XML file""" |
|
|
try: |
try: |
geturl="" |
geturl="" |
Line 150 def writeMetadata(url,metadict):
|
Line 176 def writeMetadata(url,metadict):
|
metanode=metanodes[0] |
metanode=metanodes[0] |
|
|
for metaData in metadict.keys(): |
for metaData in metadict.keys(): |
print metaData,metanode |
|
try: |
try: |
nodeOld=metanode.getElementsByTagName(metaData) |
nodeOld=metanode.getElementsByTagName(metaData) |
except: |
except: |
Line 169 def writeMetadata(url,metadict):
|
Line 195 def writeMetadata(url,metadict):
|
metanode.removeChild(nodeOld[0]).unlink() |
metanode.removeChild(nodeOld[0]).unlink() |
|
|
metanodeneu=dom.createElement(metaData) |
metanodeneu=dom.createElement(metaData) |
metanodetext=dom.createTextNode(unicode(metadict[metaData],"utf8")) |
try: |
|
metanodetext=dom.createTextNode(unicode(metadict[metaData],"utf-8")) |
|
except: |
|
metanodetext=dom.createTextNode(metadict[metaData].encode('utf-8')) |
metanodeneu.appendChild(metanodetext) |
metanodeneu.appendChild(metanodetext) |
metanode.appendChild(metanodeneu) |
metanode.appendChild(metanodeneu) |
|
|
|
|
return dom.topxml().encode('utf-8') |
return dom.toxml().encode('utf-8') |
|
|
|
|
|
|
def readMetadata(url): |
def readMetadata(url): |
"""Methode zum Auslesen der Metadateninformation zu einer Resource |
"""Methode zum Auslesen der Metadateninformation zu einer Resource |
Line 200 def readMetadata(url):
|
Line 231 def readMetadata(url):
|
if len(metanode)==0: |
if len(metanode)==0: |
metanode=dom.getElementsByTagName('archimedes') |
metanode=dom.getElementsByTagName('archimedes') |
metadict['bib_type']='Archimedes' |
metadict['bib_type']='Archimedes' |
#print "HELLO" |
|
|
|
if not len(metanode)==0: |
if not len(metanode)==0: |
metacontent=metanode[0].childNodes |
metacontent=metanode[0].childNodes |
Line 212 def readMetadata(url):
|
Line 243 def readMetadata(url):
|
|
|
for node in metacontent: |
for node in metacontent: |
try: |
try: |
metadict[re.sub('-','_',node.tagName.lower())]=getText(node.childNodes) |
#print urllib.unquote(getText(node.childNodes)),getText(node.childNodes) |
|
metadict[re.sub('-','_',node.tagName.lower())]=urllib.unquote(getText(node.childNodes)) |
except: |
except: |
"""nothing""" |
"""nothing""" |
|
|
Line 237 def setECHO_collectionInformation(self,t
|
Line 269 def setECHO_collectionInformation(self,t
|
coords=[] |
coords=[] |
#coordinates of for rectangles |
#coordinates of for rectangles |
|
|
#print "cs", coordstrs |
|
if coordstrs: |
if coordstrs: |
for coordstr in coordstrs: |
for coordstr in coordstrs: |
#print "cs", coordstr |
|
try: |
try: |
temco=coordstr.split(",") |
temco=coordstr.split(",") |
except: |
except: |
temco=[] |
temco=[] |
#temco.append(angle) |
|
coords.append(temco) |
coords.append(temco) |
|
|
|
|
Line 365 def manage_addECHO_layoutTemplate(self,
|
Line 397 def manage_addECHO_layoutTemplate(self,
|
REQUEST.RESPONSE.redirect(u+'/manage_main') |
REQUEST.RESPONSE.redirect(u+'/manage_main') |
return '' |
return '' |
|
|
class ECHO_resource(Folder): |
class ECHO_resource(Folder,Persistent): |
"""ECHO Ressource""" |
"""ECHO Ressource""" |
meta_type='ECHO_resource' |
meta_type='ECHO_resource' |
|
|
Line 391 class ECHO_resource(Folder):
|
Line 423 class ECHO_resource(Folder):
|
return "" |
return "" |
|
|
def getFullTextXML(self,noredirect=None): |
def getFullTextXML(self,noredirect=None): |
"""getFullTextXML""" |
"""getFullTextXML; gives the FullText as an XML Document, and <error></error> if somthing goes wrong.""" |
try: |
try: |
fh=urllib.urlopen(self.metalink) |
fh=urllib.urlopen(self.metalink) |
dom=xml.dom.minidom.parse(fh) |
dom=xml.dom.minidom.parse(fh) |
texttools=dom.getElementsByTagName('texttool') |
texttools=dom.getElementsByTagName('texttool') |
text=texttools[0].getElementsByTagName('text') |
text=texttools[0].getElementsByTagName('text') |
texturl=getText(text[0].childNodes) |
texturl=getText(text[0].childNodes) |
|
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
if not noredirect: |
if not noredirect: |
self.REQUEST.RESPONSE.redirect(texturl) |
self.REQUEST.RESPONSE.redirect(texturl) |
else: |
else: |
return texturl |
return texturl |
except: |
except: |
return None |
|
|
if not noredirect: |
|
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
|
self.REQUEST.RESPONSE.write("<error>no fulltext available</error>") |
|
else: |
|
return "<error>no fulltext available</error>" |
|
|
|
def getCopyright(self): |
|
"""gib link auf copyright notiz aus""" |
|
if hasattr(self,'copyrightType') and hasattr(self.copyrightTypes,self.copyrightType): |
|
obj=getattr(self.copyrightTypes,self.copyrightType) |
|
else: |
|
obj=getattr(self.copyrightTypes,'generic') |
|
|
|
label=obj.label |
|
link="copyrightTypes/"+obj.getId()+'/copyright.html' |
|
|
|
return """<a target="_blank" href="%s">%s</a>"""%(link,label) |
|
|
def getCredits(self): |
def getCredits(self): |
"""Ausgabe der credits""" |
"""Ausgabe der credits""" |
Line 412 class ECHO_resource(Folder):
|
Line 462 class ECHO_resource(Folder):
|
else: |
else: |
return [] |
return [] |
|
|
def __init__(self,id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords): |
def __init__(self,id,link,metalink,resourceID,title,label,description,contentType,renderingType,copyrightType,responsible,credits,weight,coords): |
|
|
self.id = id |
self.id = id |
"""Festlegen der ID""" |
"""Festlegen der ID""" |
Line 425 class ECHO_resource(Folder):
|
Line 475 class ECHO_resource(Folder):
|
self.credits=toList(credits) |
self.credits=toList(credits) |
self.description=description |
self.description=description |
self.contentType=contentType |
self.contentType=contentType |
|
self.copyrightType=copyrightType |
|
self.renderingType=renderingType |
self.responsible=responsible |
self.responsible=responsible |
|
self.resourceID=resourceID |
|
|
if coords: |
if coords: |
coordsnew=[ string.split(x,",") for x in coords] |
coordsnew=[ string.split(x,",") for x in coords] |
Line 504 class ECHO_resource(Folder):
|
Line 557 class ECHO_resource(Folder):
|
for data in self.metadata: |
for data in self.metadata: |
data_neu=re.sub('-','_',data) |
data_neu=re.sub('-','_',data) |
self.metaDataHash[data_neu]=getattr(self,data) |
self.metaDataHash[data_neu]=getattr(self,data) |
#print data_neu, getattr(self,data) |
|
#print self.metaDataHash,self.metadata |
|
|
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_resource_metadata.zpt').__of__(self) |
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_resource_metadata.zpt').__of__(self) |
return pt() |
return pt() |
Line 558 class ECHO_resource(Folder):
|
Line 610 class ECHO_resource(Folder):
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
|
def changeECHO_resource_metadata_local(self,RESPONSE=None): |
|
"""change metadata""" |
|
tags=self.findTagsFromMapping(self.contentType) |
|
for field in tags[1]: |
|
self.metaDataHash[self.getFieldTag(tags,field)]=self.REQUEST.form[self.getFieldTag(tags,field)] |
|
|
|
|
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
def changeECHO_resource_metadata(self,RESPONSE=None): |
def changeECHO_resource_metadata(self,RESPONSE=None): |
"""change metadata""" |
"""change metadata""" |
tags=self.findTagsFromMapping(self.contentType) |
tags=self.findTagsFromMapping(self.contentType) |
Line 575 class ECHO_resource(Folder):
|
Line 638 class ECHO_resource(Folder):
|
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
|
|
|
def getMDValue(self,fieldName): |
|
return self.metaDataHash.get(fieldName,'!!NOT USED HERE in Type: %s'%self.contentType) |
|
|
def newMetaXML(self): |
def newMetaXML(self): |
"""new index.meta""" |
"""new index.meta""" |
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
return writeMetadata(self.metalink,self.OSAS_meta) |
return writeMetadata(self.metalink,self.OSAS_meta) |
|
|
|
|
|
def getMetaDataXML(self): |
|
"""prints out metadata as stored in the echo environment, format is the index.meta format""" |
|
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
|
return writeMetadata(self.metalink,self.metaDataHash) |
|
|
def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None): |
def changeECHO_resource(self,metalink,link,title,label,description,contentType,responsible,weight,viewClassification="",coords=None,credits=None,RESPONSE=None): |
"""Änderung der Properties""" |
"""Änderung der Properties""" |
|
|
Line 601 class ECHO_resource(Folder):
|
Line 672 class ECHO_resource(Folder):
|
|
|
manage_options = Folder.manage_options+( |
manage_options = Folder.manage_options+( |
{'label':'Main Config','action':'ECHO_resource_config_main'}, |
{'label':'Main Config','action':'ECHO_resource_config_main'}, |
{'label':'Change Credits & Copyright','action':'ECHO_resource_config_credits'}, |
{'label':'Change Partners & Copyright','action':'ECHO_resource_config_credits'}, |
{'label':'Change Metadata','action':'ECHO_resource_config_metadata'}, |
{'label':'Change Metadata','action':'ECHO_resource_config_metadata'}, |
{'label':'Change Coords','action':'ECHO_resource_config_coords'}, |
{'label':'Change Coords','action':'ECHO_resource_config_coords'}, |
{'label':'Add coords','action':'ECHO_graphicEntry'}, |
{'label':'Add coords','action':'ECHO_graphicEntry'}, |
Line 671 class ECHO_resource(Folder):
|
Line 742 class ECHO_resource(Folder):
|
|
|
def getFieldValue(self,field): |
def getFieldValue(self,field): |
"""get value""" |
"""get value""" |
#print field |
|
try: |
try: |
|
|
ret=self.metaDataHash[field] |
ret=self.metaDataHash[field] |
Line 682 class ECHO_resource(Folder):
|
Line 753 class ECHO_resource(Folder):
|
except: |
except: |
return None |
return None |
|
|
|
def getMetaDataHash(self): |
|
"""md hash""" |
|
return self.metaDataHash |
|
|
|
def setFieldValue(self,field,value): |
|
"""get value""" |
|
|
|
if not hasattr(self,'metaDataHash'): |
|
setattr(self,'metaDataHash',{}) |
|
self.metaDataHash[field]=value[0:] |
|
|
|
|
|
|
def findLabelsFromMapping(self,referenceType): |
def findLabelsFromMapping(self,referenceType): |
"""gib hash mit label -> generic zurueck""" |
"""gib hash mit label -> generic zurueck""" |
self.referencetypes=self.ZopeFind(self.standardMD) |
#return {},[] |
#print "RT",referenceType |
|
|
temp=self.ZopeFind(self.standardMD) |
|
|
|
if referenceType=="": |
|
referenceType="book" |
|
|
|
|
bibdata={} |
bibdata={} |
retdata={} |
retdata={} |
|
fields=[] |
fieldlist=self.standardMD.fieldList |
fieldlist=self.standardMD.fieldList |
|
|
for referenceTypeF in self.referencetypes: |
for referenceTypeF in self.referencetypes: |
#print referenceTypeF[1].title,referenceType |
|
if referenceTypeF[1].title.lower() == referenceType.lower(): |
if referenceTypeF[1].title.lower() == referenceType.lower(): |
#print "OK" |
|
try: |
try: |
bibdata[referenceTypeF[1].title]=referenceTypeF[1].fields |
bibdata[referenceTypeF[1].title]=referenceTypeF[1].fields |
referenceType=referenceTypeF[1].title |
referenceType=referenceTypeF[1].title |
Line 703 class ECHO_resource(Folder):
|
Line 793 class ECHO_resource(Folder):
|
|
|
|
|
bibdata['data']=referenceTypeF[1] |
bibdata['data']=referenceTypeF[1] |
self.fields=bibdata[referenceType] |
fields=bibdata[referenceType] |
for field in fieldlist: |
for field in fieldlist: |
retdata[field]=referenceTypeF[1].getValue(field)[1] |
retdata[field]=referenceTypeF[1].getValue(field)[1] |
#print retdata,fieldlist |
|
return retdata,fieldlist |
return retdata,fieldlist,temp,fields |
|
|
def findTagsFromMapping(self,referenceType): |
def findTagsFromMapping(self,referenceType): |
"""gib hash mit label -> generic zurueck""" |
"""gib hash mit label -> generic zurueck""" |
self.referencetypes=self.ZopeFind(self.standardMD) |
|
|
|
|
if referenceType=="": |
|
referenceType="book" |
|
|
|
temp = self.ZopeFind(self.standardMD)[0:] |
|
|
|
|
|
#self.referencetypes=temp[0:] |
|
|
|
|
|
|
|
|
|
|
|
|
bibdata={} |
bibdata={} |
retdata={} |
retdata={} |
fieldlist=self.standardMD.fieldList |
fieldlist=self.standardMD.fieldList |
|
|
for referenceTypeF in self.referencetypes: |
for referenceTypeF in temp: |
|
|
if referenceTypeF[1].title.lower() == referenceType.lower(): |
if referenceTypeF[1].title.lower() == referenceType.lower(): |
try: |
try: |
Line 727 class ECHO_resource(Folder):
|
Line 829 class ECHO_resource(Folder):
|
except: |
except: |
bibdata[referenceType]=referenceTypeF[1].fields |
bibdata[referenceType]=referenceTypeF[1].fields |
bibdata['data']=referenceTypeF[1] |
bibdata['data']=referenceTypeF[1] |
self.fields=bibdata[referenceType] |
fields=bibdata[referenceType] |
for field in fieldlist: |
for field in fieldlist: |
retdata[field]=referenceTypeF[1].getValue(field)[0] |
retdata[field]=referenceTypeF[1].getValue(field)[0] |
|
|
return retdata,fieldlist |
return retdata,fieldlist,temp,fields |
|
|
|
|
|
|
|
def copyIndex_meta2echo_resource(self,RESPONSE=None): |
|
"""copy MD von Index_meta to the echo_resource""" |
|
|
|
(metadict, error)=readMetadata(self.metalink) |
|
|
|
self.metaDataHash={} |
|
if not error=="": #Fehler beim Auslesen des Metafiles |
|
return "ERROR:",error |
|
fields=self.findTagsFromMapping(self.contentType) |
|
|
|
#fields=self.findLabelsFromMapping(self.contentType) |
|
for field in fields[1]: |
|
|
|
if self.isDefinedInThisSet(fields,field): |
|
#print urllib.unquote(metadict.get(self.getFieldTag(fields,field),'')) |
|
self.setFieldValue(self.getFieldTag(fields,field),metadict.get(self.getFieldTag(fields,field),'')) |
|
|
|
|
|
|
|
if RESPONSE: |
|
return RESPONSE.redirect('manage_main') |
|
|
def ECHO_getResourceMD(self,template="yes"): |
def ECHO_getResourceMD(self,template="yes"): |
"""Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource""" |
"""Einlesen der Metadaten und Anlegen dieser Metadaten als Informationen zur Resource""" |
(metadict, error)=readMetadata(self.metalink) |
(metadict, error)=readMetadata(self.metalink) |
Line 754 class ECHO_resource(Folder):
|
Line 877 class ECHO_resource(Folder):
|
|
|
self.REQUEST.SESSION['metadict']=metadict |
self.REQUEST.SESSION['metadict']=metadict |
|
|
self.REQUEST.SESSION['diffs']=checkDiffs(self,metadict) |
|
|
|
|
self.REQUEST.SESSION['diffs']=checkDiffs(self,self.REQUEST.SESSION['metadict']) |
|
|
|
|
|
|
if template=="yes": |
if template=="yes": |
Line 764 class ECHO_resource(Folder):
|
Line 890 class ECHO_resource(Folder):
|
|
|
|
|
|
|
|
|
def ECHO_getMD(self,item): |
def ECHO_getMD(self,item): |
"""Ausgabe der MD""" |
"""Ausgabe der MD""" |
return getattr(self,item) |
return getattr(self,item) |
Line 773 class ECHO_resource(Folder):
|
Line 900 class ECHO_resource(Folder):
|
|
|
return self.REQUEST.RESPONSE.redirect(self.link) |
return self.REQUEST.RESPONSE.redirect(self.link) |
|
|
|
def startpage_html(self): |
|
"""prints out a startpage for a resource for use e.g. in the BVE""" |
|
|
|
# suche ob startpage.html in dem Ordner vorhanden ist, dann wir diese angezeigt |
|
|
|
sp=self.ZopeFind(self,obj_ids=['startpage.html']) |
|
|
|
if sp: |
|
return sp[1]() |
|
|
|
#prüfen ob irgendwo ein template |
|
if hasattr(self,'startpage_index_template'): |
|
return self.startpage_index_template() |
|
|
|
#generisches template ausgeben |
|
|
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ECHO_startpage_index_template_standard.zpt').__of__(self) |
|
pt.content_type="text/html" |
|
return pt() |
|
|
|
def toc_html(self): |
|
|
|
sp=self.ZopeFind(self,obj_ids=['toc.html']) |
|
|
|
if sp: |
|
return sp[0][1]() |
|
|
|
|
|
|
def generate_label(self): |
def generate_label(self): |
"""Erzeugt_standard_Label aus Template""" |
"""Erzeugt_standard_Label aus Template""" |
pt=getattr(self,"label_template_"+self.bib_type) |
pt=getattr(self,"label_template_"+self.bib_type) |
|
|
return pt() |
return pt() |
|
|
|
def generate_title(self,RESPONSE=None): |
|
"""Erzeugt_standard_Label aus Template""" |
|
pt=getattr(self,"label_template_"+self.contentType) |
|
|
|
self.title=pt() |
|
|
|
return pt() |
|
|
def manage_addECHO_resourceForm(self): |
def manage_addECHO_resourceForm(self): |
"""Form for adding a ressource""" |
"""Form for adding a ressource""" |
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_resourceForm.zpt').__of__(self) |
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_resourceForm.zpt').__of__(self) |
Line 786 def manage_addECHO_resourceForm(self):
|
Line 950 def manage_addECHO_resourceForm(self):
|
|
|
|
|
|
|
def manage_addECHO_resource(self,id,title,label,description,contentType,responsible,link,metalink,weight,credits=None,coords=None,RESPONSE=None): |
def manage_addECHO_resource(self,id,title,label,description,responsible,link,metalink,weight,copyrightType=None,resourceID=None,contentType=None,renderingType=None,credits=None,coords=None,RESPONSE=None): |
"""addaresource""" |
"""addaresource""" |
|
|
newObj=ECHO_resource(id,link,metalink,title,label,description,contentType,responsible,credits,weight,coords) |
newObj=ECHO_resource(id,link,metalink,resourceID,title,label,description,contentType,renderingType,copyrightType,responsible,credits,weight,coords) |
|
|
self._setObject(id,newObj) |
self._setObject(id,newObj) |
|
|
Line 838 class ECHO_externalLink(Folder):
|
Line 1002 class ECHO_externalLink(Folder):
|
if not hasattr(self,'coords'): |
if not hasattr(self,'coords'): |
|
|
self.coords=[''] |
self.coords=[''] |
#print "G",self.coords |
|
|
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_externalLink.zpt').__of__(self) |
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_externalLink.zpt').__of__(self) |
return pt() |
return pt() |
Line 1015 class ECHO_collection(Folder, Persistent
|
Line 1179 class ECHO_collection(Folder, Persistent
|
return ret+"<collection>"+getCollection(self)+"</collection>" |
return ret+"<collection>"+getCollection(self)+"</collection>" |
|
|
def createJavaScript(self): |
def createJavaScript(self): |
"""CreateJava""" |
"""OLD CreateJava""" |
ret=javaScriptMain |
ret=javaScriptMain |
|
|
dynamical="\n" |
dynamical="\n" |
Line 1029 class ECHO_collection(Folder, Persistent
|
Line 1193 class ECHO_collection(Folder, Persistent
|
return ret |
return ret |
|
|
def createJSAreas(self): |
def createJSAreas(self): |
"""new version of createJavaScript""" |
"""create area calls for JavaScript""" |
dynamical="\n" |
dynamical="\n" |
for ob in self.getGraphicCoords(): |
for ob in self.getGraphicCoords(): |
if ob[5] == "area": |
if ob[5] == "area": |
Line 1039 class ECHO_collection(Folder, Persistent
|
Line 1203 class ECHO_collection(Folder, Persistent
|
return dynamical |
return dynamical |
|
|
def createMapHead(self): |
def createMapHead(self): |
"""generate divs""" |
"""create javascript include and script tags for head""" |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/ECHO_content_map_frag_js')).__of__(self) |
pt=PageTemplateFile(os.path.join(package_home(globals()), 'zpt/ECHO_content_map_frag_js')).__of__(self) |
return pt() |
return pt() |
|
|
|
def createMapImg(self): |
|
"""generate img-tag for map""" |
|
bt = BrowserCheck(self) |
|
tag = "" |
|
src = self.REQUEST['URL1'] + "/overview" |
|
if bt.isN4: |
|
tag += '<ilayer id="overview" visibility="show"><img src="%s"></ilayer>'%src |
|
else: |
|
tag += '<img id="overview" src="%s" />'%src |
|
return tag |
|
|
def createMapLink(self, ob, text=None): |
def createMapLink(self, ob, text=None): |
"""generate map link""" |
"""generate map link""" |
|
bt = BrowserCheck(self) |
id = ob[1] |
id = ob[1] |
link = ob[1] |
link = ob[1] |
if text == None: |
if text == None: |
text = ob[2] |
text = ob[2] |
|
tag = "" |
|
if bt.isN4: |
|
tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) |
|
tag += ">" + text + "</a></ilayer>" |
|
else: |
tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) |
tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) |
if ob[3].contentType == 'text-popup': |
if ob[3].contentType == 'text-popup': |
tag += ' title="%s"'%ob[3].description |
tag += ' title="%s"'%ob[3].description |
Line 1061 class ECHO_collection(Folder, Persistent
|
Line 1242 class ECHO_collection(Folder, Persistent
|
link = ob[1] |
link = ob[1] |
vtype = ob[5] |
vtype = ob[5] |
ctype = ob[3].contentType |
ctype = ob[3].contentType |
|
bt = BrowserCheck(self) |
|
tag = "" |
|
|
|
if bt.isN4: |
|
tag += '<layer id="i.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)">'%(id,id,id) |
|
if vtype == "view point": |
|
rot = ob[4][4] |
|
tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,arrowsrc,rot) |
|
else: |
|
tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link) |
|
if ctype == "text-popup": |
|
desc = ob[3].description |
|
tag += ' alt="%s"'%desc |
|
tag += ' /></a>' |
|
tag += '</layer>' |
|
else: |
tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank">'%(id,id,id,link) |
tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank">'%(id,id,id,link) |
if vtype == "view point": |
if vtype == "view point": |
rot = ob[4][4] |
rot = ob[4][4] |
tag += '<img id="i.%s" src="%s&rot=%s" border="1" style="position:absolute; top:-100px; left:-100px; border-style:none" />'%(id,arrowsrc,rot) |
if bt.isIEWin and bt.versIE > 5: |
|
tag += '<span id="i.%s" style="position:absolute; top:-100px; left:-100px; border-style:none; border-width=1px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'%s&rot=%s\');"><img style="visibility:hidden" src="%s&rot=%s" /></span>'%(id,arrowsrc,rot,arrowsrc,rot) |
|
else: |
|
tag += '<img id="i.%s" src="%s&rot=%s" border="1" style="position:absolute; top:-100px; left:-100px; border-style:none;" />'%(id,arrowsrc,rot) |
|
else: |
|
if bt.isIEWin: |
|
tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;background:url(area_img)"'%(id) |
else: |
else: |
tag += '<span id="i.%s" style="position:absolute; top:-100px; left:-100px; border-style:none"'%(id) |
tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;"'%(id) |
if ctype == "text-popup": |
if ctype == "text-popup": |
desc = ob[3].description |
desc = ob[3].description |
tag += ' title="%s"'%desc |
tag += ' title="%s"'%desc |
tag += ' />' |
tag += '> </div>' |
tag += '</a>' |
tag += '</a>' |
return tag |
return tag |
|
|
Line 1115 class ECHO_collection(Folder, Persistent
|
Line 1317 class ECHO_collection(Folder, Persistent
|
for entry in entries: |
for entry in entries: |
if entry[1].meta_type == 'ECHO_resource': |
if entry[1].meta_type == 'ECHO_resource': |
entry[1].ECHO_getResourceMD(template="no") |
entry[1].ECHO_getResourceMD(template="no") |
#print "rerender",entry[1].getId() |
|
else: |
else: |
self.ECHO_rerenderLinksMD(entry[1]) |
self.ECHO_rerenderLinksMD(entry[1]) |
|
|
Line 1137 class ECHO_collection(Folder, Persistent
|
Line 1339 class ECHO_collection(Folder, Persistent
|
return [] |
return [] |
|
|
def __init__(self,id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle,secondaryLink,imageTag="",bgcolour=""): |
def __init__(self,id,title,label,description,contentType,responsible,credits,weight,sortfield,coords,secondaryLinkTitle,secondaryLink,imageTag="",bgcolour=""): |
#print "CO",coords |
|
|
|
self.id = id |
self.id = id |
"""Festlegen der ID""" |
"""Festlegen der ID""" |
Line 1248 class ECHO_collection(Folder, Persistent
|
Line 1450 class ECHO_collection(Folder, Persistent
|
if RESPONSE is not None: |
if RESPONSE is not None: |
RESPONSE.redirect('manage_main') |
RESPONSE.redirect('manage_main') |
|
|
security.declarePublic('index_html') |
|
|
|
|
|
def showOverview(self): |
def showOverview(self): |
"""overview""" |
"""overview""" |
Line 1290 class ECHO_collection(Folder, Persistent
|
Line 1490 class ECHO_collection(Folder, Persistent
|
|
|
def area_img(self): |
def area_img(self): |
"""area image""" |
"""area image""" |
|
bt = BrowserCheck(self) |
|
if bt.isIE or bt.isN4: |
return sendFile(self, 'images/red.gif', 'image/gif') |
return sendFile(self, 'images/red.gif', 'image/gif') |
|
else: |
|
return sendFile(self, 'images/reda.png', 'image/png') |
|
|
|
def trans_img(self): |
|
"""empty image""" |
|
return sendFile(self, 'images/trans.gif', 'image/gif') |
|
|
def hl_lib_js(self): |
def hl_lib_js(self): |
"""javascript""" |
"""javascript""" |
Line 1581 class ECHO_root(Folder,Persistent,Implic
|
Line 1789 class ECHO_root(Folder,Persistent,Implic
|
meta_type="ECHO_root" |
meta_type="ECHO_root" |
|
|
|
|
|
def getBibTag(self,tag,content): |
|
"""get field tag für index-meta-generation""" |
|
if not content or content=="": |
|
return "" |
|
ret="<%s>"%tag |
|
#ret+=urllib.quote(content) |
|
ret+=content |
|
|
|
ret+="</%s>"%tag |
|
return ret |
|
|
|
def getValueFromClass(self,field,found): |
|
"""retattribute falss existing""" |
|
try: |
|
|
|
return getattr(found,field).decode('ascii','ignore') |
|
except: |
|
return "" |
|
|
def getImageTag(self): |
def getImageTag(self): |
"""needed by main_template""" |
"""needed by main_template""" |
return "" |
return "" |
Line 1695 class ECHO_root(Folder,Persistent,Implic
|
Line 1922 class ECHO_root(Folder,Persistent,Implic
|
def checkIfArrow(obj): |
def checkIfArrow(obj): |
if hasattr(obj,'coords'): |
if hasattr(obj,'coords'): |
for coordtemp in obj.coords: |
for coordtemp in obj.coords: |
#print obj.title,len(coordtemp) |
|
if (len(coordtemp)>4) and not (coordtemp[4]==''): |
if (len(coordtemp)>4) and not (coordtemp[4]==''): |
return 4 |
return 4 |
return None |
return None |
Line 1767 class ECHO_root(Folder,Persistent,Implic
|
Line 1994 class ECHO_root(Folder,Persistent,Implic
|
|
|
for word in words: |
for word in words: |
strUrl=url%word |
strUrl=url%word |
#print "str",strUrl |
|
retStr+="""<a href="%s">%s</a><br/>"""%(strUrl,word) |
retStr+="""<a href="%s">%s</a><br/>"""%(strUrl,word) |
str=retStr |
str=retStr |
if str: |
if str: |
Line 1778 class ECHO_root(Folder,Persistent,Implic
|
Line 2005 class ECHO_root(Folder,Persistent,Implic
|
def link2html(self,str): |
def link2html(self,str): |
"""link2html fuer VLP muss hier noch raus""" |
"""link2html fuer VLP muss hier noch raus""" |
if str: |
if str: |
#print str |
|
str=re.sub("\&","&",str) |
str=re.sub("\&","&",str) |
dom=xml.dom.minidom.parseString("<?xml version='1.0' ?><txt>"+str+"</txt>") |
dom=xml.dom.minidom.parseString("<?xml version='1.0' ?><txt>"+str+"</txt>") |
links=dom.getElementsByTagName("link") |
links=dom.getElementsByTagName("link") |
|
|
#print "link",links |
|
for link in links: |
for link in links: |
link.tagName="a" |
link.tagName="a" |
ref=link.getAttribute("ref") |
ref=link.getAttribute("ref") |
Line 1798 class ECHO_root(Folder,Persistent,Implic
|
Line 2025 class ECHO_root(Folder,Persistent,Implic
|
dbs={'vl_literature':'AND CD LIKE \'%lise%\'','vl_technology':'','vl_people':''} |
dbs={'vl_literature':'AND CD LIKE \'%lise%\'','vl_technology':'','vl_people':''} |
res=None |
res=None |
for db in dbs.keys(): |
for db in dbs.keys(): |
#print ref,"select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db]) |
|
|
|
res=res or self.search(var=str("select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db]))) |
res=res or self.search(var=str("select reference from %s where reference =\'%s\' %s"%(db,ref,dbs[db]))) |
return res |
return res |
Line 1807 class ECHO_root(Folder,Persistent,Implic
|
Line 2033 class ECHO_root(Folder,Persistent,Implic
|
|
|
def PgQuoteString(self,string): |
def PgQuoteString(self,string): |
"""Quote string""" |
"""Quote string""" |
#print "PG",string |
|
return libpq.PgQuoteString(string) |
return libpq.PgQuoteString(string) |
|
|
def getPartners(self): |
def getPartners(self): |
Line 1925 class ECHO_root(Folder,Persistent,Implic
|
Line 2151 class ECHO_root(Folder,Persistent,Implic
|
else: |
else: |
ret+="""\n<resource echoLink="%s" viewerLink="%s"/>"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?')) |
ret+="""\n<resource echoLink="%s" viewerLink="%s"/>"""%(urllib.quote(echo_url,safe='/:?'),urllib.quote(viewer_url,safe='/:?')) |
ret +="""\n</index>""" |
ret +="""\n</index>""" |
print ret |
|
|
|
self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml") |
self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml") |
self.REQUEST.RESPONSE.write(ret) |
self.REQUEST.RESPONSE.write(ret) |
Line 1942 def manage_addECHO_rootForm(self):
|
Line 2168 def manage_addECHO_rootForm(self):
|
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_root.zpt').__of__(self) |
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_root.zpt').__of__(self) |
return pt() |
return pt() |
|
|
|
class ECHO_copyrightType(Folder): |
|
"""copyright typ""" |
|
|
|
meta_type="ECHO_copyrightType" |
|
|
|
def __init__(self,id,title,label): |
|
"""init""" |
|
self.id=id |
|
self.title=title |
|
self.label=label |
|
|
|
manage_options = Folder.manage_options+( |
|
{'label':'Main Config','action':'ECHO_copyrightType_config_mainForm'}, |
|
) |
|
|
|
def ECHO_copyrightType_config_mainForm(self): |
|
"""change form""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/ChangeECHO_copyrightType').__of__(self) |
|
pt.content_type="text/html" |
|
return pt() |
|
|
|
def ECHO_copyrightType_config_main(self,title,label,RESPONSE=None): |
|
"""change""" |
|
self.title=title |
|
self.label=label |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
def manage_addECHO_copyrightTypeForm(self): |
|
"""Form for adding a ressource""" |
|
pt=PageTemplateFile('Products/ECHO_content/zpt/AddECHO_copyrightTypeForm.zpt').__of__(self) |
|
return pt() |
|
|
|
|
|
def manage_addECHO_copyrightType(self,id,title,label,RESPONSE=None): |
|
"""addaresource""" |
|
|
|
newObj=ECHO_copyrightType(id,title,label) |
|
|
|
self._setObject(id,newObj) |
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
|
class ECHO_partner(Image,Persistent): |
class ECHO_partner(Image,Persistent): |
"""ECHO Partner""" |
"""ECHO Partner""" |
|
|