Diff for /ECHO_content/ECHO_helpers.py between versions 1.46 and 1.49

version 1.46, 2005/03/22 20:50:21 version 1.49, 2005/06/08 10:23:16
Line 6  import string Line 6  import string
 import xml.dom.minidom  import xml.dom.minidom
 import types  import types
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile  from Products.PageTemplates.PageTemplateFile import PageTemplateFile
   from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
 from OFS.SimpleItem import SimpleItem  from OFS.SimpleItem import SimpleItem
 from Globals import package_home  from Globals import package_home
 import Globals  import Globals
Line 124  class ECHO_basis: Line 125  class ECHO_basis:
           
     def getLabel(self):      def getLabel(self):
     """title"""      """title"""
       if not hasattr(self,'label'):
           self.label=""
           
       if self.label=="":
           ret=self.getTitle()
           if ret=="":
               ret=self.getId()
           return ret
   
     return self.decode(self.label)      return self.decode(self.label)
     try:      try:
Line 257  class ECHO_basis: Line 266  class ECHO_basis:
     """generate img-tag for map of parent"""      """generate img-tag for map of parent"""
     return self.aq_parent.createMapImg()      return self.aq_parent.createMapImg()
   
     def createMapLink(self, ob, text=None):      def createMapLink(self, ob, text=None, target="_blank"):
     """generate map link"""      """generate map link"""
     bt = BrowserCheck(self)      bt = BrowserCheck(self)
     id = ob.getFullId()      id = ob.getFullId()
Line 270  class ECHO_basis: Line 279  class ECHO_basis:
     tag = ""      tag = ""
     if bt.isN4:      if bt.isN4:
         # N4 needs layer for highlighting          # N4 needs layer for highlighting
         tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link)          tag += '<ilayer id="a.%s"><a onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)
         tag += ">" + text + "</a></ilayer>"          tag += ">" + text + "</a></ilayer>"
     else:      else:
         # a-element          # a-element
         tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank"'%(id,id,id,link)          tag = '<a id="a.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="%s"'%(id,id,id,link,target)
         if tiptext:          if tiptext:
         tag += ' title="%s"'%tiptext          tag += ' title="%s"'%tiptext
         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"):      def createMapAux(self, ob, arrowsrc="http://nausikaa2.rz-berlin.mpg.de/digitallibrary/servlet/Scaler/?dw=15&fn=icons/pfeil",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 302  class ECHO_basis: Line 311  class ECHO_basis:
         tag += '</layer>'          tag += '</layer>'
     else:      else:
         # create a-element          # create a-element
         tag = '<a id="b.%s" onmouseover="highlightPair(\'%s\', true)" onmouseout="highlightPair(\'%s\', false)" href="%s" target="_blank">'%(id,id,id,link)          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():
         rot = ob.angle          rot = ob.angle
         if bt.isIEWin and bt.versIE > 5:          if bt.isIEWin and bt.versIE > 5:
Line 640  def findObjectPath(startobject, filename Line 649  def findObjectPath(startobject, filename
     paths = filename.split('/')      paths = filename.split('/')
     object = startobject      object = startobject
     for path in paths:      for path in paths:
           
         if hasattr(object, path):          if hasattr(object, path):
         object = getattr(object, path)          object = getattr(object, path)
     else:      else:
Line 964  class MapArea(SimpleItem): Line 974  class MapArea(SimpleItem):
 # call this to initialize framework classes, which  # call this to initialize framework classes, which
 # does the right thing with the security assertions.  # does the right thing with the security assertions.
 Globals.InitializeClass(MapArea)  Globals.InitializeClass(MapArea)
   
   
   class MapText(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')
   
       def __init__(self, id, text=None, content_type=None):
           self.id = str(id)
           self.ZBindings_edit(self._default_bindings)
           if text is None:
               text = open(self._default_content_fn).read()
           self.pt_edit(text, content_type)
   
   # Product registration and Add support
   manage_addMapTextForm = PageTemplateFile(
       'zpt/AddECHO_mapText', globals(), __name__='manage_addMapTextForm')
   
   def manage_addMapText(self, id, title=None, text=None,
                              REQUEST=None, submit=None):
       "Add a Map Text with optional file content."
   
       id = str(id)
       if REQUEST is None:
           self._setObject(id, MapText(id, text))
           ob = getattr(self, id)
           if title:
               ob.pt_setTitle(title)
           return ob
       else:
           file = REQUEST.form.get('file')
           headers = getattr(file, 'headers', None)
           if headers is None or not file.filename:
               zpt = MapText(id, text)
           else:
               zpt = MapText(id, file, headers.get('content_type'))
   
           self._setObject(id, zpt)
           if title:
               ob = getattr(self, id)
               ob.pt_setTitle(title)
   
           try:
               u = self.DestinationURL()
           except AttributeError:
               u = REQUEST['URL1']
   
           if submit == " Add and Edit ":
               u = "%s/%s" % (u, urllib.quote(id))
           REQUEST.RESPONSE.redirect(u+'/manage_main')
       return ''
   
   # call this to initialize framework classes, which
   # does the right thing with the security assertions.
   Globals.InitializeClass(MapText)

Removed from v.1.46  
changed lines
  Added in v.1.49


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