version 1.56, 2005/06/13 10:35:04
|
version 1.64, 2005/11/03 14:45:28
|
Line 12 from Globals import package_home
|
Line 12 from Globals import package_home
|
import Globals |
import Globals |
from AccessControl import ClassSecurityInfo |
from AccessControl import ClassSecurityInfo |
import os.path |
import os.path |
|
from OFS.Folder import Folder |
|
import ECHO_collection |
|
|
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'] |
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'] |
|
|
Line 36 class ECHO_basis:
|
Line 38 class ECHO_basis:
|
"""basis eigenschaften fuer echo objekte""" |
"""basis eigenschaften fuer echo objekte""" |
security=ClassSecurityInfo() |
security=ClassSecurityInfo() |
security.declarePublic('getImageTag') |
security.declarePublic('getImageTag') |
|
|
|
def manage_addECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None): |
|
return ECHO_collection.manage_addECHO_locale(self,lang,title,label) |
|
|
def getImageTag(self): |
def getImageTag(self): |
"""sollte uerberschrieben werden, falls von der Klasse eine imagetag zurueckkommt""" |
"""sollte uerberschrieben werden, falls von der Klasse eine imagetag zurueckkommt""" |
|
|
Line 116 class ECHO_basis:
|
Line 122 class ECHO_basis:
|
|
|
def getTitle(self): |
def getTitle(self): |
"""title""" |
"""title""" |
|
lang=self.getLanguage() |
|
locale=None |
|
if lang and not (lang =="de"): |
|
locale=self.ZopeFind(self,obj_ids=["locale_"+lang]) |
|
|
|
if locale: |
|
return self.decode(locale[0][1].title) |
|
else: |
return self.decode(self.title) |
return self.decode(self.title) |
|
|
|
|
try: |
try: |
return self.title.encode('utf-8','ignore') |
return self.title.encode('utf-8','ignore') |
except: |
except: |
Line 125 class ECHO_basis:
|
Line 141 class ECHO_basis:
|
|
|
def getLabel(self): |
def getLabel(self): |
"""title""" |
"""title""" |
|
lang=self.getLanguage() |
|
locale=None |
|
if lang and not (lang=="de"): |
|
locale=self.ZopeFind(self,obj_ids=["locale_"+lang]) |
|
|
|
if locale: |
|
return self.decode(locale[0][1].label) |
|
|
|
|
if not hasattr(self,'label'): |
if not hasattr(self,'label'): |
self.label="" |
self.label="" |
|
|
Line 208 class ECHO_basis:
|
Line 233 class ECHO_basis:
|
def getMapText(self): |
def getMapText(self): |
"""returns the MapText""" |
"""returns the MapText""" |
# get (the first) contained MapText |
# get (the first) contained MapText |
|
#lang="en" |
|
lang=self.getLanguage() |
|
res=None |
|
if lang and not (lang=="de"): |
|
resTmp = self.ZopeFind(self, obj_metatypes=('ECHO_mapText')) |
|
res = self.ZopeFind(resTmp[0][1]) |
|
|
|
if not res: |
res = self.ZopeFind(self, obj_metatypes=('ECHO_mapText')) |
res = self.ZopeFind(self, obj_metatypes=('ECHO_mapText')) |
if len(res) > 0: |
if len(res) > 0: |
text = res[0][1] |
text = res[0][1] |
Line 319 class ECHO_basis:
|
Line 352 class ECHO_basis:
|
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", circlesrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/kreis", target="_blank"): |
def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil", circlesrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/kreis", target="_blank",backLink=None,alternativArrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil_blau"): |
"""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 335 class ECHO_basis:
|
Line 368 class ECHO_basis:
|
if ob.isTypeArrow(): |
if ob.isTypeArrow(): |
# N4 - Arrow |
# N4 - Arrow |
rot = ob.angle |
rot = ob.angle |
|
|
|
if hasattr(getattr(self,link),'link'): |
|
cLink=getattr(self,link).link |
|
# if existing delete virtuell path |
|
cLink=cLink.replace('/'.join(self.REQUEST['VirtualRootPhysicalPath']),'') |
|
|
|
if backLink and hasattr(getattr(self,link),'link') and backLink==self.REQUEST['SERVER_URL']+cLink.lstrip(): |
|
marksrc=alternativArrowsrc |
|
else: |
marksrc = arrowsrc |
marksrc = arrowsrc |
|
|
|
|
if float(rot) < 0: |
if float(rot) < 0: |
marksrc = circlesrc |
marksrc = circlesrc |
tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,marksrc,rot) |
tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,marksrc,rot) |
Line 360 class ECHO_basis:
|
Line 404 class ECHO_basis:
|
if ob.isTypeArrow(): |
if ob.isTypeArrow(): |
# DOM - Arrow |
# DOM - Arrow |
rot = ob.angle |
rot = ob.angle |
|
|
|
if hasattr(getattr(self,link),'link'): |
|
cLink=getattr(self,link).link |
|
# if existing delete virtuell path |
|
if hasattr(self.REQUEST,'VirtualRootPhysicalPath'): |
|
cLink=cLink.replace('/'.join(self.REQUEST['VirtualRootPhysicalPath']),'') |
|
|
|
if backLink and hasattr(getattr(self,link),'link') and backLink==self.REQUEST['SERVER_URL']+cLink.lstrip(): |
|
marksrc=alternativArrowsrc |
|
else: |
marksrc = arrowsrc |
marksrc = arrowsrc |
|
|
|
try: |
|
rot=float(rot) |
|
except: |
|
rot=0 |
|
|
if float(rot) < 0: |
if float(rot) < 0: |
marksrc = circlesrc |
marksrc = circlesrc |
if bt.isIEWin and bt.versIE > 5: |
if bt.isIEWin and bt.versIE > 5: |
Line 471 def checkOnlyOneInGroup(object):
|
Line 531 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,searchMD=None): |
def getSubCols(self, sortfield=None, subColTypes=displayTypes, sortFieldMD=None,searchMD=None,generic="yes"): |
|
|
|
|
def sort(x,y): |
def sort(x,y): |
return cmp(x[0],y[0]) |
return cmp(x[0],y[0]) |
|
|
def sortfnc(sortfield,x,y): |
def sortfnc(sortfield,x,y): |
try: |
try: |
xa=x[1].getMDValue(sortfield) |
xa=x[1].getMDValue(sortfield,generic=generic) |
except: |
except: |
xa="" |
xa="" |
try: |
try: |
ya=y[1].getMDValue(sortfield) |
ya=y[1].getMDValue(sortfield,generic=generic) |
except: |
except: |
ya="" |
ya="" |
return cmp(xa,ya) |
return cmp(xa,ya) |
Line 493 def getSubCols(self, sortfield=None, sub
|
Line 552 def getSubCols(self, sortfield=None, sub
|
displayedObjects=self.ZopeFind(self,obj_metatypes=subColTypes) |
displayedObjects=self.ZopeFind(self,obj_metatypes=subColTypes) |
|
|
|
|
|
|
for entry in displayedObjects: |
for entry in displayedObjects: |
|
|
|
|
Line 500 def getSubCols(self, sortfield=None, sub
|
Line 560 def getSubCols(self, sortfield=None, sub
|
if searchMD and hasattr(object,'getMDValue'): |
if searchMD and hasattr(object,'getMDValue'): |
flag=0 |
flag=0 |
for field in searchMD.keys(): |
for field in searchMD.keys(): |
if object.getMDValue(field)==searchMD[field]: |
if object.getMDValue(field,generic=generic)==searchMD[field]: |
flag=1 |
flag=1 |
else: |
else: |
flag=0 |
flag=0 |
Line 548 def ECHO_rerenderLinksMD(self,obj=None,t
|
Line 608 def ECHO_rerenderLinksMD(self,obj=None,t
|
for entry in entries: |
for entry in entries: |
if entry[1].meta_type == 'ECHO_resource': |
if entry[1].meta_type == 'ECHO_resource': |
try: |
try: |
entry[1].ECHO_getResourceMD(template="no") |
entry[1].ECHO_getResourceMD(template="no",overwrite="yes") |
if "title" in types: |
if "title" in types: |
entry[1].generate_title() |
entry[1].generate_title() |
if "label" in types: |
if "label" in types: |
Line 566 def reloadMetaDataFromStorage(self,RESPO
|
Line 626 def reloadMetaDataFromStorage(self,RESPO
|
"""copy metadata from the storage to ECHO""" |
"""copy metadata from the storage to ECHO""" |
ret="" |
ret="" |
resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1) |
resources=self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1) |
|
if RESPONSE is not None: |
|
RESPONSE.setHeader("Content-Type", type) |
|
RESPONSE.write("<html><body>\n") |
|
|
for resource in resources: |
for resource in resources: |
x=str(resource[1].copyIndex_meta2echo_resource())+"<br>" |
x=str(resource[1].copyIndex_meta2echo_resource())+"<br>" |
|
if RESPONSE is not None: |
|
RESPONSE.write(x+"\n") |
|
|
ret+=x |
ret+=x |
|
|
if RESPONSE is not None: |
if RESPONSE is not None: |
#RESPONSE.redirect('./manage_main') |
#RESPONSE.redirect('./manage_main') |
return "<html><body>"+ret+"</html></body>" |
RESPONSE.write( "</html></body>") |
|
|
return ret |
return ret |
|
|
Line 677 def checkDiffs(self,metadict):
|
Line 743 def checkDiffs(self,metadict):
|
|
|
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.getMDValue(self.getFieldTag(tags,field)))==metadict[self.getFieldTag(tags,field)]): |
diffs[self.getFieldTag(tags,field)]=1 |
diffs[self.getFieldTag(tags,field)]=1 |
else: |
else: |
|
|
Line 1066 class MapArea(SimpleItem):
|
Line 1132 class MapArea(SimpleItem):
|
Globals.InitializeClass(MapArea) |
Globals.InitializeClass(MapArea) |
|
|
|
|
class MapText(ZopePageTemplate): |
class MapText(Folder,ZopePageTemplate): |
"""class to hold text for map areas""" |
"""class to hold text for map areas""" |
|
|
meta_type = 'ECHO_mapText' |
meta_type = 'ECHO_mapText' |
Line 1074 class MapText(ZopePageTemplate):
|
Line 1140 class MapText(ZopePageTemplate):
|
security = ClassSecurityInfo() |
security = ClassSecurityInfo() |
security.setDefaultAccess("allow") |
security.setDefaultAccess("allow") |
|
|
|
|
_default_content_fn = os.path.join(package_home(globals()), |
_default_content_fn = os.path.join(package_home(globals()), |
'html', 'ECHO_mapText_default.html') |
'html', 'ECHO_mapText_default.html') |
|
|
Line 1084 class MapText(ZopePageTemplate):
|
Line 1151 class MapText(ZopePageTemplate):
|
text = open(self._default_content_fn).read() |
text = open(self._default_content_fn).read() |
self.pt_edit(text, content_type) |
self.pt_edit(text, content_type) |
|
|
|
def createLocale(self): |
|
"""create locale""" |
|
return ECHO_collection.manage_addECHO_localeForm(self) |
|
|
|
manage_main=ZopePageTemplate.pt_editForm |
|
|
|
def manage_addECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None): |
|
"""manage add echo locale in map""" |
|
ECHO_collection.manage_addECHO_locale(self,lang,title,label,text,content_type) |
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
|
def changeLocale(self): |
|
"""change locale""" |
|
return self.locale_en.change_ECHO_localeForm() |
|
|
|
def change_ECHO_locale(self,lang,title,label,text=None,content_type=None,RESPONSE=None): |
|
"""change echo locale""" |
|
|
|
obj= self.locale_en.change_ECHO_locale(lang,title,label,text,content_type,RESPONSE) |
|
|
|
|
|
|
|
if RESPONSE is not None: |
|
RESPONSE.redirect('manage_main') |
|
|
|
|
# Product registration and Add support |
# Product registration and Add support |
manage_addMapTextForm = PageTemplateFile( |
manage_addMapTextForm = PageTemplateFile( |
'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm') |
'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm') |