Renommage des variables backToContextUrl et lastBcUrl qui sont automatiquement mis...
[Portfolio.git] / skins / getPhotoBrainsInfos.py
1 ##parameters=batch, searchArgs
2 from ZTUtils import make_query as mq
3 try : searchArgs.pop('ajax')
4 except KeyError : pass
5
6 infos = []
7 sd = context.session_data_manager.getSessionData(create = 1)
8 selDict = sd.get('objects_selection_dict', {})
9
10 for index, b in enumerate(batch) :
11 uid = b.cmf_uid or None
12 absUrl = b.getURL()
13 selected = selDict.has_key(uid)
14 className=''
15 if selected :
16 className = 'selected'
17 if b.hiddenForAnonymous :
18 className = 'hidden-slide'
19
20 d = {'href' : absUrl
21 ,'thumbUrl' : '%s/getThumbnail' % absUrl
22 ,'thumbSize' : b.getThumbnailSize
23 ,'title' : b.Title
24 ,'selected' : selected
25 ,'cmf_uid' : b.cmf_uid
26 ,'className' : className
27 ,'o' : b
28 }
29 infos.append(d)
30
31 features = {}
32 def toggleSelection(b, selected) :
33 if selected :
34 return '%s/remove_to_selection' % b.getURL()
35 else :
36 return '%s/add_to_selection' % b.getURL()
37
38 features['select'] = toggleSelection
39
40 return {'infos':infos, 'features':features}