From: Benoît Pin Date: Fri, 29 Aug 2014 12:02:08 +0000 (+0200) Subject: Suppression des photos d'une table lumineuse par ajax. X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/commitdiff_plain/362525bf290b43724237432ce8480f5dbd7049b8?ds=inline;hp=--cc Suppression des photos d'une table lumineuse par ajax. --- 362525bf290b43724237432ce8480f5dbd7049b8 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 7097597..400e2cc 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 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 +
-
+