X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/011a53d5681ad1f5fa88a534ec041c93d3e7be95..306427e14c2c27ce070e789bdbc039e6d95a3fdc:/skins/portfolio_edit_form.py diff --git a/skins/portfolio_edit_form.py b/skins/portfolio_edit_form.py index e1f61da..cb9e93b 100644 --- a/skins/portfolio_edit_form.py +++ b/skins/portfolio_edit_form.py @@ -1,10 +1,30 @@ -##parameters=upload_zip='', zipfile='', ajax='' +##parameters= +from Products.CMFCore.utils import getUtilityByInterfaceName +from Products.Portfolio.utils import translate +_ = lambda msg : translate(msg, context) -if upload_zip and zipfile : - context.importZipFile(zipfile) - context.setStatus("Zip file imported and decompressed.") - context.setRedirect(context, 'object/view', ajax=ajax) - return +uidh = getUtilityByInterfaceName('Products.CMFUid.interfaces.IUniqueIdHandler') -options = {} -return context.portfolio_edit_template(**options) +form = context.REQUEST.form +fg = form.get +if fg('ajax') : + context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8') + +if fg('delete.x') or form.has_key('delete') : + ids = [uidh.getBrain(uid).getId for uid in fg('uids', [])] + if ids : + if len(ids) == 1 : + msg = _('Photo deleted.') + else : + msg = _('Deleted photos.') + context.manage_delObjects(ids) + else : + msg = _('Nothing to delete.') + + if not fg('ajax') : + context.setStatus(True, msg) + return context.setRedirect(context, 'object/view') + + else : + return '%s' % msg +return '' \ No newline at end of file