X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/2da869b2b46179d64c05eaac4081226fdbbbc9ff..e73353500c67453ef9663d67eaeee7dd46c358ee:/Products/Portfolio/skins/getPhotoBrainsInfos.py?ds=sidebyside diff --git a/Products/Portfolio/skins/getPhotoBrainsInfos.py b/Products/Portfolio/skins/getPhotoBrainsInfos.py new file mode 100755 index 0000000..9ca0494 --- /dev/null +++ b/Products/Portfolio/skins/getPhotoBrainsInfos.py @@ -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