version 1.52, 2005/06/09 15:08:01
|
version 1.53, 2005/06/09 16:35:51
|
Line 229 class ECHO_basis:
|
Line 229 class ECHO_basis:
|
coords = string.split(coordstring, ',') |
coords = string.split(coordstring, ',') |
angle = self.REQUEST.get('angle.'+id, '0') |
angle = self.REQUEST.get('angle.'+id, '0') |
type = self.REQUEST.get('type.'+id, 'area') |
type = self.REQUEST.get('type.'+id, 'area') |
|
permanent = self.REQUEST.get('permanent.'+id, '') |
if len(coords) == 4: |
if len(coords) == 4: |
area.setCoordString(coordstring) |
area.setCoordString(coordstring) |
area.setAngle(angle) |
area.setAngle(angle) |
area.setType(type) |
area.setType(type) |
|
area.setPermanent(permanent) |
# add new area |
# add new area |
if self.REQUEST.has_key('add'): |
if self.REQUEST.has_key('add'): |
coordstring = self.REQUEST.get('coords.new', '') |
coordstring = self.REQUEST.get('coords.new', '') |
coords = string.split(coordstring, ',') |
coords = string.split(coordstring, ',') |
angle = self.REQUEST.get('angle.new', '0') |
angle = self.REQUEST.get('angle.new', '0') |
type = self.REQUEST.get('type.new', 'area') |
type = self.REQUEST.get('type.new', 'area') |
|
permanent = self.REQUEST.get('permanent.'+id, '') |
if len(coords) == 4: |
if len(coords) == 4: |
coords.append(angle) |
coords.append(angle) |
area = MapArea(None, coords, type=type) |
area = MapArea(None, coords, type=type, permanent=permanent) |
self.addMapArea(area) |
self.addMapArea(area) |
# return to edit area menu |
# return to edit area menu |
if RESPONSE is not None: |
if RESPONSE is not None: |
Line 249 class ECHO_basis:
|
Line 252 class ECHO_basis:
|
|
|
def createJSAreas(self, areas): |
def createJSAreas(self, areas): |
"""create area calls for JavaScript""" |
"""create area calls for JavaScript""" |
dynamical="\n" |
js="\n" |
for ob in areas: |
for ob in areas: |
dynamical+="""addArea('%s', 'overview', %s, '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType()) |
js+="""addArea('%s', 'overview', %s, '%s', '%s');\n"""%(ob.getFullId(),ob.getCoordString(),ob.getType(),ob.isPermanent()) |
return dynamical |
return js |
|
|
def createMapHead(self): |
def createMapHead(self): |
"""create javascript include and script tags for head""" |
"""create javascript include and script tags for head""" |
Line 316 class ECHO_basis:
|
Line 319 class ECHO_basis:
|
# N4 - Arrow |
# N4 - Arrow |
rot = ob.angle |
rot = ob.angle |
marksrc = arrowsrc |
marksrc = arrowsrc |
if 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) |
else: |
else: |
Line 337 class ECHO_basis:
|
Line 340 class ECHO_basis:
|
marksrc = arrowsrc |
marksrc = arrowsrc |
if float(rot) < 0: |
if float(rot) < 0: |
marksrc = circlesrc |
marksrc = circlesrc |
print "ROT: ", rot, " mark: ", marksrc |
|
if bt.isIEWin and bt.versIE > 5: |
if bt.isIEWin and bt.versIE > 5: |
# IE/Win 5.5 has "feature" for PNG transparency |
# IE/Win 5.5 has "feature" for PNG transparency |
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,marksrc,rot,marksrc,rot) |
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,marksrc,rot,marksrc,rot) |
Line 347 class ECHO_basis:
|
Line 349 class ECHO_basis:
|
elif ob.isTypeText(): |
elif ob.isTypeText(): |
# DOM - Text |
# DOM - Text |
tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;"'%(id) |
tag += '<div id="i.%s" style="position:absolute; top:-100px; left:-100px;"'%(id) |
if tiptext: |
tag += '><div id="t.%s" class="maptext"'%(id) |
tag += ' title="%s"'%tiptext |
tag += 'style="visibility:hidden">' |
tag += '><div id="t.%s" class="maptext" style="visibility:hidden">'%(id) |
|
tag += ob.getText() |
tag += ob.getText() |
tag += '</div></div>' |
tag += '</div></div>' |
else: |
else: |
Line 910 class MapArea(SimpleItem):
|
Line 911 class MapArea(SimpleItem):
|
TYPE_ARROW = 'arrow' |
TYPE_ARROW = 'arrow' |
TYPE_TEXT = 'text' |
TYPE_TEXT = 'text' |
|
|
def __init__(self, id, coords, label=None, type=None, tip=None, volatile=True): |
def __init__(self, id, coords, label=None, type=None, tip=None, permanent=False): |
"""init""" |
"""init""" |
self.coords = coords[0:4] |
self.coords = coords[0:4] |
if len(coords) > 4: |
if len(coords) > 4: |
Line 921 class MapArea(SimpleItem):
|
Line 922 class MapArea(SimpleItem):
|
self.label = label |
self.label = label |
self.setType(type) |
self.setType(type) |
self.tip = tip |
self.tip = tip |
self.volatile = volatile |
self.permanent = permanent |
|
|
def setCoords(self, coords): |
def setCoords(self, coords): |
"""sets the coords""" |
"""sets the coords""" |
Line 1018 class MapArea(SimpleItem):
|
Line 1019 class MapArea(SimpleItem):
|
"""sets the label""" |
"""sets the label""" |
self.label = 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): |
def getLinkId(self): |
if hasattr(self, 'aq_parent'): |
if hasattr(self, 'aq_parent'): |
return self.aq_parent.id |
return self.aq_parent.id |