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]})
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
})
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
) }
29 return context
.document_edit_template(**options
)