Déplacement de 'copyPrototype' growable_table.js -> javascript_events_api.js.
[Plinn.git] / skins / custom_content / newsitem_edit_form.py
1 ##parameters=change='', change_and_view='', ajax=''
2 ##
3 form = context.REQUEST.form
4 description = form.get('description')
5 if description and same_type(description, []) :
6 # when javascript is disabled,
7 # there's a hidden textarea from epoz
8 # and an other from <noscript> tag
9 form.update({'description' : description[1],
10 'text' : form['text'][1]})
11
12 if change and \
13 context.validateHTML(**form) and \
14 context.newsitem_edit_control(**form) and \
15 context.setRedirect(context, 'object/edit', **{'ajax':ajax}):
16 return
17 elif change_and_view and \
18 context.validateHTML(**form) and \
19 context.newsitem_edit_control(**form) and \
20 context.setRedirect(context, 'object/view', **{'ajax':ajax}):
21 return
22
23
24 options = {}
25
26 buttons = []
27 target = context.getActionInfo('object/edit')['url']
28 buttons.append( {'name': 'change', 'value': 'Change'} )
29 buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
30 options['form'] = { 'action': target,
31 'listButtonInfos': tuple(buttons) }
32
33 return context.newsitem_edit_template(**options)