diff --git a/admin/tags.php b/admin/tags.php index 0858d830f..a56f20221 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -302,20 +302,27 @@ SELECT if (isset($_POST['delete']) and isset($_POST['tags'])) { - $query = ' + if (!isset($_POST['confirm_deletion'])) + { + $page['errors'][] = l10n('You need to confirm deletion'); + } + else + { + $query = ' SELECT name FROM '.TAGS_TABLE.' WHERE id IN ('.implode(',', $_POST['tags']).') ;'; - $tag_names = array_from_query($query, 'name'); + $tag_names = array_from_query($query, 'name'); - delete_tags($_POST['tags']); + delete_tags($_POST['tags']); - $page['infos'][] = l10n_dec( - 'The following tag was deleted', 'The %d following tags were deleted', - count($tag_names) - ) - .' : '.implode(', ', $tag_names); + $page['infos'][] = l10n_dec( + 'The following tag was deleted', 'The %d following tags were deleted', + count($tag_names) + ) + .' : '.implode(', ', $tag_names); + } } // +-----------------------------------------------------------------------+ diff --git a/admin/themes/default/template/tags.tpl b/admin/themes/default/template/tags.tpl index e54362637..d7d85b0f9 100644 --- a/admin/themes/default/template/tags.tpl +++ b/admin/themes/default/template/tags.tpl @@ -2,6 +2,7 @@ {html_style} .showInfo { text-indent:5px; } +.buttonLike i { font-size:14px; } {/html_style} {footer_script require='jquery'} @@ -62,6 +63,68 @@ $("#searchInput").on("keydown", function(e) { e.preventDefault(); } }); + +jQuery('input[name="tags[]"]').click(function() { + var nbSelected = 0; + nbSelected = jQuery('input[name="tags[]"]').filter(':checked').length; + + if (nbSelected == 0) { + jQuery("#permitAction").hide(); + jQuery("#forbidAction").show(); + } + else { + jQuery("#permitAction").show(); + jQuery("#forbidAction").hide(); + } +}); + +jQuery("[id^=action_]").hide(); + +jQuery("select[name=selectAction]").change(function () { + jQuery("[id^=action_]").hide(); + + jQuery("#action_"+jQuery(this).prop("value")).show(); + + jQuery("#displayFormBlock").hide(); + jQuery("#applyActionBlock").hide(); + + if (jQuery(this).val() != -1 ) { + if (jQuery(this).val() == 'delete') { + jQuery("#applyActionBlock").show(); + jQuery("#applyAction").attr("name", jQuery(this).val()); + } + else { + jQuery("#displayForm").attr("name", jQuery(this).val()); + jQuery("#displayFormBlock").show(); + } + } + else { + } +}); + +jQuery("input[name=delete]").click(function() { + console.log("salut"); +return false; + if (!jQuery("input[name=confirm_deletion]").is(":checked")) { + jQuery("#action_delete .errors").show(); + return false; + } +}); + +jQuery("form").submit(function() { + console.log("hello"); + if (jQuery("select[name=selectAction]").val() == "delete") { + if (!jQuery("input[name=confirm_deletion]").is(":checked")) { + jQuery("#action_delete .errors").show(); + return false; + } + } + /* return false; */ +}); + +jQuery("input[name=confirm_deletion]").change(function() { + jQuery("#action_delete .errors").hide(); +}); {/footer_script} @@ -70,6 +133,8 @@ $("#searchInput").on("keydown", function(e) {
+ + {if isset($EDIT_TAGS_LIST)}
{'Edit tags'|@translate} @@ -148,11 +213,13 @@ $("#searchInput").on("keydown", function(e) {

+{if !isset($EDIT_TAGS_LIST) and !isset($DUPLIC_TAGS_LIST) and !isset($MERGE_TAGS_LIST)} +
{'Tag selection'|@translate} {if count($all_tags)} -
+
{/if} -

- - - - - -

+
+ {'Action'|@translate} +
{'No tag selected, no action possible.'|@translate}
+ {* #permitAction *} +
+{/if} +