X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/393723570b65dbabd8d845d498d080c3f75272b3..362525bf290b43724237432ce8480f5dbd7049b8:/skins/getSelectionPhotosInfos.py diff --git a/skins/getSelectionPhotosInfos.py b/skins/getSelectionPhotosInfos.py index 80c52f9..20e6d61 100644 --- a/skins/getSelectionPhotosInfos.py +++ b/skins/getSelectionPhotosInfos.py @@ -1,8 +1,6 @@ ##parameters=pho_start=None, batch_size=None from Products.CMFCore.utils import getToolByName from Products.Plinn.PloneMisc import Batch -from Products.Portfolio.utils import translate -def _(message) : return translate(message, context).encode('utf-8') uidh = getToolByName(context, 'portal_uidhandler') utool = getToolByName(context, 'portal_url') @@ -17,47 +15,48 @@ toUrl = req.physicalPathToURL lightboxpath = req.SESSION.get('lightboxpath', None) selectionIsLightbox = False if lightboxpath is None : - selection = req.SESSION.get('objects_selection', []) + selection = req.SESSION.get('objects_selection', []) else : - try : - lightbox = portal.restrictedTraverse(lightboxpath) - selection = lightbox.getUidList() - selectionIsLightbox = True - except: - req.SESSION.set('lightboxpath', None) - selection = req.SESSION.get('objects_selection', []) + try : + lightbox = portal.restrictedTraverse(lightboxpath) + selection = lightbox.getUidList() + selectionIsLightbox = True + except: + req.SESSION.set('lightboxpath', None) + selection = req.SESSION.get('objects_selection', []) -start = pho_start if pho_start is not None else 0 brains = [uidh.getBrain(uid) for uid in selection] +start = pho_start if pho_start is not None else 0 +batch_size = batch_size if batch_size is not None else context.default_batch_size batch = Batch(brains, batch_size, start, quantumleap=1) cart = req.SESSION.get('cart', None) infos = [] for index, b in enumerate(batch) : - path = b.getPath().split('/') - path.insert(portalDepth, 'selectioncontext') - p = b.getObject() - if pptool : - buyable = bool(pptool.getPrintingOptionsFor(p)) - if cart and cart.locked : - buyable = False - else : - buyable = False - - d = {'href': toUrl('/'.join(path)) - ,'thumbUrl' : '%s/getThumbnail' % b.getURL() - ,'thumbSize' : b.getThumbnailSize - ,'title' : ('%s - %s' % (b.Title, b.Description)).strip(' -') - ,'cmf_uid':b.cmf_uid - ,'className':'' - ,'buyable' : buyable - ,'o':b - } - infos.append(d) + path = b.getPath().split('/') + path.insert(portalDepth, 'selectioncontext') + p = b.getObject() + if pptool : + buyable = bool(pptool.getPrintingOptionsFor(p)) + if cart and cart.locked : + buyable = False + else : + buyable = False + + d = {'href': toUrl('/'.join(path)) + ,'thumbUrl' : '%s/getThumbnail' % b.getURL() + ,'thumbSize' : b.getThumbnailSize + ,'title' : ('%s - %s' % (b.Title, b.Description)).strip(' -') + ,'cmf_uid':b.cmf_uid + ,'className':'' + ,'buyable' : buyable + ,'o':b + } + infos.append(d) features = {} -features['del'] = lambda b : '%s/remove_to_selection' % b.getURL() +features['checkbox'] = True features['cart'] = lambda b : '%s/get_slide_buyable_items' % b.getURL() return {'infos' : infos,