X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/blobdiff_plain/eb82d8f9e1a13678be84f554f73595b6c7902591..e3e5d18a6b6dfaeb26dc0c2ee99acf2da0e003f8:/skins/getPhotosInfos.py diff --git a/skins/getPhotosInfos.py b/skins/getPhotosInfos.py index 985528e..3a55dcc 100755 --- a/skins/getPhotosInfos.py +++ b/skins/getPhotosInfos.py @@ -1,4 +1,4 @@ -##parameters=portfolio +##parameters=portfolio, pho_start=None, batch_size=None from Products.Plinn.PloneMisc import Batch from Products.CMFCore.utils import getToolByName from Products.CMFCore.permissions import ReviewPortalContent, ModifyPortalContent @@ -9,12 +9,12 @@ uidtool = getToolByName(context, 'portal_uidhandler') features = {} def toggleSelection(o, selected) : if selected : - return '%s/remove_to_selection' % o.absolute_url() + return '%s/remove_to_selection' % o.getURL() else : - return '%s/add_to_selection' % o.absolute_url() + return '%s/add_to_selection' % o.getURL() features['select'] = toggleSelection -features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.absolute_url() +features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.getURL() if mtool.checkPermission(ReviewPortalContent, context) : features['hideAnonymous'] = True @@ -22,13 +22,14 @@ if mtool.checkPermission(ModifyPortalContent, context) : features['checkbox'] = True req = context.REQUEST -pho_start = req.get('pho_start', 0) +pho_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 sort_on, sort_order = context.getDefaultSorting() contentFilter = {'portal_type' : ['Photo'], 'sort_on' : sort_on, 'sort_order' : sort_order} batch = Batch(portfolio.listCatalogedContents(contentFilter=contentFilter), - context.default_batch_size, pho_start, orphan=5, quantumleap=1, b_start_str='pho_start') + batch_size, pho_start, quantumleap=1, b_start_str='pho_start') infos = [] @@ -45,7 +46,7 @@ for p in batch : selected = selDict.has_key(uid) hiddenForAnonymous = p.hiddenForAnonymous if pptool : - buyable = bool(pptool.getPrintingOptionsFor(p)) + buyable = bool(pptool.getPrintingOptionsFor(p.getObject())) if cart and cart.locked : buyable = False else : @@ -69,4 +70,9 @@ for p in batch : } infos.append(d) -return {'infos':infos, 'batch':batch, 'features':features} +return {'infos':infos, + 'batch':batch, + 'features':features, + 'sorting' : {'sort_on' : sort_on, + 'sort_order' : sort_order} + }