[z3-five] menu/menuItem + action support

Andy Adiwidjaja mail at adiwidjaja.com
Mon Nov 15 16:23:54 MET 2004


LR> Andy Adiwidjaja wrote:
>> I tried to use this a while ago, too, but I ported the menu-Service
>> from the Z3-Trunk. There was a big change by Stephan Richter, which is
>> much more functional through use of Interfaces and Adapters:
>> http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/AdaptersForMenuItems

LR> OK, I'll take a look at it.

>> This is working in ucms, a bit hacky as I had to port the directives etc,
>> too.

LR> Well, this has to be done anyway, I guess, since the menu support needs
LR> to make permission checks and use the request, so the Zope3 code will
LR> not run on Zope2.

LR> I guess your code is in uscm then?

Yes it is in:

http://svn.unioncms.org/repos/ucms/uccore/trunk/core/menu.py
the (meta)configuration is flowing around in
http://svn.unioncms.org/repos/ucms/uccore/trunk/core/metadirectives.py
http://svn.unioncms.org/repos/ucms/uccore/trunk/meta.zcml
. If you're interested, we can operate it out together :-)

Sample usage is in ZCML:

<browser:menu
      id="pageactions"
      interface=".appcontrol.IPageActions"
      title="Menu for displaying local actions for the user" />

<browser:menuItem
      menu="pageactions"
      for="Products.uccore.ctypes.interfaces.ucfolder.IUCFolder"
      title="Edit"
      action="composer" />

<browser:menuItem
      menu="pageactions"
      for="Products.uccore.ctypes.interfaces.ucpage.IUCPage"
      title="Contents"
      action="contents" />

And then:

from Products.uccore.core.menu import getMenu
actionmenu = getMenu(IPageActions, obj.context, obj.request)

This is a list of dicts then but I think this is like X3.

I did not test submenus yet.


Regards

Andy



More information about the z3-five mailing list