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