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

Jim Fulton jim at zope.com
Mon Jan 12 08:54:48 EST 2004


Philipp von Weitershausen wrote:
> 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...

Yup.

> 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"
>       />

We could.

> 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...

Actually, I am planning a small change to the implementation that will
make this inexpensive.

> 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?

Right. I anticipate providing an order attribute, much as was done for
fields.

> 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.

Yes, exactly.

 > 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.

The main thing I like about Sidnei's proposal is it's simplicity.
I would like a way to specify the order independently from the
item definition, but anything I think of feels very complicated.

Really, I'd rather not mix up menu item ordering with this proposal.
We will keep the ordering we have now, for better or worse.  When we
come up with a good way to control ordering, we'll implement it,
but we're having a lot of trouble doing that and I don't want to
hold up this work.

We'll use an order variable as you suggest and we'll allow this to be
overridden with zcml. Note, however, that interface specificity will
take precedense over order. That is, items will be sorted first by
specificity and then by order.

> 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.

Sorry, you lost me on this one.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org





More information about the Zope3-dev mailing list