From: Benoît Pin Date: Sun, 22 Feb 2015 00:20:21 +0000 (+0100) Subject: Utilisation du workflow directement dans le listing des dossiers. X-Git-Url: https://svn.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/aeb758b645034bb95fe967aca66aa014f5bce97b?ds=sidebyside;hp=945390ba1662e902513c9a4abf5c0d8366666d8b Utilisation du workflow directement dans le listing des dossiers. --- diff --git a/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo b/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo index fa2a7df..c776485 100644 Binary files a/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo and b/Products/Plinn/locales/en/LC_MESSAGES/plinn.mo differ diff --git a/Products/Plinn/locales/en/LC_MESSAGES/plinn.po b/Products/Plinn/locales/en/LC_MESSAGES/plinn.po index 18ef7b0..999c12a 100644 --- a/Products/Plinn/locales/en/LC_MESSAGES/plinn.po +++ b/Products/Plinn/locales/en/LC_MESSAGES/plinn.po @@ -14,8 +14,8 @@ msgid "" msgstr "" "Project-Id-Version: 2.0 beta 1\n" -"POT-Creation-Date: Mon Dec 15 15:35:05 2014\n" -"PO-Revision-Date: 2014-12-15 15:41+0100\n" +"POT-Creation-Date: Sat Feb 21 01:11:05 2015\n" +"PO-Revision-Date: 2015-02-21 00:35+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" "Language: \n" @@ -218,7 +218,7 @@ msgid " Change and View " msgstr " Change and View " #: n/skins/content/folder_factories.pt:18 -#: n/skins/custom_generic/folder_contents.py:103 +#: n/skins/custom_generic/folder_contents.py:104 #: n/skins/custom_generic/personalize_form.pt:27 #: n/skins/generic/gruf_macros.pt:256 n/skins/generic/gruf_macros.pt:378 #: n/skins/generic/last_member_logs.pt:23 @@ -525,16 +525,20 @@ msgstr "%d item moved to top.%d items moved to top." msgid "%d item moved up.%d items moved up." msgstr "%d item moved up.%d items moved up." -#: n/skins/custom_generic/folder_contents.py:99 +#: n/skins/custom_generic/folder_contents.py:100 #: n/skins/photo_theme/search_results_macros.pt:14 msgid "Type" msgstr "Type" -#: n/skins/custom_generic/folder_contents.py:107 +#: n/skins/custom_generic/folder_contents.py:108 msgid "Last Modified" msgstr "Last Modified" -#: n/skins/custom_generic/folder_contents.py:117 +#: n/skins/custom_generic/folder_contents.py:112 +msgid "State" +msgstr "State" + +#: n/skins/custom_generic/folder_contents.py:122 msgid "Set Sorting as Default" msgstr "Set Sorting as Default" @@ -1199,30 +1203,6 @@ msgstr "Next" msgid "byline" msgstr "modified on ${date} at ${time} – creator: ${creator}" -#: n/skins/generic/content_depublish_form.pt:8 -msgid "Depublish: \"${docTitle}\"" -msgstr "Depublish: \"${docTitle}\"" - -#: n/skins/generic/content_depublish_form.pt:10 -msgid "depublish_transition_explanations" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:15 -msgid "Select the destination state" -msgstr "Select the destination state" - -#: n/skins/generic/content_depublish_form.pt:18 -msgid "Private" -msgstr "Private" - -#: n/skins/generic/content_depublish_form.pt:22 -msgid "Shared" -msgstr "Shared" - -#: n/skins/generic/content_depublish_form.pt:26 -msgid "Depublish" -msgstr "Depublish" - #: n/skins/generic/content_make_private_form.pt:10 msgid "Make private: \"${docTitle}\"" msgstr "Make private: \"${docTitle}\"" @@ -1233,6 +1213,7 @@ msgid "make_private_transition_explanations" msgstr "" #: n/skins/generic/content_make_private_form.pt:16 +#: n/skins/generic/content_reject_form.pt:25 msgid "Make private" msgstr "Make private" @@ -1254,18 +1235,13 @@ msgid "Publish" msgstr "Publish" #: n/skins/generic/content_reject_form.pt:8 -msgid "Reject: \"${objectid}\"" -msgstr "Reject: \"${objectid}\"" +msgid "Make private: \"${objectid}\"" +msgstr "Make private: \"${objectid}\"" #: n/skins/generic/content_reject_form.pt:9 -msgid "reject_transition_explanations" +msgid "Make this item private to disable public access" msgstr "" -#: n/skins/generic/content_reject_form.pt:25 -#: n/skins/generic/pending_members.pt:30 -msgid "Reject" -msgstr "Reject" - #: n/skins/generic/content_retract_form.pt:8 msgid "Retract: \"${objectid}\"" msgstr "Retract: \"${objectid}\"" @@ -1644,6 +1620,10 @@ msgstr "Review members registration" msgid "Email" msgstr "Email" +#: n/skins/generic/pending_members.pt:30 +msgid "Reject" +msgstr "Reject" + #: n/skins/generic/pending_members.pt:35 msgid "Register" msgstr "Register" @@ -2015,6 +1995,10 @@ msgstr "(no email sent)" msgid "This item has not had any status changes." msgstr "This item has not had any status changes." +#: n/skins/generic/wf_redirect.py:12 +msgid "You are not allowed to change this content state." +msgstr "You are not allowed to change this content state." + #: n/skins/generic/widgets.pt:32 n/skins/generic/widgets.pt:33 msgid "Edit metadata" msgstr "Edit metadata" @@ -2937,6 +2921,24 @@ msgstr "Directory" msgid "Configure portal" msgstr "Configure portal" +#~ msgid "Depublish: \"${docTitle}\"" +#~ msgstr "Depublish: \"${docTitle}\"" + +#~ msgid "Select the destination state" +#~ msgstr "Select the destination state" + +#~ msgid "Private" +#~ msgstr "Private" + +#~ msgid "Shared" +#~ msgstr "Shared" + +#~ msgid "Depublish" +#~ msgstr "Depublish" + +#~ msgid "Reject: \"${objectid}\"" +#~ msgstr "Reject: \"${objectid}\"" + #~ msgid "Configure Solr delegated indexes" #~ msgstr "Configure Solr delegated indexes" diff --git a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo index c99b2ea..e1f30bc 100644 Binary files a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo and b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.mo differ diff --git a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po index a6f7089..7e46c9a 100644 --- a/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po +++ b/Products/Plinn/locales/fr/LC_MESSAGES/plinn.po @@ -211,7 +211,7 @@ msgid " Change and View " msgstr " Changer et voir " #: n/skins/content/folder_factories.pt:18 -#: n/skins/custom_generic/folder_contents.py:103 +#: n/skins/custom_generic/folder_contents.py:104 #: n/skins/custom_generic/personalize_form.pt:27 #: n/skins/generic/gruf_macros.pt:256 n/skins/generic/gruf_macros.pt:378 #: n/skins/generic/last_member_logs.pt:23 @@ -518,16 +518,20 @@ msgstr "%d élément déplacé en haut.%d éléments déplacés en haut." msgid "%d item moved up.%d items moved up." msgstr "%d élément déplacé vers le haut.%d éléments déplacés vers le haut." -#: n/skins/custom_generic/folder_contents.py:99 +#: n/skins/custom_generic/folder_contents.py:100 #: n/skins/photo_theme/search_results_macros.pt:14 msgid "Type" msgstr "Type" -#: n/skins/custom_generic/folder_contents.py:107 +#: n/skins/custom_generic/folder_contents.py:108 msgid "Last Modified" msgstr "Modifié le" -#: n/skins/custom_generic/folder_contents.py:117 +#: n/skins/custom_generic/folder_contents.py:112 +msgid "State" +msgstr "État" + +#: n/skins/custom_generic/folder_contents.py:122 msgid "Set Sorting as Default" msgstr "Définir comme tri par défaut" @@ -1202,33 +1206,6 @@ msgstr "Suivant" msgid "byline" msgstr "modifié le ${date} à ${time} – créateur : ${creator}" -#: n/skins/generic/content_depublish_form.pt:8 -msgid "Depublish: \"${docTitle}\"" -msgstr "Dépublier : « ${docTitle} Â»" - -#: n/skins/generic/content_depublish_form.pt:10 -msgid "depublish_transition_explanations" -msgstr "" -"La dépublication de ce document annulera son partage entre tout les membres " -"du site et permettra à son créateur de le modifier à nouveau. Vous devez " -"choisir quel sera l'état de destination pour effectuer l'opération." - -#: n/skins/generic/content_depublish_form.pt:15 -msgid "Select the destination state" -msgstr "Sélectionnez l'état de destination" - -#: n/skins/generic/content_depublish_form.pt:18 -msgid "Private" -msgstr "Privé" - -#: n/skins/generic/content_depublish_form.pt:22 -msgid "Shared" -msgstr "Partagé" - -#: n/skins/generic/content_depublish_form.pt:26 -msgid "Depublish" -msgstr "Dépublier" - #: n/skins/generic/content_make_private_form.pt:10 msgid "Make private: \"${docTitle}\"" msgstr "Rendre privé : « ${docTitle} Â»" @@ -1241,6 +1218,7 @@ msgstr "" "même ainsi que les coordonnateurs." #: n/skins/generic/content_make_private_form.pt:16 +#: n/skins/generic/content_reject_form.pt:25 msgid "Make private" msgstr "Rendre privé" @@ -1264,19 +1242,12 @@ msgid "Publish" msgstr "Publier" #: n/skins/generic/content_reject_form.pt:8 -msgid "Reject: \"${objectid}\"" -msgstr "Rejeter : « ${objectid} Â»" +msgid "Make private: \"${objectid}\"" +msgstr "Rendre privé : « ${objectid} »" #: n/skins/generic/content_reject_form.pt:9 -msgid "reject_transition_explanations" -msgstr "" -"Rejeter la publication de ce document pour que son propriétaire puisse " -"continuer à travailler." - -#: n/skins/generic/content_reject_form.pt:25 -#: n/skins/generic/pending_members.pt:30 -msgid "Reject" -msgstr "Rejeter" +msgid "Make this item private to disable public access" +msgstr "Rendre cet élément privé pour désactiver l'accès public." #: n/skins/generic/content_retract_form.pt:8 msgid "Retract: \"${objectid}\"" @@ -1663,6 +1634,10 @@ msgstr "Modérer l'inscription des membres" msgid "Email" msgstr "E-mail" +#: n/skins/generic/pending_members.pt:30 +msgid "Reject" +msgstr "Rejeter" + #: n/skins/generic/pending_members.pt:35 msgid "Register" msgstr "Inscrire" @@ -2044,6 +2019,10 @@ msgstr "(pas d'e-mail envoyé)" msgid "This item has not had any status changes." msgstr "Cet élément n'a pas encore eu de changement d'état." +#: n/skins/generic/wf_redirect.py:12 +msgid "You are not allowed to change this content state." +msgstr "Vous n'êtes pas autorisé à changer l'état de ce contenu." + #: n/skins/generic/widgets.pt:32 n/skins/generic/widgets.pt:33 msgid "Edit metadata" msgstr "Éditer les métadonnées" @@ -2971,6 +2950,36 @@ msgstr "Annuaire" msgid "Configure portal" msgstr "Configurer portail" +#~ msgid "Depublish: \"${docTitle}\"" +#~ msgstr "Dépublier : « ${docTitle} Â»" + +#~ msgid "depublish_transition_explanations" +#~ msgstr "" +#~ "La dépublication de ce document annulera son partage entre tout les " +#~ "membres du site et permettra à son créateur de le modifier à nouveau. " +#~ "Vous devez choisir quel sera l'état de destination pour effectuer " +#~ "l'opération." + +#~ msgid "Select the destination state" +#~ msgstr "Sélectionnez l'état de destination" + +#~ msgid "Private" +#~ msgstr "Privé" + +#~ msgid "Shared" +#~ msgstr "Partagé" + +#~ msgid "Depublish" +#~ msgstr "Dépublier" + +#~ msgid "Reject: \"${objectid}\"" +#~ msgstr "Rejeter : « ${objectid} Â»" + +#~ msgid "reject_transition_explanations" +#~ msgstr "" +#~ "Rejeter la publication de ce document pour que son propriétaire puisse " +#~ "continuer à travailler." + #~ msgid "Configure Solr delegated indexes" #~ msgstr "Configurer les index délégués à Solr" diff --git a/Products/Plinn/locales/plinn.pot b/Products/Plinn/locales/plinn.pot index f288f5a..7b88fdc 100644 --- a/Products/Plinn/locales/plinn.pot +++ b/Products/Plinn/locales/plinn.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: 2.0 beta 1\n" -"POT-Creation-Date: Mon Dec 15 15:39:47 2014\n" +"POT-Creation-Date: Sat Feb 21 01:11:05 2015\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Zope 3 Developers \n" @@ -217,7 +217,7 @@ msgid " Change and View " msgstr "" #: n/skins/content/folder_factories.pt:18 -#: n/skins/custom_generic/folder_contents.py:103 +#: n/skins/custom_generic/folder_contents.py:104 #: n/skins/custom_generic/personalize_form.pt:27 #: n/skins/generic/gruf_macros.pt:256 #: n/skins/generic/gruf_macros.pt:378 @@ -524,16 +524,20 @@ msgstr "" msgid "%d item moved up.%d items moved up." msgstr "" -#: n/skins/custom_generic/folder_contents.py:99 +#: n/skins/custom_generic/folder_contents.py:100 #: n/skins/photo_theme/search_results_macros.pt:14 msgid "Type" msgstr "" -#: n/skins/custom_generic/folder_contents.py:107 +#: n/skins/custom_generic/folder_contents.py:108 msgid "Last Modified" msgstr "" -#: n/skins/custom_generic/folder_contents.py:117 +#: n/skins/custom_generic/folder_contents.py:112 +msgid "State" +msgstr "" + +#: n/skins/custom_generic/folder_contents.py:122 msgid "Set Sorting as Default" msgstr "" @@ -1097,30 +1101,6 @@ msgstr "" msgid "byline" msgstr "" -#: n/skins/generic/content_depublish_form.pt:8 -msgid "Depublish: \"${docTitle}\"" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:10 -msgid "depublish_transition_explanations" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:15 -msgid "Select the destination state" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:18 -msgid "Private" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:22 -msgid "Shared" -msgstr "" - -#: n/skins/generic/content_depublish_form.pt:26 -msgid "Depublish" -msgstr "" - #: n/skins/generic/content_make_private_form.pt:10 msgid "Make private: \"${docTitle}\"" msgstr "" @@ -1131,6 +1111,7 @@ msgid "make_private_transition_explanations" msgstr "" #: n/skins/generic/content_make_private_form.pt:16 +#: n/skins/generic/content_reject_form.pt:25 msgid "Make private" msgstr "" @@ -1152,16 +1133,11 @@ msgid "Publish" msgstr "" #: n/skins/generic/content_reject_form.pt:8 -msgid "Reject: \"${objectid}\"" +msgid "Make private: \"${objectid}\"" msgstr "" #: n/skins/generic/content_reject_form.pt:9 -msgid "reject_transition_explanations" -msgstr "" - -#: n/skins/generic/content_reject_form.pt:25 -#: n/skins/generic/pending_members.pt:30 -msgid "Reject" +msgid "Make this item private to disable public access" msgstr "" #: n/skins/generic/content_retract_form.pt:8 @@ -1541,6 +1517,10 @@ msgstr "" msgid "Email" msgstr "" +#: n/skins/generic/pending_members.pt:30 +msgid "Reject" +msgstr "" + #: n/skins/generic/pending_members.pt:35 msgid "Register" msgstr "" @@ -1864,6 +1844,10 @@ msgstr "" msgid "This item has not had any status changes." msgstr "" +#: n/skins/generic/wf_redirect.py:12 +msgid "You are not allowed to change this content state." +msgstr "" + #: n/skins/generic/widgets.pt:32 #: n/skins/generic/widgets.pt:33 msgid "Edit metadata" diff --git a/Products/Plinn/skins/control/content_status_modify.py b/Products/Plinn/skins/control/content_status_modify.py index b8818d0..66361fe 100644 --- a/Products/Plinn/skins/control/content_status_modify.py +++ b/Products/Plinn/skins/control/content_status_modify.py @@ -14,7 +14,7 @@ if REQUEST : kw.update(REQUEST.form) try : - target = context.getActionInfo('object/history')['url'] + target = context.getParentNode().getActionInfo('object/view')['url'] except ValueError : target = context.getActionInfo('object/view')['url'] diff --git a/Products/Plinn/skins/custom_generic/folder_contents.py b/Products/Plinn/skins/custom_generic/folder_contents.py index d4737f4..e2d1764 100755 --- a/Products/Plinn/skins/custom_generic/folder_contents.py +++ b/Products/Plinn/skins/custom_generic/folder_contents.py @@ -11,7 +11,8 @@ from Products.CMFDefault.permissions import ListFolderContents from Products.CMFDefault.permissions import ManageProperties from Products.CMFDefault.permissions import ViewManagementScreens from Products.CMFDefault.permissions import ModifyPortalContent -from Products.CMFDefault.utils import html_marshal, Message as _ +from Products.CMFDefault.utils import html_marshal#, Message as _ +from Products.Plinn.utils import Message as _ mtool = getToolByName(script, 'portal_membership') checkPermission = mtool.checkPermission @@ -107,6 +108,10 @@ columns = ( {'key': 'Type', 'title': _('Last Modified'), 'width': None, 'colspan': None} + , {'key': 'review_state', + 'title': _('State'), + 'width': None, + 'colspan': None} ) for column in columns: @@ -166,6 +171,7 @@ for item in batch_obj: 'modified': item.modified.strftime(locale_date_fmt), 'title_or_id': item.Title or item_id, 'type': item.Type or None, + 'state': item.review_state, 'url': item_url } ) options['batch'] = { 'listColumnInfos': tuple(columns), diff --git a/Products/Plinn/skins/generic/content_publish_form.pt b/Products/Plinn/skins/generic/content_publish_form.pt index 4abe8fb..46bc8ea 100644 --- a/Products/Plinn/skins/generic/content_publish_form.pt +++ b/Products/Plinn/skins/generic/content_publish_form.pt @@ -17,7 +17,7 @@ Notify by e-mail

