Introduction d'un système de remise scriptable.
[Portfolio.git] / skins / portfolio_presentation_form.py
1 ##parameters=createPresentationPage=None, savePresentation=None, deletePresentation=None, defineSample=None, deleteSample=None, ajax=''
2 from Products.CMFCore.utils import getToolByName
3 atool = getToolByName(context, 'portal_attachment')
4 attachments = atool.getAttachmentsFor(context)
5 form = context.REQUEST.form
6
7 if createPresentationPage and \
8 context.createPresentationPage() and \
9 context.setStatus(True, 'Object created.') and \
10 context.setRedirect(context, 'object/presentation', ajax=ajax):
11 return
12
13 if savePresentation and \
14 context.editPresentationPage(form.get('presentation_page', '')) and \
15 context.setStatus(True, 'Saved changes.') :
16 attachments.removeUnusedAttachments(context.presentation_page)
17 return context.setRedirect(context, 'object/view', ajax=ajax)
18
19 if deletePresentation and \
20 context.deletePresentationPage() and \
21 context.setStatus(True, 'Object deleted.') :
22 attachments.removeUnusedAttachments('')
23 return context.setRedirect(context, 'object/view', ajax=ajax)
24
25 if defineSample and \
26 context.setSamplePhoto(form.get('path')) and \
27 context.setStatus(True, 'Saved changes.') and \
28 context.setRedirect(context, 'object/view', ajax=ajax) :
29 return
30
31 if deleteSample and \
32 context.setSamplePhoto(None) and \
33 context.setStatus(True, 'Saved changes.') and \
34 context.setRedirect(context, 'object/view', ajax=ajax) :
35 return
36
37 options = {}
38 return context.portfolio_presentation_template(**options)