--- ECHO_content/ECHO_helpers.py 2005/06/09 11:12:59 1.51 +++ ECHO_content/ECHO_helpers.py 2005/06/10 10:23:54 1.55 @@ -229,30 +229,37 @@ class ECHO_basis: coords = string.split(coordstring, ',') angle = self.REQUEST.get('angle.'+id, '0') type = self.REQUEST.get('type.'+id, 'area') + permanent = self.REQUEST.get('permanent.'+id, '') if len(coords) == 4: area.setCoordString(coordstring) area.setAngle(angle) area.setType(type) - # add new area + area.setPermanent(permanent) + # add the "new" area if self.REQUEST.has_key('add'): coordstring = self.REQUEST.get('coords.new', '') coords = string.split(coordstring, ',') angle = self.REQUEST.get('angle.new', '0') type = self.REQUEST.get('type.new', 'area') + permanent = self.REQUEST.get('permanent.new', '') if len(coords) == 4: coords.append(angle) - area = MapArea(None, coords, type=type) + area = MapArea(None, coords, type=type, permanent=permanent) self.addMapArea(area) # return to edit area menu if RESPONSE is not None: RESPONSE.redirect('ECHO_graphicEntry') - def createJSAreas(self, areas): + def createJSAreas(self, areas, forcepermanent=None): """create area calls for JavaScript""" - dynamical="\n" + js="\n" for ob in areas: - dynamical+="""addArea('%s', 'overview', %s, '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType()) - return dynamical + if forcepermanent is not None: + perm = forcepermanent + else: + perm = ob.isPermanent() + js+="""addArea('%s', 'overview', %s, '%s', '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType(),perm) + return js def createMapHead(self): """create javascript include and script tags for head""" @@ -299,7 +306,7 @@ class ECHO_basis: tag += ">" + text + "" return tag - def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil",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"): """generate map link image, text and other stuff""" bt = BrowserCheck(self) id = ob.getFullId() @@ -308,37 +315,50 @@ class ECHO_basis: tag = "" if bt.isN4: + # # N4 needs layer and img elements + # tag += ''%(id,id,id) if ob.isTypeArrow(): + # N4 - Arrow rot = ob.angle - tag += ''%(link,arrowsrc,rot) + marksrc = arrowsrc + if float(rot) < 0: + marksrc = circlesrc + tag += ''%(link,marksrc,rot) else: + # N4 - Area tag += ''%(id,id,id,link,target) if ob.isTypeArrow(): + # DOM - Arrow rot = ob.angle + marksrc = arrowsrc + 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(): - # div for area - tag += '
4: @@ -906,7 +926,7 @@ class MapArea(SimpleItem): self.label = label self.setType(type) self.tip = tip - self.volatile = volatile + self.permanent = permanent def setCoords(self, coords): """sets the coords""" @@ -1003,6 +1023,20 @@ 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