From 78d295f840ad897e6ba3828700afd55a18129b4b Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 29 Mar 2017 17:13:10 +0200
Subject: [PATCH] add UNSELECT_ALL button in tags admin entities

---
 apps/maarch_entreprise/js/functions.js |  4 +++
 apps/maarch_entreprise/lang/en.php     |  4 ++-
 apps/maarch_entreprise/lang/fr.php     |  2 ++
 modules/tags/manage_tag_list.php       | 40 +++++++-------------------
 4 files changed, 19 insertions(+), 31 deletions(-)

diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js
index b6633b9718f..4e5a632e5c2 100755
--- a/apps/maarch_entreprise/js/functions.js
+++ b/apps/maarch_entreprise/js/functions.js
@@ -3362,6 +3362,10 @@ function loadToolbarBadge(targetTab,path_manage_script){
     });
 }
 
+function resetSelect(id) {
+    $j('#'+id).val("");
+    Event.fire($(id), "chosen:updated");
+}
 
 // Exemple appel service
 // function testService(){
diff --git a/apps/maarch_entreprise/lang/en.php b/apps/maarch_entreprise/lang/en.php
index ffeddeb1e7b..6f91dfa0d8d 100644
--- a/apps/maarch_entreprise/lang/en.php
+++ b/apps/maarch_entreprise/lang/en.php
@@ -1811,4 +1811,6 @@ if (!defined("_FINAL_DISPOSITION")) define("_FINAL_DISPOSITION","Final dispositi
 if (!defined("_CHOOSE_FINAL_DISPOSITION")) define("_CHOOSE_FINAL_DISPOSITION","choose final disposition");
 if (!defined("_DESTROY")) define("_DESTROY","Destroy");
 if (!defined("_KEEP")) define("_KEEP","Keep");
-if (!defined("_RETENTION_RULE")) define("_RETENTION_RULE","Retention rule");
\ No newline at end of file
+if (!defined("_RETENTION_RULE")) define("_RETENTION_RULE","Retention rule");
+
+if (!defined("_UNSELECT_ALL")) define("_UNSELECT_ALL","Unselect all");
\ No newline at end of file
diff --git a/apps/maarch_entreprise/lang/fr.php b/apps/maarch_entreprise/lang/fr.php
index f0c63fff6f4..06f0d2fceed 100755
--- a/apps/maarch_entreprise/lang/fr.php
+++ b/apps/maarch_entreprise/lang/fr.php
@@ -1816,3 +1816,5 @@ if (!defined("_CHOOSE_FINAL_DISPOSITION")) define("_CHOOSE_FINAL_DISPOSITION","C
 if (!defined("_DESTROY")) define("_DESTROY","Destruction");
 if (!defined("_KEEP")) define("_KEEP","Conservation");
 if (!defined("_RETENTION_RULE")) define("_RETENTION_RULE","Règle de retention");
+
+if (!defined("_UNSELECT_ALL")) define("_UNSELECT_ALL","Tout désélectionner");
diff --git a/modules/tags/manage_tag_list.php b/modules/tags/manage_tag_list.php
index 31333df902b..6daa1beade9 100755
--- a/modules/tags/manage_tag_list.php
+++ b/modules/tags/manage_tag_list.php
@@ -1,36 +1,14 @@
 <?php
-/*
-*    Copyright 2008,2014 Maarch
-*
-*  This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*    along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
 /**
-* Module : Tags
-* 
-* This module is used to store ressources with any keywords
-* V: 1.0
-*
-* @file
-* @author Loic Vinet
-* @date $date$
-* @version $Revision$
+* Copyright Maarch since 2008 under licence GPLv3.
+* See LICENCE.txt file at the root folder for more details.
+* This file is part of Maarch software.
+
+* @brief   managage_tag_list
+* @author  dev <dev@maarch.org>
+* @ingroup tags
 */
 
-/* Affichage */
 if ($mode == 'list') {
     $list = new list_show();
     $list->admin_list(
@@ -39,7 +17,8 @@ if ($mode == 'list') {
         $tagslist['title'],
         'tag_label',
         'manage_tag_list_controller&mode=list',
-        'tags','tag_id',
+        'tags',
+        'tag_id',
         true,
         $tagslist['page_name_up'],
         $tagslist['page_name_val'],
@@ -165,6 +144,7 @@ if ($mode == 'list') {
 
                 }
                 $content .= '</select>';
+                $content .= '<p style="text-align: right;margin-right: 20px;"><a style="cursor: pointer;" onclick="resetSelect(\'entitieslist\')">'._UNSELECT_ALL.'</a></p>';
                 $content .= '<script>new Chosen($(\'entitieslist\'),{width: "95%", disable_search_threshold: 10, search_contains: true,display_disabled_options: false});</script>';
                 echo $content;
             ?>
-- 
GitLab