Introduction d'un système de remise scriptable.
[Portfolio.git] / skins / portfolio_edit_form.py
1 ##parameters=
2 from Products.CMFCore.utils import getUtilityByInterfaceName
3 from Products.Portfolio.utils import translate
4 _ = lambda msg : translate(msg, context)
5
6 uidh = getUtilityByInterfaceName('Products.CMFUid.interfaces.IUniqueIdHandler')
7
8 form = context.REQUEST.form
9 fg = form.get
10 if fg('ajax') :
11 context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
12
13 if fg('delete.x') or form.has_key('delete') :
14 ids = [uidh.getBrain(uid).getId for uid in fg('uids', [])]
15 if ids :
16 if len(ids) == 1 :
17 msg = _('Photo deleted.')
18 else :
19 msg = _('Deleted photos.')
20 context.manage_delObjects(ids)
21 else :
22 msg = _('Nothing to delete.')
23
24 if not fg('ajax') :
25 context.setStatus(True, msg)
26 return context.setRedirect(context, 'object/view')
27
28 else :
29 return '<deleted>%s</deleted>' % msg
30 if fg('set_sorting') :
31 context.setDefaultSorting(fg('sort_on'), False)
32 if not fg('ajax') :
33 return context.setRedirect(context, 'object/view')
34 else :
35 return '<sorted/>'
36 return '<error/>'