[z3-checkins] r14512 - z3/Five/trunk/browser

philikon at codespeak.net philikon at codespeak.net
Mon Jul 11 20:40:53 CEST 2005


Author: philikon
Date: Mon Jul 11 20:40:51 2005
New Revision: 14512

Added:
   z3/Five/trunk/browser/menu.py   (contents, props changed)
Modified:
   z3/Five/trunk/browser/configure.zcml
Log:
configure the browser menu service... I'm surprised (read: shocked) it wasn't
configured before; even more so the globalbrowsermenuservice instance is
used directly in CMFonFive... oh well, it won't matter anymore soon


Modified: z3/Five/trunk/browser/configure.zcml
==============================================================================
--- z3/Five/trunk/browser/configure.zcml	(original)
+++ z3/Five/trunk/browser/configure.zcml	Mon Jul 11 20:40:51 2005
@@ -1,6 +1,17 @@
 <configure xmlns="http://namespaces.zope.org/zope"
            xmlns:browser="http://namespaces.zope.org/browser">
 
+  <serviceType
+      id="BrowserMenu"
+      interface="zope.app.publisher.interfaces.browser.IBrowserMenuService"
+      />
+
+  <service
+      serviceType="BrowserMenu"
+      permission="zope.Public"
+      component="zope.app.publisher.browser.globalbrowsermenuservice.globalBrowserMenuService"
+      />
+
   <browser:defaultView name="index.html" />
 
   <browser:page
@@ -53,4 +64,13 @@
       provides="zope.app.container.interfaces.INameChooser"
       />
 
+  <!-- Menu access -->
+  <browser:page
+      for="*"
+      name="view_get_menu"
+      permission="zope.Public"
+      class=".menu.MenuAccessView"
+      allowed_interface="zope.app.publisher.interfaces.browser.IMenuAccessView"
+      />
+
 </configure>

Added: z3/Five/trunk/browser/menu.py
==============================================================================
--- (empty file)
+++ z3/Five/trunk/browser/menu.py	Mon Jul 11 20:40:51 2005
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Some menu code
+
+$Id$
+"""
+from zope.interface import implements
+from zope.app import zapi
+from zope.app.publisher.interfaces.browser import IMenuAccessView
+from zope.app.servicenames import BrowserMenu
+from Products.Five import BrowserView
+
+class MenuAccessView(BrowserView):
+    implements(IMenuAccessView)
+
+    def __getitem__(self, menu_id):
+        browser_menu_service = zapi.getService(BrowserMenu)
+        return browser_menu_service.getMenu(menu_id, self.context, self.request)


More information about the z3-checkins mailing list