From 362525bf290b43724237432ce8480f5dbd7049b8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Fri, 29 Aug 2014 14:02:08 +0200 Subject: [PATCH] Suppression des photos d'une table lumineuse par ajax. --- locales/en/LC_MESSAGES/portfolio.po | 24 ++++++++--- locales/fr/LC_MESSAGES/portfolio.mo | Bin 7238 -> 7387 bytes locales/fr/LC_MESSAGES/portfolio.po | 28 +++++++++---- locales/portfolio.pot | 36 +++++++++++------ skins/getLightboxPhotosInfos.py | 2 +- skins/lightbox_view.py | 59 +++++++++++++++++++++++----- skins/lightbox_view_template.pt | 25 ++++++++---- 7 files changed, 130 insertions(+), 44 deletions(-) diff --git a/locales/en/LC_MESSAGES/portfolio.po b/locales/en/LC_MESSAGES/portfolio.po index 31709aa..09f46f3 100644 --- a/locales/en/LC_MESSAGES/portfolio.po +++ b/locales/en/LC_MESSAGES/portfolio.po @@ -74,12 +74,29 @@ msgstr "" msgid "Lightbox created." msgstr "" +#: o/skins/lightbox_view.py:53 +msgid "Photo removed." +msgstr "" + +#: o/skins/lightbox_view.py:55 +msgid "Removed photos." +msgstr "" + +#: o/skins/lightbox_view.py:57 +msgid "Nothing to remove." +msgstr "" + #. Default: "" #: o/skins/lightbox_view_template.pt:19 msgid "lightbox_selected_explanations" msgstr "" -#: o/skins/lightbox_view_template.pt:22 o/skins/selection_view_template.pt:20 +#: o/skins/lightbox_view_template.pt:24 o/skins/my_cart_template.pt:59 +#: o/skins/portfolio_view.pt:88 o/skins/selection_view_template.pt:31 +msgid "delete" +msgstr "" + +#: o/skins/lightbox_view_template.pt:31 o/skins/selection_view_template.pt:20 msgid "${DYNAMIC_CONTENT}" msgstr "" @@ -123,11 +140,6 @@ msgstr "" msgid "refresh amount" msgstr "" -#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:88 -#: o/skins/selection_view_template.pt:31 -msgid "delete" -msgstr "" - #: o/skins/my_cart_template.pt:69 msgid "Prints" msgstr "" diff --git a/locales/fr/LC_MESSAGES/portfolio.mo b/locales/fr/LC_MESSAGES/portfolio.mo index 7097597a37bf078223fd33eb1440b297ac840da9..400e2cc169966841099ff3430814d5cd92fb9e51 100644 GIT binary patch delta 2448 zcmXxldrZ}39LMqR5r~6uxL+hRjs{3e5al95Cq)D+Z-C`3i!2TTf*?|>wRO}kthqJU znM~*A+^{X$S}Xo3jaE^(sHU?~TWs==lP&tgjchsF>is$A;kWZWujhGwzu$BDKF@)P z>gn~No9VG}A%VH&=S**J)acmY%KBTU9C7>|>v=Wn?7 zTbN0G9@VvXv01EH$Wo#O%fuvZXQO6Z?Aim!TKO_0iM9e)Uup4|TSJs0^IM0z8vU{+0U6G{~<}15BVg{v9>J8RT5rKd27>#fQ+#ESBL)ROT8` znRo-0`XP7!2Yj6RENWs!tWy22P9^_Zc?Atxc`aY+cpEBphf()WB3ZU~Q7;Z5NwD*% z4o6U#`V5tcFOfOgRd@ea*FNLwf1tK@KI9ti<8=?6v%wp5L#RxA;O>v17VO=B+3q9)+Uio74PcnVrkI;!JGQ7LUiw##;+25Lp6 zyvyBx6>F)VaE>|ep$=Om`=<=Gpau@2CKkd*JdO4G{r^TmsmLQ=8n_sh>NTi|)uSeI z05!pG*FK1R>>^(p@N>+^DO`-18?lwxMd&(2yg+OqDv75FozHEAcIgRX;o>+{*)!Bu z5zC1V;t@gz_enzAzK`f40>r{q5`N8_?|CtN&YRcVOk=0J(T+M2>xg_pzqDtGa$*so z?QSA;JryPL-#F;X;^1gpf;T2@NAEyK=aEDHfnI-qu&4KxU^p>pcyUMXLVa{3DczIO z61mmp@6(NArK6X9g)#BvHI9|?PMvPSP`*L%_;&Bvn8jgJKBHLxTh_J8U*>y!Wh delta 2304 zcmX}sX>3$g7{>8;oI-DfnQ05Qg|>EzWlOBKbY^IaEP||}ltCy`s4PWFC4>MmE@>uV zi5mS-G77OxAT&WSrizXxL<}(qCV-j(A7n`(ge577fCgMXVEjMRGo19D-?``BdzSZ{ z+e>vn)g~_I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a($SViJ)l z^OK)>WxiLEC%xi@FVgs`yRim6B1-5hdx}^}=tFpf(00E-sOSu;M2OYtn)^vbb3A{t yVd(y^0|8&EG+5!!uBwkj>Z@YOIe8UX)T60Qd7(kcj)I?48wwZuQs;`itp5RQ;==_1 diff --git a/locales/fr/LC_MESSAGES/portfolio.po b/locales/fr/LC_MESSAGES/portfolio.po index dc2a367..00a754f 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: Fri Aug 29 10:44:06 2014\n" -"PO-Revision-Date: 2014-08-29 10:45+0200\n" +"POT-Creation-Date: Fri Aug 29 13:55:35 2014\n" +"PO-Revision-Date: 2014-08-29 13:56+0200\n" "Last-Translator: Benoît PIN\n" "Language-Team: CRI http://cri.ensmp.fr\n" "Language: \n" @@ -97,6 +97,18 @@ msgstr "Vous devez entrer un titre." msgid "Lightbox created." msgstr "Table lumineuse créée." +#: o/skins/lightbox_view.py:53 +msgid "Photo removed." +msgstr "Photo retirée." + +#: o/skins/lightbox_view.py:55 +msgid "Removed photos." +msgstr "Photos retirées." + +#: o/skins/lightbox_view.py:57 +msgid "Nothing to remove." +msgstr "Rien à retirer." + #. Default: "" #: o/skins/lightbox_view_template.pt:19 msgid "lightbox_selected_explanations" @@ -104,7 +116,12 @@ msgstr "" "Cette table lumineuse est sélectionnée : les images que vous sélectionnerez " "à présent seront automatiquement sauvegardées à cet endroit." -#: o/skins/lightbox_view_template.pt:22 o/skins/selection_view_template.pt:20 +#: o/skins/lightbox_view_template.pt:24 o/skins/my_cart_template.pt:59 +#: o/skins/portfolio_view.pt:88 o/skins/selection_view_template.pt:31 +msgid "delete" +msgstr "supprimer" + +#: o/skins/lightbox_view_template.pt:31 o/skins/selection_view_template.pt:20 msgid "${DYNAMIC_CONTENT}" msgstr "" @@ -148,11 +165,6 @@ msgstr "Prix (TTC)" msgid "refresh amount" msgstr "actualiser le montant" -#: o/skins/my_cart_template.pt:59 o/skins/portfolio_view.pt:88 -#: o/skins/selection_view_template.pt:31 -msgid "delete" -msgstr "supprimer" - #: o/skins/my_cart_template.pt:69 msgid "Prints" msgstr "Tirages" diff --git a/locales/portfolio.pot b/locales/portfolio.pot index 6d8a06a..fd5694f 100644 --- a/locales/portfolio.pot +++ b/locales/portfolio.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: 3.0\n" -"POT-Creation-Date: Fri Aug 29 10:44:06 2014\n" +"POT-Creation-Date: Fri Aug 29 13:55:35 2014\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" @@ -106,12 +106,35 @@ msgstr "" msgid "Lightbox created." msgstr "" +#: o/skins/lightbox_view.py:53 +msgid "Photo removed." +msgstr "" + +#: o/skins/lightbox_view.py:55 +msgid "Removed photos." +msgstr "" + +#: o/skins/lightbox_view.py:57 +msgid "Nothing to remove." +msgstr "" + #: o/skins/lightbox_view_template.pt:19 #. Default: "" msgid "lightbox_selected_explanations" msgstr "" -#: o/skins/lightbox_view_template.pt:22 +#: o/skins/lightbox_view_template.pt:24 +#: o/skins/lightbox_view_template.pt:24 +#: o/skins/my_cart_template.pt:59 +#: o/skins/my_cart_template.pt:59 +#: o/skins/portfolio_view.pt:88 +#: o/skins/portfolio_view.pt:88 +#: o/skins/selection_view_template.pt:31 +#: o/skins/selection_view_template.pt:31 +msgid "delete" +msgstr "" + +#: o/skins/lightbox_view_template.pt:31 #: o/skins/selection_view_template.pt:20 msgid "${DYNAMIC_CONTENT}" msgstr "" @@ -158,15 +181,6 @@ msgstr "" msgid "refresh amount" msgstr "" -#: o/skins/my_cart_template.pt:59 -#: o/skins/my_cart_template.pt:59 -#: o/skins/portfolio_view.pt:88 -#: o/skins/portfolio_view.pt:88 -#: o/skins/selection_view_template.pt:31 -#: o/skins/selection_view_template.pt:31 -msgid "delete" -msgstr "" - #: o/skins/my_cart_template.pt:69 msgid "Prints" msgstr "" diff --git a/skins/getLightboxPhotosInfos.py b/skins/getLightboxPhotosInfos.py index f5afc8c..626ebd1 100644 --- a/skins/getLightboxPhotosInfos.py +++ b/skins/getLightboxPhotosInfos.py @@ -42,7 +42,7 @@ for index, b in enumerate(batch) : infos.append(d) features = {} -features['del'] = lambda b: '%s/remove_to_lightbox?uid=%s' % (lightboxUrl, b.cmf_uid) +features['checkbox'] = True features['cart'] = lambda b : '%s/get_slide_buyable_items' % b.getURL() return {'infos' : infos, diff --git a/skins/lightbox_view.py b/skins/lightbox_view.py index 7fb12dc..1a06cef 100755 --- a/skins/lightbox_view.py +++ b/skins/lightbox_view.py @@ -1,27 +1,66 @@ -##parameters=load='',unload='',**kw +##parameters= +from Products.Portfolio.utils import translate +_ = lambda msg : translate(msg, context) options = {} buttons = [] -lightboxSelected = False sd = context.session_data_manager.getSessionData(create = 1) path = context.getPhysicalPath() +req = context.REQUEST +form = req.form +fg = form.get + +# check if lighbox is selected +sessionpath = sd.get('lightboxpath', None) +lightboxSelected = False +if sessionpath == path : + lightboxSelected = True + buttons.append({'name': 'unload', 'value': 'Unload from my selection'}) +else : + buttons.append({'name':'load', 'value': 'Load in my selection'}) -if load : +# form processing +if fg('load') : sd.set('lightboxpath', path) selection = context.getUidList() sd.set('objects_selection', selection) sd.set('objects_selection_dict', dict([(uid, True) for uid in selection])) -elif unload : + +elif fg('unload') : sd.set('lightboxpath', None) sd.set('objects_selection', []) sd.set('objects_selection_dict', {}) -sessionpath = sd.get('lightboxpath', None) -if sessionpath == path : - lightboxSelected = True - buttons.append({'name': 'unload', 'value': 'Unload from my selection'}) -else : - buttons.append({'name':'load', 'value': 'Load in my selection'}) +elif fg('delete.x') or form.has_key('delete') : + uids = fg('uids', []) + if not lightboxSelected : + for uid in [int(uid) for uid in uids] : + context.remove(uid) + else : + selection = sd.get('objects_selection', []) + selDict = sd.get('objects_selection_dict', {}) + for uid in [int(uid) for uid in uids] : + context.remove(uid) + selection.remove(uid) + del selDict[uid] + + sd['objects_selection'] = selection + sd['objects_selection_dict'] = selDict + + # ui feedback message + if uids : + if len(uids) == 1 : + msg = _('Photo removed.') + else : + msg = _('Removed photos.') + else : + msg = _('Nothing to remove.') + + if fg('ajax') : + context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8') + return '%s' % msg + else : + context.setStatus(True, msg) options['buttons'] = buttons diff --git a/skins/lightbox_view_template.pt b/skins/lightbox_view_template.pt index 3e73cca..5200891 100644 --- a/skins/lightbox_view_template.pt +++ b/skins/lightbox_view_template.pt @@ -18,18 +18,27 @@
+ -
-
-
- affichage grille +
+
+ affichage grille +
-
+
-- 2.20.1