diff --git a/src/pfwbged/collection/locales/fr/LC_MESSAGES/pfwbged.collection.po b/src/pfwbged/collection/locales/fr/LC_MESSAGES/pfwbged.collection.po index c92c9ad..9290136 100644 --- a/src/pfwbged/collection/locales/fr/LC_MESSAGES/pfwbged.collection.po +++ b/src/pfwbged/collection/locales/fr/LC_MESSAGES/pfwbged.collection.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: pfwbged.collection\n" -"POT-Creation-Date: 2014-06-10 13:26+0000\n" +"POT-Creation-Date: 2019-03-04 08:45+0000\n" "PO-Revision-Date: 2014-04-28 09:24+0200\n" "Last-Translator: Frederic Peters \n" "Language-Team: French\n" @@ -14,15 +14,15 @@ msgstr "" "Preferred-Encodings: utf-8 latin1\n" "Domain: pfwbged.collection\n" -#: ../portlet.py:167 +#: ../portlet.py:170 msgid "Add Collection Portlet" msgstr "Ajouter un portlet de collection" -#: ../searchview.py:324 +#: ../searchview.py:372 msgid "Creation Date" msgstr "Date de création" -#: ../portlet.py:180 +#: ../portlet.py:183 msgid "Edit Collection Portlet" msgstr "Modifier le portlet de collection" @@ -30,7 +30,7 @@ msgstr "Modifier le portlet de collection" msgid "Find the collection which provides the items to list" msgstr "Chercher la collection qui fournit les éléments à énumérer; un élément de son titre par exemple." -#: ../searchview.py:175 +#: ../searchview.py:180 msgid "Internal Number" msgstr "Référence interne" @@ -38,19 +38,23 @@ msgstr "Référence interne" msgid "Limit" msgstr "Limite" +#: ../configure.zcml:29 +msgid "PFWB Collection" +msgstr "" + #: ../portlet.py:33 msgid "Portlet header" msgstr "Titre" -#: ../searchview.py:344 +#: ../searchview.py:392 msgid "Position" msgstr "Position" -#: ../searchview.py:179 +#: ../searchview.py:184 msgid "Recipient(s)" msgstr "Destinataire(s)" -#: ../searchview.py:68 +#: ../searchview.py:70 #: ../templates/collection.pt:29 msgid "Save" msgstr "Enregistrer" @@ -59,7 +63,7 @@ msgstr "Enregistrer" msgid "Search Parameters" msgstr "Paramètres de la recherche" -#: ../searchview.py:177 +#: ../searchview.py:182 msgid "Sender" msgstr "Expéditeur" @@ -71,12 +75,12 @@ msgstr "Spécifier le nombre maximum d'éléments à afficher dans ce portlet. L msgid "Target collection" msgstr "Collection à utiliser" -#: ../portlet.py:168 +#: ../portlet.py:171 msgid "This portlet displays a listing of items from a Collection." msgstr "Ce portlet affiche les éléments d'une collection." #: ../collection.py:50 -#: ../searchview.py:58 +#: ../searchview.py:60 msgid "Title" msgstr "Titre" @@ -84,7 +88,10 @@ msgstr "Titre" msgid "Title of the rendered portlet" msgstr "Titre du portlet" -#: ../searchview.py:360 +#: ../searchview.py:408 msgid "Unfile" msgstr "Retirer du dossier" +#: ../multiactions.py:27 +msgid "You don't have the right to change the state of these objects:" +msgstr "Vous ne disposez pas des droits pour changer l'état de ces éléments:" diff --git a/src/pfwbged/collection/locales/pfwbged.collection.pot b/src/pfwbged/collection/locales/pfwbged.collection.pot new file mode 100644 index 0000000..d40e215 --- /dev/null +++ b/src/pfwbged/collection/locales/pfwbged.collection.pot @@ -0,0 +1,100 @@ +# --- PLEASE EDIT THE LINES BELOW CORRECTLY --- +# SOME DESCRIPTIVE TITLE. +# FIRST AUTHOR , YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2019-03-04 08:45+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0\n" +"Language-Code: en\n" +"Language-Name: English\n" +"Preferred-Encodings: utf-8 latin1\n" +"Domain: pfwbged.collection\n" + +#: ../portlet.py:170 +msgid "Add Collection Portlet" +msgstr "" + +#: ../searchview.py:372 +msgid "Creation Date" +msgstr "" + +#: ../portlet.py:183 +msgid "Edit Collection Portlet" +msgstr "" + +#: ../portlet.py:39 +msgid "Find the collection which provides the items to list" +msgstr "" + +#: ../searchview.py:180 +msgid "Internal Number" +msgstr "" + +#: ../portlet.py:46 +msgid "Limit" +msgstr "" + +#: ../configure.zcml:29 +msgid "PFWB Collection" +msgstr "" + +#: ../portlet.py:33 +msgid "Portlet header" +msgstr "" + +#: ../searchview.py:392 +msgid "Position" +msgstr "" + +#: ../searchview.py:184 +msgid "Recipient(s)" +msgstr "" + +#: ../searchview.py:70 +#: ../templates/collection.pt:29 +msgid "Save" +msgstr "" + +#: ../templates/search_view.pt:13 +msgid "Search Parameters" +msgstr "" + +#: ../searchview.py:182 +msgid "Sender" +msgstr "" + +#: ../portlet.py:47 +msgid "Specify the maximum number of items to show in the portlet. Leave this blank to show the default numer of items." +msgstr "" + +#: ../portlet.py:38 +msgid "Target collection" +msgstr "" + +#: ../portlet.py:171 +msgid "This portlet displays a listing of items from a Collection." +msgstr "" + +#: ../collection.py:50 +#: ../searchview.py:60 +msgid "Title" +msgstr "" + +#: ../portlet.py:34 +msgid "Title of the rendered portlet" +msgstr "" + +#: ../searchview.py:408 +msgid "Unfile" +msgstr "" + +#: ../multiactions.py:27 +msgid "You don't have the right to change the state of these objects:" +msgstr "" diff --git a/src/pfwbged/collection/multiactions.py b/src/pfwbged/collection/multiactions.py index 5057f96..9cb9d11 100644 --- a/src/pfwbged/collection/multiactions.py +++ b/src/pfwbged/collection/multiactions.py @@ -1,5 +1,9 @@ from Products.Five.browser import BrowserView +from pfwbged.collection import _ from plone import api +from plone.api.exc import InvalidParameterError +from zope.i18n import translate + class MultiActionsView(BrowserView): def __call__(self): @@ -7,12 +11,27 @@ class MultiActionsView(BrowserView): documents = self.request.form['documents[]'] if isinstance(documents, basestring): documents = [documents] + failures = [] for document_id in documents: document = api.content.get(document_id) - api.content.transition(document, action) - document.reindexObject(idxs=['review_state']) - if action == 'to_process' and document.portal_type == 'dmsincomingmail': - from pfwbged.policy.subscribers.mail import incoming_mail_attributed - incoming_mail_attributed(document, u'') - - return 'OK' + try: + api.content.transition(document, action) + except InvalidParameterError: + failures.append(document) + else: + document.reindexObject(idxs=['review_state']) + if action == 'to_process' and document.portal_type == 'dmsincomingmail': + from pfwbged.policy.subscribers.mail import incoming_mail_attributed + incoming_mail_attributed(document, u'') + if failures: + self.request.response.setStatus(403) + header = translate( + _(u'You don\'t have the right to change the state of these objects:'), + context=self.request + ) + return u'{}\n{}'.format( + header, + u'\n'.join(['- {}'.format(failure.Title()) for failure in failures]), + ) + else: + return 'OK' diff --git a/src/pfwbged/collection/pfwbcollection.js b/src/pfwbged/collection/pfwbcollection.js index 6613f79..3ff09ed 100644 --- a/src/pfwbged/collection/pfwbcollection.js +++ b/src/pfwbged/collection/pfwbcollection.js @@ -337,10 +337,11 @@ $.post(url, {'action': action, 'documents': documents } ).done(function() { console.log('success'); - $.querywidget.updateSearch(true); - }).fail(function() { + }).fail(function(data) { console.log('fail'); + alert(data.responseText); }).always(function() { + $.querywidget.updateSearch(true); $div.find('button').prop('disabled', false); }); }