From fd547792a510c06c7c62a9f921eea9210cba7cdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Fri, 11 Apr 2014 16:50:29 +0200 Subject: [PATCH] =?utf8?q?Ce=20qu'il=20faut=20c=C3=B4t=C3=A9=20serveur=20p?= =?utf8?q?our=20l'upload=20par=20drag=20and=20drop=20sur=20la=20page=20de?= =?utf8?q?=20pr=C3=A9sentation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/portfolio_presentation_form.py | 44 +++++++++++++++------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/skins/portfolio_presentation_form.py b/skins/portfolio_presentation_form.py index ab77d5d..e84a0bc 100755 --- a/skins/portfolio_presentation_form.py +++ b/skins/portfolio_presentation_form.py @@ -1,36 +1,38 @@ ##parameters=createPresentationPage=None, savePresentation=None, deletePresentation=None, defineSample=None, deleteSample=None, ajax='' - +from Products.CMFCore.utils import getToolByName +atool = getToolByName(context, 'portal_attachment') +attachments = atool.getAttachmentsFor(context) form = context.REQUEST.form if createPresentationPage and \ - context.createPresentationPage() and \ - context.setStatus(True, 'Object created.') and \ - context.setRedirect(context, 'object/presentation', ajax=ajax): - return + context.createPresentationPage() and \ + context.setStatus(True, 'Object created.') and \ + context.setRedirect(context, 'object/presentation', ajax=ajax): + return if savePresentation and \ - context.editPresentationPage(form.get('presentation_page', '')) and \ - context.setStatus(True, 'Saved changes.') and \ - context.setRedirect(context, 'object/view', ajax=ajax) : - return + context.editPresentationPage(form.get('presentation_page', '')) and \ + context.setStatus(True, 'Saved changes.') : + attachments.removeUnusedAttachments(context.presentation_page) + return context.setRedirect(context, 'object/view', ajax=ajax) if deletePresentation and \ - context.deletePresentationPage() and \ - context.setStatus(True, 'Object deleted.') and \ - context.setRedirect(context, 'object/view', ajax=ajax) : - return + context.deletePresentationPage() and \ + context.setStatus(True, 'Object deleted.') : + attachments.removeUnusedAttachments('') + return context.setRedirect(context, 'object/view', ajax=ajax) if defineSample and \ - context.setSamplePhoto(form.get('path')) and \ - context.setStatus(True, 'Saved changes.') and \ - context.setRedirect(context, 'object/view', ajax=ajax) : - return + context.setSamplePhoto(form.get('path')) and \ + context.setStatus(True, 'Saved changes.') and \ + context.setRedirect(context, 'object/view', ajax=ajax) : + return if deleteSample and \ - context.setSamplePhoto(None) and \ - context.setStatus(True, 'Saved changes.') and \ - context.setRedirect(context, 'object/view', ajax=ajax) : - return + context.setSamplePhoto(None) and \ + context.setStatus(True, 'Saved changes.') and \ + context.setRedirect(context, 'object/view', ajax=ajax) : + return options = {} return context.portfolio_presentation_template(**options) \ No newline at end of file -- 2.20.1