Diff for /ECHO_content/ECHO_helpers.py between versions 1.51 and 1.54

version 1.51, 2005/06/09 11:12:59 version 1.54, 2005/06/09 21:57:30
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.new', '')
         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 299  class ECHO_basis: Line 302  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",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"""      """generate map link image, text and other stuff"""
     bt = BrowserCheck(self)      bt = BrowserCheck(self)
     id = ob.getFullId()      id = ob.getFullId()
Line 308  class ECHO_basis: Line 311  class ECHO_basis:
     tag = ""      tag = ""
   
     if bt.isN4:      if bt.isN4:
           #
         # N4 needs layer and img elements          # N4 needs layer and img elements
           #
         tag += '<layer id="i.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)">'%(id,id,id)          tag += '<layer id="i.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)">'%(id,id,id)
         if ob.isTypeArrow():          if ob.isTypeArrow():
           # N4 - Arrow
             rot = ob.angle              rot = ob.angle
         tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,arrowsrc,rot)          marksrc = arrowsrc
           if float(rot) < 0:
               marksrc = circlesrc
           tag += '<a href="%s"><img border="0" src="%s&rot=%s" /></a>'%(link,marksrc,rot)
         else:          else:
           # N4 - Area
         tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link)          tag += '<a href="%s"><img border="0" width="1000" height="1000" src="trans_img"'%(link)
         if tiptext:          if tiptext:
             tag += ' alt="%s"'%tiptext              tag += ' alt="%s"'%tiptext
         tag += ' /></a>'          tag += ' /></a>'
         tag += '</layer>'          tag += '</layer>'
     else:      else:
         # create a-element          #
           # (more or less) DOM capable browser
           #
         tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s">'%(id,id,id,link,target)          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():
           # DOM - Arrow
         rot = ob.angle          rot = ob.angle
           marksrc = arrowsrc
           if float(rot) < 0:
               marksrc = circlesrc
         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,arrowsrc,rot,arrowsrc,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)
         else:          else:
             # arrow image              # arrow image
             tag += '<img id="i.%s" src="%s&rot=%s" border="1" style="position:absolute; top:-100px; left:-100px; border-style:none;" />'%(id,arrowsrc,rot)              tag += '<img id="i.%s" src="%s&rot=%s" border="1" style="position:absolute; top:-100px; left:-100px; border-style:none;" />'%(id,marksrc,rot)
         elif ob.isTypeText():          elif ob.isTypeText():
             # div for area          # 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:
           # DOM - Area
         if bt.isIE:          if bt.isIE:
             # IE needs transparent img for area              # IE needs transparent img for area
             tag += '<img id="i.%s" border="0" style="position:absolute; top:-100px; left:-100px;" src="trans_img"'%(id)              tag += '<img id="i.%s" border="0" style="position:absolute; top:-100px; left:-100px;" src="trans_img"'%(id)
Line 895  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 906  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 1003  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

Removed from v.1.51  
changed lines
  Added in v.1.54


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>