eggification
[Portfolio.git] / Products / Portfolio / skins / getPhotoBrainsInfos.py
diff --git a/Products/Portfolio/skins/getPhotoBrainsInfos.py b/Products/Portfolio/skins/getPhotoBrainsInfos.py
new file mode 100755 (executable)
index 0000000..9ca0494
--- /dev/null
@@ -0,0 +1,40 @@
+##parameters=batch, searchArgs
+from ZTUtils import make_query as mq
+try : searchArgs.pop('ajax')
+except KeyError : pass
+
+infos = []
+sd = context.session_data_manager.getSessionData(create = 1)
+selDict = sd.get('objects_selection_dict', {})
+
+for index, b in enumerate(batch) :
+       uid = b.cmf_uid or None
+       absUrl = b.getURL()
+       selected = selDict.has_key(uid)
+       className=''
+       if selected :
+               className = 'selected'
+       if b.hiddenForAnonymous :
+               className = 'hidden-slide'
+
+       d = {'href'                     : absUrl
+               ,'thumbUrl'             : '%s/getThumbnail' % absUrl
+               ,'thumbSize'    : b.getThumbnailSize
+               ,'title'                : b.Title
+               ,'selected'             : selected
+               ,'cmf_uid'              : b.cmf_uid
+               ,'className'    : className
+               ,'o'                    : b
+               }
+       infos.append(d)
+
+features = {}
+def toggleSelection(b, selected) :
+       if selected :
+               return '%s/remove_to_selection' % b.getURL()
+       else :
+               return '%s/add_to_selection' % b.getURL()
+
+features['select'] = toggleSelection
+
+return {'infos':infos, 'features':features}
\ No newline at end of file