[Zope-CMF] [dev] more add menu changes

Charlie Clark charlie at begeistert.org
Thu Sep 11 10:22:50 EDT 2008

Am 07.08.2008 um 12:26 schrieb yuppie:

> Proposal 2: main_template
> -------------------------
> CMFDefault menus are implemented in main_template. I propose to add  
> a new section for 'folder/add' actions.

Hi yuppie,

finally had a bit of time to look at this. First of all thank you very  
much for your work on this. It's a great pity your not here at the  
DZUG conference to discuss.

I have an extremely basic implementation of this for the CMF:

from Products.CMFCore.utils import getToolByName

tt = getToolByName(context, 'portal_types')
ti = tt.getTypeInfo(context)

poss_types = ti.allowed_content_types

add_forms = []

for t in poss_types:
     # get type info for child
     nti = tt.getTypeInfo(t)
     if nti.add_view_expr != '':
         url = nti.add_view_expr_object
         add_forms.append({'title':nti.title, 'url':url(context)})

return add_forms

I can't think of any other way to do this other than to call this  
expression before returning it to the template. But it's more than  
possible I've overlooked something.

Charlie Clark
Helmholtzstr. 20
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226

More information about the Zope-CMF mailing list