Okay everything works as it should now....

This patch allows you to store the Zope management interfaces inside the
ZODB. It does this by making the manage stuff inheritable and giving the
defaults to the root of the folder (This means that the management can't
be changed for the root folder - which in my opinion is a good thing.)

To override the manage_page_header, all you need to do is create a DTML
Method (other method types should work as well but haven't been tested)
with the id manage_page_header. This will replace manage_page_header for
ALL object below the folder the method was created in. 

This means that you can lock your self out of the management screens
(say by putting <!-- in the manage_page_header). To get around this you
can use the special "SUPPRESS_CUST_MANAGE" object. This object must be
inserted AFTER the object that has the offending manage stuff but before
the actual manage. For example;

 /Folder_with_cust_manage/SUPPRESS_CUST_MANAGE/manage_main
and
 /Folder_with_cust_manage/SUPPRESS_CUST_MANAGE/Normal_Folder/manage_main
and
 /Folder_with_cust_manage/Normal_Folder/SUPPRESS_CUST_MANAGE/manage_main

would work but

 /Folder_with_cust_manage/manage_main/SUPPRESS_CUST_MANAGE
or
 /SUPPRESS_CUST_MANAGE/Folder_with_cust_manage/manage_main
or 
 /Folder_with_cust_manage/Normal_Folder/manage_main/SUPPRESS_CUST_MANAGE

wouldn't.

I've tested this patch and are yet to find any problems with it.

This in theory should allow "template" folders to apply templates to any
object below themselves (through the normal standard_html_header/footer)
and to the object's management screens (through the
manage_page_header/footer). Without modification of any of the zope
source. 

It allows  you to quickly provide a different look for the management
screens on a per site bases (when you are virtual hosting). This could
be invaluable if some company wants to "BADGE" the management screens of
their zope site.

NOTE: This patch doesn't currently let you override 'manage'

Would it be possible for somebody to review this patch for me and tell
me if there are any inherent problems with the way i have done this?

This is an actual patch and is relatively small so i've attached it to
the bottom of this email, hope this is okay....

Mithro

PS: I can't seem to update the collector Item with this new patch?

Tim R Ansell wrote:
<snip>
diff -w -b -B -c -r -d --exclude=Products --exclude=sedscript --exclude=var 
--exclude=pcgi --exclude=*.c --exclude=*.pyc --exclude=*.zexp --exclude=*.xml 
--exclude=*.so --exclude=Extensions --exclude=Zope.cgi --exclude=core --exclude=fcgi 
--exclude=*.bak --exclude=#*# --exclude=Makefile* --exclude=z2.py --exclude=*~ 
--exclude=start --exclude=stop --exclude=Setup --exclude=*.old 
./download/Zope-2.3.2-src/lib/python/App/Management.py 
./zope/lib/python/App/Management.py
*** ./download/Zope-2.3.2-src/lib/python/App/Management.py      Wed Jan 17 09:26:53 
2001
--- ./zope/lib/python/App/Management.py Wed Jul 11 21:47:07 2001
***************
*** 94,107 ****
  from Globals import DTMLFile, HTMLFile
  from string import split, join, find
  from AccessControl import getSecurityManager
  
  class Tabs(ExtensionClass.Base):
      """Mix-in provides management folder tab support."""
  
-     manage_tabs__roles__=('Anonymous',)
-     manage_tabs=DTMLFile('dtml/manage_tabs', globals())
-     
- 
      manage_options  =()
  
      filtered_manage_options__roles__=None
--- 94,104 ----
  from Globals import DTMLFile, HTMLFile
  from string import split, join, find
  from AccessControl import getSecurityManager
+ import Acquisition
  
  class Tabs(ExtensionClass.Base):
      """Mix-in provides management folder tab support."""
  
      manage_options  =()
  
      filtered_manage_options__roles__=None
***************
*** 135,141 ****
  
          return result
                      
