Back to index

plone3  3.1.7
folder_factories.py
Go to the documentation of this file.
00001 ##parameters=add=''
00002 ##
00003 from Products.CMFDefault.utils import decode
00004 
00005 form = context.REQUEST.form
00006 if add and \
00007         context.validateType(**form) and \
00008         context.validateId(**form) and \
00009         context.folder_add_control(**form):
00010     return
00011 
00012 
00013 options = {}
00014 
00015 items = []
00016 type_name = form.get('type_name', None)
00017 for item in context.allowedContentTypes():
00018     item_id = item.getId()
00019     items.append( { 'checked': type_name == item_id,
00020                     'description': item.Description(),
00021                     'id': item_id,
00022                     'radio': 'cb_%s' % item_id.replace(' ', '_'),
00023                     'title': item.Title() } )
00024 if len(items) == 1:
00025     items[0]['checked'] = True
00026 options['batch'] = { 'listItemInfos': tuple(items) }
00027 
00028 target = context.getActionInfo('object/new')['url']
00029 id = form.get('id', '')
00030 options['form'] = { 'action': target,
00031                     'id': id }
00032 
00033 return context.folder_factories_template(**decode(options, script))