-sessionpath = sd.get('lightboxpath', None)
-if sessionpath == path :
- lightboxSelected = True
- buttons.append({'name': 'unload', 'value': 'Unload from my selection'})
-else :
- buttons.append({'name':'load', 'value': 'Load in my selection'})
+elif fg('delete.x') or form.has_key('delete') :
+ uids = fg('uids', [])
+ if not lightboxSelected :
+ for uid in [int(uid) for uid in uids] :
+ context.remove(uid)
+ else :
+ selection = sd.get('objects_selection', [])
+ selDict = sd.get('objects_selection_dict', {})
+ for uid in [int(uid) for uid in uids] :
+ context.remove(uid)
+ selection.remove(uid)
+ del selDict[uid]
+
+ sd['objects_selection'] = selection
+ sd['objects_selection_dict'] = selDict
+
+ # ui feedback message
+ if uids :
+ if len(uids) == 1 :
+ msg = _('Photo removed.')
+ else :
+ msg = _('Removed photos.')
+ else :
+ msg = _('Nothing to remove.')
+
+ if fg('ajax') :
+ context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
+ return '<deleted>%s</deleted>' % msg
+ else :
+ context.setStatus(True, msg)