Suppression des images d'une sélection avec ajax.
[Portfolio.git] / skins / lightbox_view.py
1 ##parameters=load='',unload='',**kw
2 options = {}
3 buttons = []
4 lightboxSelected = False
5
6 sd = context.session_data_manager.getSessionData(create = 1)
7 path = context.getPhysicalPath()
8
9 if load :
10 sd.set('lightboxpath', path)
11 selection = context.getUidList()
12 sd.set('objects_selection', selection)
13 sd.set('objects_selection_dict', dict([(uid, True) for uid in selection]))
14 elif unload :
15 sd.set('lightboxpath', None)
16 sd.set('objects_selection', [])
17 sd.set('objects_selection_dict', {})
18
19 sessionpath = sd.get('lightboxpath', None)
20 if sessionpath == path :
21 lightboxSelected = True
22 buttons.append({'name': 'unload', 'value': 'Unload from my selection'})
23 else :
24 buttons.append({'name':'load', 'value': 'Load in my selection'})
25
26
27 options['buttons'] = buttons
28 options['lightboxSelected'] = lightboxSelected
29 options['container_type'] = 'lightbox'
30 options.update(context.getLightboxPhotosInfos(context))
31
32 return context.lightbox_view_template(**options)