d439bd726b0757b534e7aa4943e61b98c76cca11
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
)
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]})
15 context
.validateTextFile(**form
) and \
16 context
.validateHTML(**form
) and \
17 context
.document_edit_control(text
=form
.get('text'), text_format
='html') and \
18 context
.setRedirect(context
, 'object/edit', **{'ajax':ajax
}):
20 elif change_and_view
and \
21 context
.validateTextFile(**form
) and \
22 context
.validateHTML(**form
) and \
23 context
.document_edit_control(text
=form
.get('text'), text_format
='html') and \
24 context
.setRedirect(context
, 'object/view', **{'ajax':ajax
}):
31 target
= context
.getActionInfo('object/edit')['url']
32 buttons
.append( {'name': 'change', 'value': 'Change'} )
33 buttons
.append( {'name': 'change_and_view', 'value': 'Change and View'} )
34 options
['form'] = { 'action': target
,
35 'listButtonInfos': tuple(buttons
) }
37 return context
.document_edit_template(**options
)