X-Git-Url: https://svn.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/011a53d5681ad1f5fa88a534ec041c93d3e7be95..dc502e53f9f6081d3c2bc4e9991feffcd60c15e1:/skins/portfolio_edit_form.py diff --git a/skins/portfolio_edit_form.py b/skins/portfolio_edit_form.py index e1f61da..da34aa4 100644 --- a/skins/portfolio_edit_form.py +++ b/skins/portfolio_edit_form.py @@ -1,10 +1,36 @@ -##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 +if fg('set_sorting') : + context.setDefaultSorting(fg('sort_on'), False) + if not fg('ajax') : + return context.setRedirect(context, 'object/view') + else : + return '' +return '' \ No newline at end of file