-##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 '<deleted>%s</deleted>' % msg
+if fg('set_sorting') :
+ context.setDefaultSorting(fg('sorting'), False)
+ if not fg('ajax') :
+ return context.setRedirect(context, 'object/view')
+ else :
+ return '<done/>'
+return '<error/>'
\ No newline at end of file