[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Publisher/Browser - GlobalBrowserMenuService.py:1.5 IBrowserMenuService.py:1.2
Jim Fulton
jim@zope.com
Tue, 1 Oct 2002 08:49:40 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Publisher/Browser
In directory cvs.zope.org:/tmp/cvs-serv18475/lib/python/Zope/App/Publisher/Browser
Modified Files:
GlobalBrowserMenuService.py IBrowserMenuService.py
Log Message:
Added a new view, 'SelectedManagementView', that redirects to the first
view that a user can access. Changed between-object navigation urls,
like those in breadcrumbs and the contents management view, to use
this view. This corresponds to Zope 2's 'manage_workspace' method.
Changes the name of the folder contents management view to
'contents.html'. Added a new 'index.html' view as the default view for
folders. If the folder contains an object named 'index.html', then the
view redirects to that object. Otherwise, the view displays a folder
listing with linds to folder items.
Changed the view order for a number of content types so that
management views come before the default view. This means you can now
traverse to a file or page template from a contents listing and get an
editing view.
=== Zope3/lib/python/Zope/App/Publisher/Browser/GlobalBrowserMenuService.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/App/Publisher/Browser/GlobalBrowserMenuService.py:1.4 Thu Aug 1 11:33:44 2002
+++ Zope3/lib/python/Zope/App/Publisher/Browser/GlobalBrowserMenuService.py Tue Oct 1 08:49:08 2002
@@ -53,7 +53,7 @@
data.append((action, title, description, filter))
registry.register(interface, data)
- def getMenu(self, menu_id, object, request):
+ def getMenu(self, menu_id, object, request, max=999999):
registry = self._registry[menu_id]
traverser = PublicationTraverser()
@@ -90,8 +90,17 @@
'description': description,
'action': "%s" % action,
})
+
+ if len(result) >= max:
+ return result
return result
+
+ def getFirstMenuItem(self, menu_id, object, request):
+ r = self.getMenu(menu_id, object, request, max=1)
+ if r:
+ return r[0]
+ return None
def menuDirective(_context, id, title, description=''):
return [Action(
=== Zope3/lib/python/Zope/App/Publisher/Browser/IBrowserMenuService.py 1.1 => 1.2 ===
--- Zope3/lib/python/Zope/App/Publisher/Browser/IBrowserMenuService.py:1.1 Tue Jun 18 15:34:57 2002
+++ Zope3/lib/python/Zope/App/Publisher/Browser/IBrowserMenuService.py Tue Oct 1 08:49:08 2002
@@ -35,4 +35,21 @@
"""
+ def getFirstMenuItem(menu_id, object, request):
+ """Get the first browser menu item for an object and request
+
+ Return a mapping object with keys:
+
+ title -- The menu item title
+
+ description -- The item title
+
+ action -- A (possibly relative to object) URL for the menu item.
+
+ The entry returned is accessable to the current user and
+ has passed any menu item filters, if any.
+
+ If no entry can be found, None is returned.
+ """
+