[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - globalbrowsermenuservice.py:1.17
Richard Jones
richard@commonground.com.au
Wed, 9 Jul 2003 21:35:47 -0400
Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv2714
Modified Files:
globalbrowsermenuservice.py
Log Message:
Modified getMenu to correctly identify current view.
=== Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py:1.16 Thu Jun 12 05:34:15 2003
+++ Zope3/src/zope/app/publisher/browser/globalbrowsermenuservice.py Wed Jul 9 21:35:12 2003
@@ -94,6 +94,9 @@
seen = {}
sm = getSecurityManager()
+ # stuff for figuring out the selected view
+ request_url = request.getURL()
+
for items in registry.getAllForObject(object):
for action, title, description, filter, permission in items:
@@ -139,7 +142,15 @@
except (Unauthorized, Forbidden):
continue # Skip unauthorized or forbidden
- if request.getURL().endswith(action):
+ normalized_action = action
+ if action.startswith('@@'):
+ normalized_action = action[2:]
+
+ if request_url.endswith(action):
+ selected='selected'
+ elif request_url.endswith('/'+normalized_action):
+ selected='selected'
+ elif request_url.endswith('++view++'+normalized_action):
selected='selected'
else:
selected=''