[Zope3-Users] Using add menus

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Apr 1 21:53:07 EST 2005


On Monday 14 March 2005 12:25, Florian Lindner wrote:
> Hello,
> I've registered a addForn and addMenuItem:
>
>     <addform
>         label="Add CSLink"
>         title="Adds a CSLink"
>         name="AddCSLink.html"
>         schema="CS.Linklist.interfaces.ILink"
>         content_factory="CS.Linklist.link.Link"
>         permission="zope.Public"
>         layer="centershock"
>         menu="navMenu"
>     />
>
>     <addMenuItem
>         title="The label that'll appear in the menu"
>         view="AddCSLink.html"
>         permission="zope.Public" />
>
>
> Now I want to use the addmenu in a ZPT. I've tried
>
> tal:repeat="navItem context/@@view_get_menu/add_content"
>
> tal:repeat="navItem context/@@view_get_menu/zope.app.container.add"
>
> tal:repeat="navItem
> context/@@view_get_menu/zope.app.publisher.interfaces.browser.AddMenu"

This should give you the title from addMenuItem.

> but all returned a empty list. The view was used in a context of a standard
> folder.

Well, this is because you never tried to look up the `navMenu`? Did you 
actually create the `navMenu`?

> I'm also wondering aboutn why I can specify a menu attribute in the addform
> directive but not in the addMenuItem?

Yes, you can.

> I also don't want to have all objects that can be added to a folder but
> only certain objects. Is there any possibility to constrain this, for
> example based on the python path?

Well, folder constraints are well documented, including my book.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list