Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / custom_content / newsitem_edit_form.py
diff --git a/Products/Plinn/skins/custom_content/newsitem_edit_form.py b/Products/Plinn/skins/custom_content/newsitem_edit_form.py
new file mode 100644 (file)
index 0000000..1d0a2a8
--- /dev/null
@@ -0,0 +1,33 @@
+##parameters=change='', change_and_view='', ajax=''
+##
+form = context.REQUEST.form
+description = form.get('description')
+if description and same_type(description, []) :
+       # when javascript is disabled,
+       # there's a hidden textarea from epoz
+       # and an other from <noscript> tag
+       form.update({'description' : description[1],
+                                'text' : form['text'][1]})
+if change and \
+               context.validateHTML(**form) and \
+               context.newsitem_edit_control(**form) and \
+               context.setRedirect(context, 'object/edit', **{'ajax':ajax}):
+       return
+elif change_and_view and \
+               context.validateHTML(**form) and \
+               context.newsitem_edit_control(**form) and \
+               context.setRedirect(context, 'object/view', **{'ajax':ajax}):
+       return
+
+
+options = {}
+
+buttons = []
+target = context.getActionInfo('object/edit')['url']
+buttons.append( {'name': 'change', 'value': 'Change'} )
+buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
+options['form'] = { 'action': target,
+                                       'listButtonInfos': tuple(buttons) }
+
+return context.newsitem_edit_template(**options)