Back to index

plone3  3.1.7
file_edit_form.py
Go to the documentation of this file.
00001 ##parameters=change='', change_and_view=''
00002 ##
00003 from Products.CMFDefault.utils import decode
00004 from Products.CMFDefault.utils import Message as _
00005 
00006 form = context.REQUEST.form
00007 if change and \
00008         context.file_edit_control(**form) and \
00009         context.setRedirect(context, 'object/edit'):
00010     return
00011 elif change_and_view and \
00012         context.file_edit_control(**form) and \
00013         context.setRedirect(context, 'object/view'):
00014     return
00015 
00016 
00017 options = {}
00018 
00019 options['title'] = context.Title()
00020 options['description'] = context.Description()
00021 options['format'] = context.Format()
00022 
00023 buttons = []
00024 target = context.getActionInfo('object/edit')['url']
00025 buttons.append( {'name': 'change', 'value': _(u'Change')} )
00026 buttons.append( {'name': 'change_and_view', 'value': _(u'Change and View')} )
00027 options['form'] = { 'action': target,
00028                     'listButtonInfos': tuple(buttons) }
00029 
00030 return context.file_edit_template(**decode(options, script))