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

version 1.48, 2005/06/08 07:07:27 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 973  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.48  
changed lines
  Added in v.1.49


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