[Zope3-dev] Re: RFC: Zope.org - AdaptersForMenuItems

Philipp von Weitershausen philipp at weitershausen.de
Mon Jan 12 10:39:26 EST 2004


Jim,

the proposal shows that we can leverage the component architecture with 
its global and local definitions in many aspects, such as menu items. I 
like that approach, since we don't have to teach people new concepts...

I've summed up a few questions though:


1. If I understand you correctly, IMenuItemType is something like 
IContentType, but for menus items.

Thus, if we have the following menu item types::

   class IMenuItemType(Interface):
       """..."""

   class IBrowserMenuItemType(IMenuItemType):
       """..."""

your proposed browser:menu directive, e.g.::

   <browser:menu type="foobar.IFooBarMenuItem" />

would simply do::

   directlyProvides(IFoobarMenuItem, IBrowserMenuItemType)

(Correct me if I'm wrong). Why not use the general interface directive?::

   <interface
       interface="foobar.IFooBarMenuItem"
       type="...IBrowserMenuItemType"
       />


2. When the browser menu is to be displayed, we need to get a list of 
all menu items (naturally). In the case of your proposal, is there a way 
to get a list of all views/adapters from IXYZContentObject to 
IFoobarMenuItem? Maybe we would just have to extend the 
adapter/presentation service to do this, but I can imagine this being 
quite expensive...

3. Menu item ordering is indeed not covered by this, and I think it's 
quite important. I don't see how the order in which they are defined is 
captured by the adapter service or presentation, respectively. After 
all, they'd be views, right?
Maybe all menu items should provide an explicit 'order' attribute by 
which they are ordered. It should be easy to assign 
automatically-generated numbers to this 'order' attribute by default 
upon each instanciation. It should be settable through ZCML then, though.
OTOH, Sidnei had this idea about menu ordering adapters (IIRC) which 
sounded cool (although a bit like yagni as well). Maybe he can give some 
tips in that respect.

4. It'd be cool if you could use the standard schema field fields such 
as title and description instead of __doc__. This way, it'd be very easy 
to turn those schemas into web forms for local menus.

Philipp





More information about the Zope3-dev mailing list