From 6acb5713e8df5d44e14f747a229ab29fe79694b7 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Tue, 10 Jan 2017 17:19:35 +0100 Subject: [PATCH] dev #45275 add translation to manager actions --- .../Controller/Plugin/Manager/Album.php | 32 +++++++++++++------ .../Controller/Plugin/Manager/Article.php | 22 ++++++------- .../Controller/Plugin/Manager/CustomField.php | 10 +++--- .../Controller/Plugin/Manager/Newsletter.php | 12 +++---- .../Controller/Plugin/Manager/Sitotheque.php | 14 ++++---- .../Controller/Plugin/Manager/UserGroup.php | 14 ++++---- 6 files changed, 59 insertions(+), 45 deletions(-) diff --git a/library/ZendAfi/Controller/Plugin/Manager/Album.php b/library/ZendAfi/Controller/Plugin/Manager/Album.php index 202da59fec8..212ff16223e 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Album.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Album.php @@ -633,14 +633,14 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_ 'action' => 'edit_album', 'id' => '%s'], 'icon' => 'edit', - 'label' => 'Modifier l\'album'], + 'label' => $this->_('Modifier l\'album')], ['url' => ['module' => 'admin', 'controller' => 'album', 'action' => 'edit_images', 'id' => '%s'], 'icon' => 'images', - 'label' => 'Gérer les médias', + 'label' => $this->_('Gérer les médias'), 'caption' => 'formatedCount'], ['url' => ['module' => 'admin', @@ -648,14 +648,14 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_ 'action' => 'preview_album', 'id' => '%s'], 'icon' => function($model) {return $model->isVisible() ? 'view' : 'hide';}, - 'label' => 'Visualisation de l\album'], + 'label' => $this->_('Visualisation de l\album')], ['url' => ['module' => 'admin', 'controller' => 'album', 'action' => 'delete_album', 'id' => '%s'], 'icon' => 'delete', - 'label' => 'Supprimer l\'album', + 'label' => $this->_('Supprimer l\'album'), 'anchorOptions' => ['onclick' => 'return confirm(\'Êtes-vous sûr de vouloir supprimer cet album;\')']] ]; } @@ -668,29 +668,43 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_ 'action' => 'add_categorie_to', 'id' => '%s'], 'icon' => 'add_category', - 'label' => 'Ajouter une sous-catégorie'], + 'label' => $this->_('Ajouter une sous-catégorie')], ['url' => ['module' => 'admin', 'controller' => 'album', 'action' => 'add_album_to', 'id' => '%s'], 'icon' => 'add_page', - 'label' => 'Ajouter un album'], + 'label' => $this->_('Ajouter un album')], ['url' => ['module' => 'admin', 'controller' => 'album', 'action' => 'edit_categorie', 'id' => '%s'], 'icon' => 'edit', - 'label' => 'Modifier la catégorie'], + 'label' => $this->_('Modifier la catégorie')], ['url' => ['module' => 'admin', 'controller' => 'album', 'action' => 'delete_categorie', 'id' => '%s'], 'icon' => 'delete', - 'label' => 'Supprimer la catégorie', - 'anchorOptions' => ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer cette catégorie ?')"]] + 'label' => $this->_('Supprimer la catégorie'), + 'anchorOptions' => ['rel' => 'delete-album-category'], + 'caption' => function($model) + { + Class_ScriptLoader::getInstance()->addJQueryReady(" +function deleteAlbumCategory(event) { + var target = $(event.target).closest('a'); + var answer = confirm(\"".$this->_("Etes-vous sûr de vouloir supprimer cette catégorie ?")."\"); + if (answer == false) { + event.preventDefault(); + return; + } +} + +$(\"a[rel='delete-album-category']\").click(deleteAlbumCategory); +");}] ]; } } \ No newline at end of file diff --git a/library/ZendAfi/Controller/Plugin/Manager/Article.php b/library/ZendAfi/Controller/Plugin/Manager/Article.php index cbd4a7fb983..b2386bf7b5a 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Article.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Article.php @@ -446,31 +446,31 @@ public function newsduplicateAction() { return [ ['url' => '/admin/cms/makeinvisible/id/%s', 'icon' => 'show', - 'label' => 'Rendre cet article invisible', + 'label' => $this->_('Rendre cet article invisible'), 'condition' => function($model) use ($permission_closure) { return $permission_closure($model) && $model->isVisible(); }], ['url' => '/admin/cms/makevisible/id/%s', 'icon' => 'hide', - 'label' => 'Rendre cet article visible', + 'label' => $this->_('Rendre cet article visible'), 'condition' => function($model) use ($permission_closure) { return $permission_closure($model) && $model->isNotVisible(); }], ['url' => '/admin/cms/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier', + 'label' => $this->_('Modifier'), 'condition' => $permission_closure], ['url' => '/admin/cms/newsduplicate/id/%s', 'icon' => 'copy', - 'label' => 'Dupliquer', + 'label' => $this->_('Dupliquer'), 'condition' => $permission_closure], ['url' => '/admin/cms/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'condition' => $permission_closure] ]; } @@ -487,12 +487,12 @@ public function newsduplicateAction() { return [ ['url' => '/admin/cms-category/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier', + 'label' => $this->_('Modifier'), 'condition' => $parent_permission], ['url' => '/admin/cms-category/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'condition' => function($model) use ($parent_permission) { return $parent_permission($model) && $model->hasNoChild(); }, @@ -501,7 +501,7 @@ public function newsduplicateAction() { ['url' => '/admin/cms/add/id_cat/%s', 'icon' => 'add_page', - 'label' => 'Ajouter un article', + 'label' => $this->_('Ajouter un article'), 'condition' => function($model) { return $this->identity ->hasAnyPermissionOn($model, @@ -511,7 +511,7 @@ public function newsduplicateAction() { ['url' => '/admin/cms-category/add/id/%s', 'icon' => 'add_category', - 'label' => 'Ajouter une sous-catégorie', + 'label' => $this->_('Ajouter une sous-catégorie'), 'condition' => function($model) { return $this->identity ->hasPermissionOn(Class_Permission::createArticleCategory(), @@ -527,7 +527,7 @@ public function newsduplicateAction() { return [ ['url' => '/admin/cms-category/add/id_bib/%s', 'icon' => 'add_category', - 'label' => 'Ajouter une catégorie', + 'label' => $this->_('Ajouter une catégorie'), 'condition' => function($model) { return $this->_identity->isRoleMoreThanModoPortail() || $this->_identity->hasPermissionOn(Class_Permission::createArticleCategory(), @@ -535,7 +535,7 @@ public function newsduplicateAction() { }], ['url' => '/admin/bib/permissions/id/%s', 'icon' => 'groups', - 'label' => 'Permissions par défaut', + 'label' => $this->_('Permissions par défaut'), 'condition' => function($model) { return $this->_identity->isRoleMoreThanModoPortail(); }] diff --git a/library/ZendAfi/Controller/Plugin/Manager/CustomField.php b/library/ZendAfi/Controller/Plugin/Manager/CustomField.php index 8334a3c002e..57a4ec8e5ae 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/CustomField.php +++ b/library/ZendAfi/Controller/Plugin/Manager/CustomField.php @@ -44,26 +44,26 @@ class ZendAfi_Controller_Plugin_Manager_CustomField extends ZendAfi_Controller_P return [ ['url' => '/admin/custom-fields/add/model/%s', - 'label' => 'Rattacher un champ personnalisé', + 'label' => $this->_('Rattacher un champ personnalisé'), 'icon' => 'add_page'] ]; return [ ['url' => '/admin/custom-fields/up/id/%s', 'icon' => 'up', - 'label' => 'Monter'], + 'label' => $this->_('Monter')], ['url' => '/admin/custom-fields/down/id/%s', 'icon' => 'down', - 'label' => 'Descendre'], + 'label' => $this->_('Descendre')], ['url' => '/admin/custom-fields/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier'], + 'label' => $this->_('Modifier')], ['url' => '/admin/custom-fields/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'anchorOptions' => ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer ce champs ?');"]] ]; } diff --git a/library/ZendAfi/Controller/Plugin/Manager/Newsletter.php b/library/ZendAfi/Controller/Plugin/Manager/Newsletter.php index af209c194d8..9db0b354bb7 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Newsletter.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Newsletter.php @@ -25,17 +25,17 @@ class ZendAfi_Controller_Plugin_Manager_Newsletter extends ZendAfi_Controller_Pl return [ ['url' => '/admin/newsletter/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier la newsletter'], + 'label' => $this->_('Modifier la newsletter')], ['url' => '/admin/newsletter/preview/id/%s', 'icon' => 'show', - 'label' => 'Visualiser la newsletter'], + 'label' => $this->_('Visualiser la newsletter')], ['url' => '/admin/newsletter/edit-subscribers/id/%s', 'icon' => 'users', 'caption' => 'getNumberOfUsers', - 'label' => 'Modifier les inscrits'], + 'label' => $this->_('Modifier les inscrits')], ['url' => '/admin/newsletter/sendtest/id/%s', 'icon' => 'test', - 'label' => 'Effectuer un test d\'envoi'], + 'label' => $this->_('Effectuer un test d\'envoi')], ['url' => '/admin/newsletter/send/id/%s', 'icon' => 'mail', 'anchorOptions' => ['rel' => 'send'], @@ -56,10 +56,10 @@ function sendNewsletterClick(event) { 'label' => 'Envoyer la lettre d\'information'], ['url' => '/admin/newsletter/duplicate/id/%s', 'icon' => 'copy', - 'label' => 'Dupliquer la lettre d\'information'], + 'label' => $this->_('Dupliquer la lettre d\'information')], ['url' => '/admin/newsletter/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer la lettre d\'information'] + 'label' => $this->_('Supprimer la lettre d\'information')] ]; } diff --git a/library/ZendAfi/Controller/Plugin/Manager/Sitotheque.php b/library/ZendAfi/Controller/Plugin/Manager/Sitotheque.php index f2e890910f0..53e765ff385 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/Sitotheque.php +++ b/library/ZendAfi/Controller/Plugin/Manager/Sitotheque.php @@ -152,21 +152,21 @@ class ZendAfi_Controller_Plugin_Manager_Sitotheque extends ZendAfi_Controller_Pl return [ ['url' => '/admin/sito/catedit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier'], + 'label' => $this->_('Modifier')], ['url' => '/admin/sito/catdel/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'condition' => 'hasNoChild', 'anchorOptions' => ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer cette catégorie ?')"]], ['url' => '/admin/sito/add/id_cat/%s', 'icon' => 'add_page', - 'label' => 'Ajouter un site'], + 'label' => $this->_('Ajouter un site')], ['url' => '/admin/sito/catadd/id/%s', 'icon' => 'add_category', - 'label' => 'Ajouter une sous-catégorie'] + 'label' => $this->_('Ajouter une sous-catégorie')] ]; } @@ -176,17 +176,17 @@ class ZendAfi_Controller_Plugin_Manager_Sitotheque extends ZendAfi_Controller_Pl [ ['url' => '/admin/sito/sitoview/id/%s?&iframe=true&width=80%;height=80%;', 'icon' => 'view', - 'label' => 'Visualiser', + 'label' => $this->_('Visualiser'), 'anchorOptions' => ['rel' => 'prettyPhoto']], ['url' => '/admin/sito/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier', + 'label' => $this->_('Modifier'), ], ['url' => '/admin/sito/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'anchorOptions' => ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer ce site ?')"]] ]; } diff --git a/library/ZendAfi/Controller/Plugin/Manager/UserGroup.php b/library/ZendAfi/Controller/Plugin/Manager/UserGroup.php index f7ec662a411..e61c878fedf 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/UserGroup.php +++ b/library/ZendAfi/Controller/Plugin/Manager/UserGroup.php @@ -204,22 +204,22 @@ class ZendAfi_Controller_Plugin_Manager_UserGroup extends ZendAfi_Controller_Plu return [ ['url' => '/admin/usergroup/catedit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier'], + 'label' => $this->_('Modifier')], ['url' => '/admin/usergroup/catdel/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'condition' => 'hasNoChild', 'anchorOptions' => ['onclick' => "return confirm('Etes-vous sûr de vouloir supprimer cette catégorie ?')"]], ['url' => '/admin/usergroup/add/id_cat/%s', 'icon' => 'add_page', - 'label' => 'Ajouter un groupe'], + 'label' => $this->_('Ajouter un groupe')], ['url' => '/admin/usergroup/catadd/id/%s', 'data-popup' => true, 'icon' => 'add_category', - 'label' => 'Ajouter une sous-catégorie']]; + 'label' => $this->_('Ajouter une sous-catégorie')]]; } @@ -227,18 +227,18 @@ class ZendAfi_Controller_Plugin_Manager_UserGroup extends ZendAfi_Controller_Plu return [ ['url' => '/admin/usergroup/editmembers/id/%s', 'icon' => 'users', - 'label' => 'Membres', + 'label' => $this->_('Membres'), 'caption' => 'formatedCount' ], ['url' => '/admin/usergroup/edit/id/%s', 'icon' => 'edit', - 'label' => 'Modifier', + 'label' => $this->_('Modifier'), ], ['url' => '/admin/usergroup/delete/id/%s', 'icon' => 'delete', - 'label' => 'Supprimer', + 'label' => $this->_('Supprimer'), 'anchorOptions' => [ 'onclick' => "return confirm('Etes-vous sûr de vouloir supprimer ce groupe ?')" ]] -- GitLab