From: Benoît Pin Date: Thu, 28 Aug 2014 12:21:02 +0000 (+0200) Subject: factorisation X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/commitdiff_plain/ce41148a886372e66942d71778d9e184eebc7fc0?ds=sidebyside;hp=6f4e2f7cda25365c0ca9d1597270200d049daa61 factorisation --- diff --git a/skins/lightbox_view.py b/skins/lightbox_view.py index 2463656..849f840 100755 --- a/skins/lightbox_view.py +++ b/skins/lightbox_view.py @@ -5,12 +5,6 @@ options = {} buttons = [] lightboxSelected = False -utool = getToolByName(context, 'portal_url') -portal = utool.getPortalObject() -portalDepth = len(portal.getPhysicalPath()) -uidh = getToolByName(context, 'portal_uidhandler') -pptool = getToolByName(context, 'portal_photo_print', None) -req = context.REQUEST sd = context.session_data_manager.getSessionData(create = 1) path = context.getPhysicalPath() @@ -31,44 +25,10 @@ if sessionpath == path : else : buttons.append({'name':'load', 'value': 'Load in my selection'}) -start = req.get('b_start', 0) -brains = [uidh.getBrain(uid) for uid in context.uids] -batch = Batch(brains, context.default_batch_size, start, orphan=1, quantumleap=1) -hereUrl = context.absolute_url() -cart = sd.get('cart', None) - -infos = [] -for index, b in enumerate(batch) : - path = '/'.join(b.getPath().split('/')[portalDepth:]) - p = b.getObject() - if pptool : - buyable = bool(pptool.getPrintingOptionsFor(p)) - if cart and cart.locked : - buyable = False - else : - buyable = False - - d = {'href' : '%s/lightboxcontext/%s' % (hereUrl, 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_lightbox?uid=%s' % (hereUrl, b.cmf_uid) -features['cart'] = lambda b : '%s/get_slide_buyable_items' % b.getURL() - -options['infos'] = infos -options['batch'] = batch -options['features'] = features options['buttons'] = buttons options['lightboxSelected'] = lightboxSelected options['container_type'] = 'lightbox' +options.update(context.getLightboxPhotosInfos(context)) return context.lightbox_view_template(**options)