[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZMI/Browser - IMenu.py:1.1 menu.py:1.1 configure.zcml:1.3
Jim Fulton
jim@zope.com
Fri, 20 Dec 2002 18:00:56 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI/Browser
In directory cvs.zope.org:/tmp/cvs-serv5764/lib/python/Zope/App/ZMI/Browser
Modified Files:
configure.zcml
Added Files:
IMenu.py menu.py
Log Message:
Refactored the way browser menus are made available to views.
- Added a new view, view_get_menu, for accessing menus.
From zpt, do something like:
tal:repeat="view context/@@view_get_menu/zmi_views"
- Changed existing templates to get the "zmi_views" menu this way.
- Added a new "zmi_actions" and incorporated it into the default skin.
See "view_macros.pt".
- Ripped out the no-longer-needed ZMIViews utility.
=== Added File Zope3/lib/python/Zope/App/ZMI/Browser/IMenu.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: IMenu.py,v 1.1 2002/12/20 23:00:25 jim Exp $
"""
from Interface import Interface
class IMenuAccessView(Interface):
"""View that provides access to menus
"""
def __getitem__(menu_id):
"""Get menu information
Return a sequence of dictionaries with labels and
actions, where actions are relative URLs.
"""
__doc__ = IMenuAccessView.__doc__ + __doc__
=== Added File Zope3/lib/python/Zope/App/ZMI/Browser/menu.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id: menu.py,v 1.1 2002/12/20 23:00:25 jim Exp $
"""
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.ZMI.Browser.IMenu import IMenuAccessView
from Zope.ComponentArchitecture import getService
class MenuAccessView(BrowserView):
__doc__ = IMenuAccessView.__doc__
__implements__ = BrowserView.__implements__, IMenuAccessView
def __getitem__(self, menu_id):
context = self.context
request = self.request
browser_menu_service = getService(context, 'BrowserMenu')
return browser_menu_service.getMenu(menu_id,
self.context,
self.request)
__doc__ = MenuAccessView.__doc__ + __doc__
=== Zope3/lib/python/Zope/App/ZMI/Browser/configure.zcml 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/App/ZMI/Browser/configure.zcml:1.2 Mon Oct 28 13:37:07 2002
+++ Zope3/lib/python/Zope/App/ZMI/Browser/configure.zcml Fri Dec 20 18:00:25 2002
@@ -1,15 +1,28 @@
<zopeConfigure
xmlns='http://namespaces.zope.org/zope'
xmlns:browser='http://namespaces.zope.org/browser'
->
+ >
- <browser:view name="SelectedManagementView.html"
- permission="Zope.View"
- factory=".ManagementViewSelector."
- allowed_interface="Zope.Publisher.Browser.IBrowserPublisher."
- allowed_attributes="__call__"
- />
+<!-- Make index.html the (default) default view name for everything
+ that doesn't provide its own default view.
- <include package=".ZopeTop" />
+ XXX this should eventually land in zope/app/browser/configure.zcml.
+ -->
+<browser:defaultView name="index.html" />
+
+<browser:view name="SelectedManagementView.html"
+ permission="Zope.Public"
+ factory="Zope.App.ZMI.Browser.ManagementViewSelector."
+ allowed_interface="Zope.Publisher.Browser.IBrowserPublisher."
+ allowed_attributes="__call__"
+ />
+
+<browser:view name="view_get_menu"
+ permission="Zope.Public"
+ factory="Zope.App.ZMI.Browser.menu.MenuAccessView"
+ allowed_interface="Zope.App.ZMI.Browser.IMenu.IMenuAccessView"
+ />
+
+<include package=".ZopeTop" />
</zopeConfigure>