[Zope3-Users] Different menu items for different views for the same
context
Baiju M
mbaiju at zeomega.com
Wed Aug 6 14:22:18 EDT 2008
Hi all,
I am trying to create a navigation menu where menu items should
change based on views. To do this first I created a
viewletManager like this::
<browser:viewletManager
name="page_navigation_menu"
provides=".viewlet.IPageNavigationMenu"
class=".viewlet.PageNavigationMenu"
layer="myapp.skinning.layer.IMyappBrowserLayer"
permission="myapp.View"
/>
And I defined viewletManager like this::
from zope.viewlet.manager import WeightOrderedViewletManager
from zope.interface import implements
from zope.viewlet.interfaces import IViewletManager
class IPageNavigationMenu(IViewletManager):
"""Page Navigation Menu Viewlet Manager."""
class PageNavigationMenu(WeightOrderedViewletManager):
implements(IPageNavigationMenu)
Also I have this in my page layout::
<div id="pagenavigation"
tal:content="structure provider:page_navigation_menu">
Page Navigation Menu
</div>
This is an example viewlet::
<browser:viewlet
name="Add User"
viewURL="@@add_user"
for="myapp.main.interfaces.IMyapp"
manager="myapp.skinning.viewlet.IPageNavigationMenu"
class="z3c.menu.simple.menu.ContextMenuItem"
permission="myapp.View"
layer="myapp.skinning.layer.IMyappBrowserLayer"
weight="2"
/>
I do not want this viewlet appear when I open some views
registerd for `myapp.main.interfaces.IMyapp`. How can I do that
? Can I use "layer" feature in some way to solve this ?
or anything I missed here ?
Regards,
Baiju M
More information about the Zope3-users
mailing list