version 1.43, 2005/02/08 22:04:34
|
version 1.49, 2005/06/08 10:23:16
|
Line 6 import string
|
Line 6 import string
|
import xml.dom.minidom |
import xml.dom.minidom |
import types |
import types |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
from Products.PageTemplates.PageTemplateFile import PageTemplateFile |
|
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate |
from OFS.SimpleItem import SimpleItem |
from OFS.SimpleItem import SimpleItem |
from Globals import package_home |
from Globals import package_home |
import Globals |
import Globals |
from AccessControl import ClassSecurityInfo |
from AccessControl import ClassSecurityInfo |
import os.path |
import os.path |
|
|
displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder'] |
displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','ECHO_movie'] |
|
|
def content_html(self,type): |
def content_html(self,type): |
"""template fuer content""" |
"""template fuer content""" |
Line 52 class ECHO_basis:
|
Line 53 class ECHO_basis:
|
return ret |
return ret |
|
|
|
|
|
def RDF(self): |
|
"""showrdf""" |
|
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
|
ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n""" |
|
|
|
ret+=self.getRDF(urn=self.absolute_url())+"\n" |
|
|
|
|
|
ret+="""</RDF:RDF>""" |
|
return ret |
|
|
|
|
def createSubElementRDF(self,urn=None): |
def createSubElementRDF(self,urn=None): |
"""rdf list""" |
"""rdf list""" |
Line 113 class ECHO_basis:
|
Line 125 class ECHO_basis:
|
|
|
def getLabel(self): |
def getLabel(self): |
"""title""" |
"""title""" |
|
if not hasattr(self,'label'): |
|
self.label="" |
|
|
|
if self.label=="": |
|
ret=self.getTitle() |
|
if ret=="": |
|
ret=self.getId() |
|
return ret |
|
|
return self.decode(self.label) |
return self.decode(self.label) |
try: |
try: |
Line 246 class ECHO_basis:
|
Line 266 class ECHO_basis:
|
"""generate img-tag for map of parent""" |
"""generate img-tag for map of parent""" |
return self.aq_parent.createMapImg() |
return self.aq_parent.createMapImg() |
|
|
def createMapLink(self, ob, text=None): |
def createMapLink(self, ob, text=None, target="_blank"): |
"""generate map link""" |
"""generate map link""" |
bt = BrowserCheck(self) |
bt = BrowserCheck(self) |
id = ob.getFullId() |
id = ob.getFullId() |
Line 259 class ECHO_basis:
|
Line 279 class ECHO_basis:
|
tag = "" |
tag = "" |
if bt.isN4: |
if bt.isN4: |
# N4 needs layer for highlighting |
# N4 needs layer for highlighting |
tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link) |
tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target) |
tag += ">" + text + "</a></ilayer>" |
tag += ">" + text + "</a></ilayer>" |
else: |
else: |
# a-element |
# a-element |
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="%s"'%(id,id,id,link,target) |
if tiptext: |
if tiptext: |
tag += ' title="%s"'%tiptext |
tag += ' title="%s"'%tiptext |
tag += ">" + text + "</a>" |
tag += ">" + text + "</a>" |
return tag |
return tag |
|
|
def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil"): |
def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil",target="_blank"): |
"""generate map link image, text and other stuff""" |
"""generate map link image, text and other stuff""" |
bt = BrowserCheck(self) |
bt = BrowserCheck(self) |
id = ob.getFullId() |
id = ob.getFullId() |
Line 291 class ECHO_basis:
|
Line 311 class ECHO_basis:
|
tag += '</layer>' |
tag += '</layer>' |
else: |
else: |
# create a-element |
# create a-element |
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="%s">'%(id,id,id,link,target) |
if ob.isTypeArrow(): |
if ob.isTypeArrow(): |
rot = ob.angle |
rot = ob.angle |
if bt.isIEWin and bt.versIE > 5: |
if bt.isIEWin and bt.versIE > 5: |
Line 395 def checkOnlyOneInGroup(object):
|
Line 415 def checkOnlyOneInGroup(object):
|
return displayedObjects[0][1] |
return displayedObjects[0][1] |
else: return object |
else: return object |
|
|
def getSubCols(self, sortfield=None, subColTypes=displayTypes, sortFieldMD=None): |
def getSubCols(self, sortfield=None, subColTypes=displayTypes, sortFieldMD=None,searchMD=None): |
|
|
|
|
def sort(x,y): |
def sort(x,y): |
Line 419 def getSubCols(self, sortfield=None, sub
|
Line 439 def getSubCols(self, sortfield=None, sub
|
|
|
for entry in displayedObjects: |
for entry in displayedObjects: |
|
|
|
|
object=entry[1] |
object=entry[1] |
|
if searchMD and hasattr(object,'getMDValue'): |
|
flag=0 |
|
for field in searchMD.keys(): |
|
if object.getMDValue(field)==searchMD[field]: |
|
flag=1 |
|
else: |
|
flag=0 |
|
break |
|
if flag==1: |
|
ids.append(object) |
|
else: |
ids.append(object) |
ids.append(object) |
|
|
if not sortfield: |
if not sortfield: |
Line 617 def findObjectPath(startobject, filename
|
Line 649 def findObjectPath(startobject, filename
|
paths = filename.split('/') |
paths = filename.split('/') |
object = startobject |
object = startobject |
for path in paths: |
for path in paths: |
|
|
if hasattr(object, path): |
if hasattr(object, path): |
object = getattr(object, path) |
object = getattr(object, path) |
else: |
else: |
Line 941 class MapArea(SimpleItem):
|
Line 974 class MapArea(SimpleItem):
|
# call this to initialize framework classes, which |
# call this to initialize framework classes, which |
# does the right thing with the security assertions. |
# does the right thing with the security assertions. |
Globals.InitializeClass(MapArea) |
Globals.InitializeClass(MapArea) |
|
|
|
|
|
class MapText(ZopePageTemplate): |
|
"""class to hold text for map areas""" |
|
|
|
meta_type = 'ECHO_mapText' |
|
# Create a SecurityInfo for this class. |
|
security = ClassSecurityInfo() |
|
security.setDefaultAccess("allow") |
|
|
|
_default_content_fn = os.path.join(package_home(globals()), |
|
'zpt', 'ECHO_mapText_default.html') |
|
|
|
def __init__(self, id, text=None, content_type=None): |
|
self.id = str(id) |
|
self.ZBindings_edit(self._default_bindings) |
|
if text is None: |
|
text = open(self._default_content_fn).read() |
|
self.pt_edit(text, content_type) |
|
|
|
# Product registration and Add support |
|
manage_addMapTextForm = PageTemplateFile( |
|
'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm') |
|
|
|
def manage_addMapText(self, id, title=None, text=None, |
|
REQUEST=None, submit=None): |
|
"Add a Map Text with optional file content." |
|
|
|
id = str(id) |
|
if REQUEST is None: |
|
self._setObject(id, MapText(id, text)) |
|
ob = getattr(self, id) |
|
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 = MapText(id, text) |
|
else: |
|
zpt = MapText(id, file, headers.get('content_type')) |
|
|
|
self._setObject(id, zpt) |
|
if title: |
|
ob = getattr(self, id) |
|
ob.pt_setTitle(title) |
|
|
|
try: |
|
u = self.DestinationURL() |
|
except AttributeError: |
|
u = REQUEST['URL1'] |
|
|
|
if submit == " Add and Edit ": |
|
u = "%s/%s" % (u, urllib.quote(id)) |
|
REQUEST.RESPONSE.redirect(u+'/manage_main') |
|
return '' |
|
|
|
# call this to initialize framework classes, which |
|
# does the right thing with the security assertions. |
|
Globals.InitializeClass(MapText) |