diff --git a/Products/Plinn/skins/generic/content_reject_form.pt b/Products/Plinn/skins/generic/content_reject_form.pt index 6f2381c..dc3886d 100644 --- a/Products/Plinn/skins/generic/content_reject_form.pt +++ b/Products/Plinn/skins/generic/content_reject_form.pt @@ -5,8 +5,8 @@
-

Reject: "Item"

-
reject_transition_explanations
+

Make private: "Item"

+
Make this item private to disable public access
@@ -16,13 +16,13 @@ Notify by e-mail

- +
diff --git a/Products/Plinn/skins/generic/folder_contents_macros.pt b/Products/Plinn/skins/generic/folder_contents_macros.pt index b03e11d..bff0d80 100644 --- a/Products/Plinn/skins/generic/folder_contents_macros.pt +++ b/Products/Plinn/skins/generic/folder_contents_macros.pt @@ -61,6 +61,10 @@ 2001 + + pending + diff --git a/Products/Plinn/skins/generic/folder_jsupload_snippet.py b/Products/Plinn/skins/generic/folder_jsupload_snippet.py index f932675..b6a082a 100644 --- a/Products/Plinn/skins/generic/folder_jsupload_snippet.py +++ b/Products/Plinn/skins/generic/folder_jsupload_snippet.py @@ -1,6 +1,7 @@ ##parameters=ob from Products.CMFCore.utils import getUtilityByInterfaceName utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool') +wftool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IWorkflowTool') locale_date_fmt = context.locale_date_fmt() infos = {'checkbox' : True, 'url' : ob.absolute_url(), @@ -10,6 +11,7 @@ infos = {'checkbox' : True, 'position' : context.getObjectPosition(ob.getId()), 'type' : ob.Type() or None, 'id' : ob.getId(), - 'icon': '%s/%s' % (utool(), ob.getIcon())} + 'icon': '%s/%s' % (utool(), ob.getIcon()), + 'state' : wftool.getInfoFor(ob, 'review_state')} return context.folder_jsupload_snippet_template(listItemInfos=[infos]) \ No newline at end of file diff --git a/Products/Plinn/skins/generic/wf_redirect.py b/Products/Plinn/skins/generic/wf_redirect.py new file mode 100644 index 0000000..7179333 --- /dev/null +++ b/Products/Plinn/skins/generic/wf_redirect.py @@ -0,0 +1,12 @@ +##parameters= +from Products.Plinn.utils import listWorkflowActions + +actions = listWorkflowActions(context) +redirect = context.REQUEST.RESPONSE.redirect +if actions : + return redirect(actions[0]['url']) +else : + from ZTUtils import make_query as mq + from Products.Plinn.utils import transtlate as _ + return redirect('%s?%s' % (actions[0]['url'], + mq(portal_status_message = _('You are not allowed to change this content state.')))) \ No newline at end of file diff --git a/Products/Plinn/update-i18n.sh b/Products/Plinn/update-i18n.sh index d2283eb..409133a 100755 --- a/Products/Plinn/update-i18n.sh +++ b/Products/Plinn/update-i18n.sh @@ -1,6 +1,6 @@ #! /bin/sh -i18nextract --path . --site_zcml ../../etc/site.zcml --domain plinn -o locales +i18nextract --path . --site_zcml /export/zope_instances/jma/etc/site.zcml --domain plinn -o locales cat locales/plinn.pot locales/plinn-manual.pot > locales/plinn-all.pot mv locales/plinn-all.pot locales/plinn.pot diff --git a/Products/Plinn/utils.py b/Products/Plinn/utils.py index de68f22..f15fd09 100755 --- a/Products/Plinn/utils.py +++ b/Products/Plinn/utils.py @@ -76,10 +76,10 @@ def thisObjectComeFromPortalSkin(ob, portal=None): except BadRequest : return False -security.declarePublic('listActionProviders_') -def listActionProviders_(context) : - atool = getToolByName(context, 'portal_actions') - return atool.listActionProviders() +security.declarePublic('listWorkflowActions') +def listWorkflowActions(context) : + wftool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IWorkflowTool') + return wftool.listActions(object=context) def capitalizeCompoundGivenName(givenName) : givenName = givenName.strip()