From: Benoît Pin Date: Wed, 9 Jul 2014 05:48:46 +0000 (+0200) Subject: IHM pour définir le tri par défaut. Fonctionne sans js (pour l'instant). X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/commitdiff_plain/eb82d8f9e1a13678be84f554f73595b6c7902591 IHM pour définir le tri par défaut. Fonctionne sans js (pour l'instant). --- diff --git a/locales/en/LC_MESSAGES/portfolio.po b/locales/en/LC_MESSAGES/portfolio.po index 1109c6f..c36a5b2 100644 --- a/locales/en/LC_MESSAGES/portfolio.po +++ b/locales/en/LC_MESSAGES/portfolio.po @@ -123,7 +123,7 @@ msgstr "" msgid "refresh amount" msgstr "" -#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:71 +#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:81 msgid "delete" msgstr "" @@ -252,15 +252,15 @@ msgstr "" msgid "download picture" msgstr "" -#: o/skins/portfolio_edit_form.py:13 +#: o/skins/portfolio_edit_form.py:17 msgid "Photo deleted." msgstr "" -#: o/skins/portfolio_edit_form.py:15 +#: o/skins/portfolio_edit_form.py:19 msgid "Deleted photos." msgstr "" -#: o/skins/portfolio_edit_form.py:18 +#: o/skins/portfolio_edit_form.py:22 msgid "Nothing to delete." msgstr "" @@ -268,6 +268,22 @@ msgstr "" msgid "Delete presentation" msgstr "" +#: o/skins/portfolio_view.pt:74 +msgid "sorting:" +msgstr "" + +#: o/skins/portfolio_view.pt:76 +msgid "manual" +msgstr "" + +#: o/skins/portfolio_view.pt:77 +msgid "shooting" +msgstr "" + +#: o/skins/portfolio_view.pt:78 +msgid "modification" +msgstr "" + #: o/skins/save_as_lightbox_template.pt:12 msgid "Save current selection as lightbox" msgstr "" diff --git a/locales/fr/LC_MESSAGES/portfolio.mo b/locales/fr/LC_MESSAGES/portfolio.mo index eca4edf..7af8c86 100644 Binary files a/locales/fr/LC_MESSAGES/portfolio.mo and b/locales/fr/LC_MESSAGES/portfolio.mo differ diff --git a/locales/fr/LC_MESSAGES/portfolio.po b/locales/fr/LC_MESSAGES/portfolio.po index 64cda42..210399f 100644 --- a/locales/fr/LC_MESSAGES/portfolio.po +++ b/locales/fr/LC_MESSAGES/portfolio.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Plinn 2.0\n" -"POT-Creation-Date: Sat Jul 5 14:18:53 2014\n" -"PO-Revision-Date: 2014-07-05 14:19+0200\n" +"POT-Creation-Date: Tue Jul 8 18:30:13 2014\n" +"PO-Revision-Date: 2014-07-08 18:31+0200\n" "Last-Translator: Benoît PIN\n" "Language-Team: CRI http://cri.ensmp.fr\n" "Language: \n" @@ -148,7 +148,7 @@ msgstr "Prix (TTC)" msgid "refresh amount" msgstr "actualiser le montant" -#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:71 +#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:81 msgid "delete" msgstr "supprimer" @@ -279,15 +279,15 @@ msgstr "référence :" msgid "download picture" msgstr "télécharger l'image" -#: o/skins/portfolio_edit_form.py:13 +#: o/skins/portfolio_edit_form.py:17 msgid "Photo deleted." msgstr "Photo supprimée." -#: o/skins/portfolio_edit_form.py:15 +#: o/skins/portfolio_edit_form.py:19 msgid "Deleted photos." msgstr "Photos supprimées." -#: o/skins/portfolio_edit_form.py:18 +#: o/skins/portfolio_edit_form.py:22 msgid "Nothing to delete." msgstr "Rien à supprimer." @@ -295,6 +295,22 @@ msgstr "Rien à supprimer." msgid "Delete presentation" msgstr "Supprimer la présentation" +#: o/skins/portfolio_view.pt:74 +msgid "sorting:" +msgstr "tri :" + +#: o/skins/portfolio_view.pt:76 +msgid "manual" +msgstr "manuel" + +#: o/skins/portfolio_view.pt:77 +msgid "shooting" +msgstr "prise de vue" + +#: o/skins/portfolio_view.pt:78 +msgid "modification" +msgstr "modification" + #: o/skins/save_as_lightbox_template.pt:12 msgid "Save current selection as lightbox" msgstr "Enregistrer la sélection dans une table lumineuse" diff --git a/locales/portfolio.pot b/locales/portfolio.pot index 5213937..f89ad7e 100644 --- a/locales/portfolio.pot +++ b/locales/portfolio.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: 3.0\n" -"POT-Creation-Date: Sat Jul 5 14:18:53 2014\n" +"POT-Creation-Date: Tue Jul 8 18:30:13 2014\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" @@ -160,8 +160,8 @@ msgstr "" #: o/skins/my_cart_template.pt:59 #: o/skins/my_cart_template.pt:59 -#: o/skins/portfolio_view.pt:71 -#: o/skins/portfolio_view.pt:71 +#: o/skins/portfolio_view.pt:81 +#: o/skins/portfolio_view.pt:81 msgid "delete" msgstr "" @@ -304,15 +304,15 @@ msgstr "" msgid "download picture" msgstr "" -#: o/skins/portfolio_edit_form.py:13 +#: o/skins/portfolio_edit_form.py:17 msgid "Photo deleted." msgstr "" -#: o/skins/portfolio_edit_form.py:15 +#: o/skins/portfolio_edit_form.py:19 msgid "Deleted photos." msgstr "" -#: o/skins/portfolio_edit_form.py:18 +#: o/skins/portfolio_edit_form.py:22 msgid "Nothing to delete." msgstr "" @@ -320,6 +320,22 @@ msgstr "" msgid "Delete presentation" msgstr "" +#: o/skins/portfolio_view.pt:74 +msgid "sorting:" +msgstr "" + +#: o/skins/portfolio_view.pt:76 +msgid "manual" +msgstr "" + +#: o/skins/portfolio_view.pt:77 +msgid "shooting" +msgstr "" + +#: o/skins/portfolio_view.pt:78 +msgid "modification" +msgstr "" + #: o/skins/save_as_lightbox_template.pt:12 msgid "Save current selection as lightbox" msgstr "" diff --git a/skins/getPhotosInfos.py b/skins/getPhotosInfos.py index 2d42635..985528e 100755 --- a/skins/getPhotosInfos.py +++ b/skins/getPhotosInfos.py @@ -8,11 +8,11 @@ uidtool = getToolByName(context, 'portal_uidhandler') features = {} def toggleSelection(o, selected) : - if selected : - return '%s/remove_to_selection' % o.absolute_url() - else : - return '%s/add_to_selection' % o.absolute_url() - + if selected : + return '%s/remove_to_selection' % o.absolute_url() + else : + return '%s/add_to_selection' % o.absolute_url() + features['select'] = toggleSelection features['cart'] = lambda o : '%s/get_slide_buyable_items' % o.absolute_url() @@ -23,8 +23,12 @@ if mtool.checkPermission(ModifyPortalContent, context) : req = context.REQUEST pho_start = req.get('pho_start', 0) -batch = Batch(portfolio.listNearestFolderContents(contentFilter={'portal_type' : ['Photo']}, sorted=True), - context.default_batch_size, pho_start, orphan=5, quantumleap=1, b_start_str='pho_start') +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') infos = [] @@ -33,36 +37,36 @@ selDict = sd.get('objects_selection_dict', {}) cart = sd.get('cart', None) for p in batch : - className = '' - uid = getattr(p, 'cmf_uid', None) - if uid is not None : - uid = uid() - absUrl = p.absolute_url() - selected = selDict.has_key(uid) - hiddenForAnonymous = p.hiddenForAnonymous() - if pptool : - buyable = bool(pptool.getPrintingOptionsFor(p)) - if cart and cart.locked : - buyable = False - else : - buyable = False - - if selected : - className = 'selected' - if hiddenForAnonymous : - className = 'hidden-slide' - - d = {'href' : absUrl - ,'thumbUrl' : '%s/getThumbnail' % absUrl - ,'thumbSize': p.getThumbnailSize() - ,'title' : ('%s - %s' % (p.Title(), p.Description())).strip(' -') - ,'selected' : selected - ,'hiddenForAnonymous' : hiddenForAnonymous - ,'cmf_uid' : uidtool.register(p) - ,'buyable' : buyable - ,'className': className - ,'o' : p - } - infos.append(d) + className = '' + uid = getattr(p, 'cmf_uid', None) + # if uid is not None : + # uid = uid() + absUrl = p.getURL() + selected = selDict.has_key(uid) + hiddenForAnonymous = p.hiddenForAnonymous + if pptool : + buyable = bool(pptool.getPrintingOptionsFor(p)) + if cart and cart.locked : + buyable = False + else : + buyable = False + + if selected : + className = 'selected' + if hiddenForAnonymous : + className = 'hidden-slide' + + d = {'href' : absUrl + ,'thumbUrl' : '%s/getThumbnail' % absUrl + ,'thumbSize': p.getThumbnailSize + ,'title' : ('%s - %s' % (p.Title, p.Description)).strip(' -') + ,'selected' : selected + ,'hiddenForAnonymous' : hiddenForAnonymous + ,'cmf_uid' : uidtool.register(p) + ,'buyable' : buyable + ,'className': className + ,'o' : p + } + infos.append(d) return {'infos':infos, 'batch':batch, 'features':features} diff --git a/skins/portfolio_edit_form.py b/skins/portfolio_edit_form.py index cb9e93b..ad661d2 100644 --- a/skins/portfolio_edit_form.py +++ b/skins/portfolio_edit_form.py @@ -27,4 +27,10 @@ if fg('delete.x') or form.has_key('delete') : else : return '%s' % msg +if fg('set_sorting') : + context.setDefaultSorting(fg('sorting'), False) + if not fg('ajax') : + return context.setRedirect(context, 'object/view') + else : + return '' return '' \ No newline at end of file diff --git a/skins/portfolio_view.pt b/skins/portfolio_view.pt index a168fca..14bd91c 100644 --- a/skins/portfolio_view.pt +++ b/skins/portfolio_view.pt @@ -71,12 +71,15 @@ tal:define="ModifyPortalContent modules/Products/CMFCore/permissions/ModifyPortalContent" tal:condition="python:mtool.checkPermission(ModifyPortalContent, here)"> - sort: - +