-             
      manage_workspace__roles__=('Anonymous',)
      def manage_workspace(self, REQUEST):
          """Dispatch to first interface in manage_options
--- 132,137 ----
***************
*** 193,202 ****
          out.append(last)
          return join(out, '/')
  
! Globals.default__class_init__(Tabs)
! 
  
  class Navigation(ExtensionClass.Base):
      """Basic navigation UI support"""
  
      __ac_permissions__=(
--- 189,203 ----
          out.append(last)
          return join(out, '/')
  
! class RealTabs(ExtensionClass.Base):
!     manage_options = ()
!     manage_tabs__roles__=('Anonymous',)
!     manage_tabs=HTMLFile('dtml/manage_tabs', globals())
  
  class Navigation(ExtensionClass.Base):
+     manage = DTMLFile('dtml/manage', globals())
+ 
+ class RealNavigation(Navigation, ExtensionClass.Base):
      """Basic navigation UI support"""
  
      __ac_permissions__=(
***************
*** 207,218 ****
            )),
          )
  
!     manage            =DTMLFile('dtml/manage', globals())
!     manage_menu       =DTMLFile('dtml/menu', globals())
  
!     manage_top_frame  =DTMLFile('dtml/manage_top_frame', globals())
!     manage_page_header=DTMLFile('dtml/manage_page_header', globals())
!     manage_page_footer=DTMLFile('dtml/manage_page_footer', globals())
  
      manage_form_title =DTMLFile('dtml/manage_form_title', globals(),
                                  form_title='Add Form',
--- 208,219 ----
            )),
          )
  
!     manage            =HTMLFile('dtml/manage', globals())
!     manage_menu       =HTMLFile('dtml/menu', globals())
  
!     manage_top_frame  =HTMLFile('dtml/manage_top_frame', globals())
!     manage_page_header=HTMLFile('dtml/manage_page_header', globals())
!     manage_page_footer=HTMLFile('dtml/manage_page_footer', globals())
  
      manage_form_title =DTMLFile('dtml/manage_form_title', globals(),
                                  form_title='Add Form',
***************
*** 253,259 ****
      manage_zmi_prefs__roles__ = None
  
  file = DTMLFile('dtml/manage_page_style.css', globals())
! setattr(Navigation, 'manage_page_style.css', file)
! setattr(Navigation, 'manage_page_style.css__roles__', None)
  
  Globals.default__class_init__(Navigation)
--- 254,270 ----
      manage_zmi_prefs__roles__ = None
  
  file = DTMLFile('dtml/manage_page_style.css', globals())
! setattr(RealNavigation, 'manage_page_style.css', file)
! setattr(RealNavigation, 'manage_page_style.css__roles__', None)
  
+ class Override(Acquisition.Implicit, RealNavigation, RealTabs):
+       def __bobo_traverse__(self, request, key):
+               self._v_bit = getattr(self, key, None)
+               return self._v_bit
+             
+ setattr(Tabs, 'SUPPRESS_CUST_MANAGE', Override())
+ setattr(Navigation, 'SUPPRESS_CUST_MANAGE', Override())
+ 
+ Globals.default__class_init__(Tabs)
  Globals.default__class_init__(Navigation)
+ 
diff -w -b -B -c -r -d --exclude=Products --exclude=sedscript --exclude=var 
--exclude=pcgi --exclude=*.c --exclude=*.pyc --exclude=*.zexp --exclude=*.xml 
--exclude=*.so --exclude=Extensions --exclude=Zope.cgi --exclude=core --exclude=fcgi 
--exclude=*.bak --exclude=#*# --exclude=Makefile* --exclude=z2.py --exclude=*~ 
--exclude=start --exclude=stop --exclude=Setup --exclude=*.old 
./download/Zope-2.3.2-src/lib/python/OFS/Application.py 
./zope/lib/python/OFS/Application.py
*** ./download/Zope-2.3.2-src/lib/python/OFS/Application.py     Sun Apr  8 02:03:51 
2001
--- ./zope/lib/python/OFS/Application.py        Mon Jul  9 01:20:39 2001
***************
*** 100,105 ****
--- 100,106 ----
  from cStringIO import StringIO
  from AccessControl.PermissionRole import PermissionRole
  from App.ProductContext import ProductContext
+ from App.Management import RealNavigation, RealTabs
  from misc_ import Misc_
  import ZDOM
  from zLOG import LOG, ERROR, WARNING, INFO
***************
*** 157,163 ****
  
  class Application(Globals.ApplicationDefaultPermissions,
                    ZDOM.Root, Folder.Folder,
!                   App.ProductRegistry.ProductRegistry, FindSupport):
      """Top-level system object"""
      title    ='Zope'
      #__roles__=['Manager', 'Anonymous']
--- 158,164 ----
  
  class Application(Globals.ApplicationDefaultPermissions,
                    ZDOM.Root, Folder.Folder,
!                   App.ProductRegistry.ProductRegistry, FindSupport, RealNavigation, 
RealTabs):
      """Top-level system object"""
      title    ='Zope'
      #__roles__=['Manager', 'Anonymous']

Reply via email to