-infos = []
-for index, b in enumerate(batch) :
- path = b.getPath().split('/')
- path.insert(portalDepth, 'selectioncontext')
- p = b.getObject()
- if pptool :
- buyable = bool(pptool.getPrintingOptionsFor(p))
- if cart and cart.locked :
- buyable = False
- else :
- buyable = False
-
- d = {'href': toUrl('/'.join(path))
- ,'thumbUrl' : '%s/getThumbnail' % b.getURL()
- ,'thumbSize' : b.getThumbnailSize
- ,'title' : ('%s - %s' % (b.Title, b.Description)).strip(' -')
- ,'cmf_uid':b.cmf_uid
- ,'className':''
- ,'buyable' : buyable
- ,'o':b
- }
- infos.append(d)
-
-features = {}
-features['del'] = lambda b : '%s/remove_to_selection' % b.getURL()
-features['cart'] = lambda b : '%s/get_slide_buyable_items' % b.getURL()
+ # get selection from session data or from selected lightbox
+ if not selectionIsLightbox :
+ selection = sd.get('objects_selection', [])
+ else :
+ try :
+ lightbox = portal.restrictedTraverse(lightboxpath)
+ selection = lightbox.getUidList()
+ except KeyError :
+ sd['lightboxpath'] = None
+ selection = sd.get('objects_selection', [])
+
+ # remove items from selection
+ rmCpt = 0
+ for uid in [int(uid) for uid in fg('uids', [])] :
+ if selDict.has_key(uid) :
+ del selDict[uid]
+ selection.remove(uid)
+ if selectionIsLightbox :
+ lightbox.remove(uid)
+ sd['objects_selection'] = selection
+ sd['objects_selection_dict'] = selDict
+ rmCpt = rmCpt + 1
+
+ # ui feedback message
+ if rmCpt :
+ if rmCpt == 1 :
+ msg = _('Photo deselected.')
+ else :
+ msg = _('Deselected photos.')
+ else :
+ msg = _('Nothing to deselect.')
+
+ if fg('ajax') :
+ req.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
+ return '<deleted>%s</deleted>' % msg
+ else :
+ context.setStatus(True, msg)