Retrait du nettoyage automatique de html : encore une lubie de geek…
[Plinn.git] / skins / custom_content / document_edit_form.py
1 ##parameters=change='', change_and_view='', ajax=''
2 from Products.CMFCore.utils import getToolByName
3 atool = getToolByName(context, 'portal_attachment')
4 attachments = atool.getAttachmentsFor(context)
5
6 form = context.REQUEST.form
7 text = form.get('text')
8 if text and same_type(text, []) :
9 # when javascript is disabled,
10 # there's a hidden textarea from epoz
11 # and an other from <noscript> tag
12 form.update({'text' : text[1]})
13
14 if change_and_view and \
15 context.document_edit_control(text=form.get('text'), text_format='html') :
16 attachments.removeUnusedAttachments(context.EditableBody())
17 return context.setRedirect(context, 'object/view', **{'ajax':ajax})
18
19
20 options = {}
21
22 buttons = []
23 target = context.getActionInfo('object/edit')['url']
24 buttons.append( {'name': 'change', 'value': 'Change'} )
25 buttons.append( {'name': 'change_and_view', 'value': 'Change and View'} )
26 options['form'] = { 'action': target,
27 'listButtonInfos': tuple(buttons) }
28
29 return context.document_edit_template(**options)