Back to index

plone3  3.1.7
newsitem_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.validateHTML(**form) and \
00009         context.newsitem_edit_control(**form) and \
00010         context.setRedirect(context, 'object/edit'):
00011     return
00012 elif change_and_view and \
00013         context.validateHTML(**form) and \
00014         context.newsitem_edit_control(**form) and \
00015         context.setRedirect(context, 'object/view'):
00016     return
00017 
00018 
00019 options = {}
00020 
00021 options['title'] = context.Title()
00022 options['description'] = form.get('description', context.Description())
00023 options['text_format'] = form.get('text_format', context.text_format)
00024 options['text'] = form.get('text', context.EditableBody())
00025 
00026 buttons = []
00027 target = context.getActionInfo('object/edit')['url']
00028 buttons.append( {'name': 'change', 'value': _(u'Change')} )
00029 buttons.append( {'name': 'change_and_view', 'value': _(u'Change and View')} )
00030 options['form'] = { 'action': target,
00031                     'listButtonInfos': tuple(buttons) }
00032 
00033 return context.newsitem_edit_template(**decode(options, script))