'%(id,id,id,link,target)
if ob.isTypeArrow():
+ # DOM - Arrow
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
+
+ try:
+ rot=float(rot)
+ except:
+ rot=0
+
+ if float(rot) < 0:
+ marksrc = circlesrc
if bt.isIEWin and bt.versIE > 5:
# IE/Win 5.5 has "feature" for PNG transparency
- tag += ''%(id,arrowsrc,rot,arrowsrc,rot)
+ tag += ''%(id,marksrc,rot,marksrc,rot)
else:
# arrow image
- tag += ''%(id,arrowsrc,rot)
+ tag += ''%(id,marksrc,rot)
+ elif ob.isTypeText():
+ # DOM - Text
+ tag += ''
+ tag += ob.getText()
+ tag += '
'
else:
+ # DOM - Area
if bt.isIE:
# IE needs transparent img for area
tag += '"
else:
- # div for area
+ # empty div for area
tag += ' 4:
@@ -887,7 +1003,8 @@ class MapArea(SimpleItem):
self.id = id
self.label = label
self.setType(type)
- self.text = text
+ self.tip = tip
+ self.permanent = permanent
def setCoords(self, coords):
"""sets the coords"""
@@ -922,6 +1039,8 @@ class MapArea(SimpleItem):
self.type = MapArea.TYPE_ARROW
elif type == MapArea.TYPE_AREA:
self.type = MapArea.TYPE_AREA
+ elif type == MapArea.TYPE_TEXT:
+ self.type = MapArea.TYPE_TEXT
else:
self.type = MapArea.TYPE_AREA
@@ -933,6 +1052,10 @@ class MapArea(SimpleItem):
"""returns if the type is arrow"""
return self.type == MapArea.TYPE_ARROW
+ def isTypeText(self):
+ """returns if the type is text"""
+ return self.type == MapArea.TYPE_TEXT
+
def getAngle(self):
"""returns the angle"""
return self.angle
@@ -941,18 +1064,31 @@ class MapArea(SimpleItem):
"""sets the angle"""
self.angle = angle
- def getText(self):
+ def getTip(self):
"""returns the popup text"""
- if self.text is None:
+ # patch old version
+ if not hasattr(self, 'tip'):
+ self.tip = self.text
+
+ if self.tip is None:
if hasattr(self, 'aq_parent'):
parent = self.aq_parent
if parent.contentType == 'text-popup':
return parent.description
- return self.text
+ return self.tip
- def setText(self, text):
+ def setTip(self, text):
"""sets the text"""
- self.text = text
+ self.tiptext = text
+
+ def getText(self):
+ """returns the text fpr the area"""
+ if hasattr(self, 'aq_parent'):
+ parent = self.aq_parent
+ text = parent.getMapText()
+ if text is not None:
+ return text.document_src()
+ return ""
def getLabel(self):
"""returns the link label"""
@@ -965,27 +1101,41 @@ class MapArea(SimpleItem):
"""sets the label"""
self.label = label
+ def isPermanent(self):
+ """returns the permanent state"""
+ # patch old objects
+ if not hasattr(self, 'permanent'):
+ self.permanent = False
+ return self.permanent
+
+ def setPermanent(self, state):
+ """sets the permanent state"""
+ if state:
+ self.permanent = True
+ else:
+ self.permanent = False
+
def getLinkId(self):
if hasattr(self, 'aq_parent'):
return self.aq_parent.id
return self.id
-
# call this to initialize framework classes, which
# does the right thing with the security assertions.
Globals.InitializeClass(MapArea)
-class MapText(ZopePageTemplate):
+class MapText(Folder,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')
+ 'html', 'ECHO_mapText_default.html')
def __init__(self, id, text=None, content_type=None):
self.id = str(id)
@@ -994,6 +1144,34 @@ class MapText(ZopePageTemplate):
text = open(self._default_content_fn).read()
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
manage_addMapTextForm = PageTemplateFile(
'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm')