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..72229c1b8 100644 --- a/admin/themes/default/template/tags.tpl +++ b/admin/themes/default/template/tags.tpl @@ -1,10 +1,45 @@ +{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'} {include file='include/tag_selection.inc.tpl'} {html_style} .showInfo { text-indent:5px; } +.buttonLike i { font-size:14px; } {/html_style} {footer_script require='jquery'} +/** + * Add tag + */ +jQuery("#addTag").click(function() { + jQuery("#addTagForm").toggle(); + jQuery("input[name=add_tag]").focus(); + return false; +}); + +jQuery("#addTagClose").click(function() { + jQuery("#addTagForm").hide(); + return false; +}); + +jQuery("#selectionMode").click(function() { + if (jQuery(this).hasClass("icon-check-empty")) { + jQuery("#selectionMode").removeClass("icon-check-empty").addClass("icon-check"); + jQuery('label.font-checkbox span').show(); + jQuery('ul.tagSelection a.showInfo').hide(); + jQuery('fieldset#action').show(); + jQuery('fieldset#selectTags legend').html("{'Tag selection'|translate|escape:javascript}"); + } + else { + jQuery("#selectionMode").removeClass("icon-check").addClass("icon-check-empty"); + jQuery('label.font-checkbox span').hide(); + jQuery('ul.tagSelection a.showInfo').show(); + jQuery('fieldset#action').hide(); + jQuery('fieldset#selectTags legend').html("{'Tags'|translate|escape:javascript}"); + } + return false; +}); + + jQuery('.showInfo').tipTip({ 'delay' : 0, 'fadeIn' : 200, @@ -25,13 +60,6 @@ jQuery("#mergeTags label").click(function() { displayDeletionWarnings(); }); -jQuery("input[name=merge]").click(function() { - if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) { - alert("{'Select at least two tags for merging'|@translate}"); - return false; - } -}); - $("#searchInput").on("keydown", function(e) { var $this = $(this), timer = $this.data("timer"); @@ -62,6 +90,64 @@ $("#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("form").submit(function() { + if (jQuery("select[name=selectAction]").val() == "delete") { + if (!jQuery("input[name=confirm_deletion]").is(":checked")) { + jQuery("#action_delete .errors").show(); + return false; + } + } + + if (jQuery("select[name=selectAction]").val() == "merge") { + if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) { + alert("{'Select at least two tags for merging'|@translate}"); + return false; + } + } +}); + +jQuery("input[name=confirm_deletion]").change(function() { + jQuery("#action_delete .errors").hide(); +}); {/footer_script} @@ -69,7 +155,32 @@ $("#searchInput").on("keydown", function(e) {

{'Manage tags'|@translate}

+

+ {'Add a tag'|translate} + {'Select tags'|translate} +

+ + +
+ + {if isset($EDIT_TAGS_LIST)}
{'Edit tags'|@translate} @@ -137,22 +248,13 @@ $("#searchInput").on("keydown", function(e) {
{/if} -
- {'Add a tag'|@translate} +{if !isset($EDIT_TAGS_LIST) and !isset($DUPLIC_TAGS_LIST) and !isset($MERGE_TAGS_LIST)} - - -

-
- -
- {'Tag selection'|@translate} +
+ {'Tags'|@translate} {if count($all_tags)} -
+
{/if}
    @@ -165,20 +267,61 @@ $("#searchInput").on("keydown", function(e) { {if !empty($tag.alt_names)}
    {$tag.alt_names}{/if} {/strip}{/capture} -
-

- - - - - -

+ +{/if} + diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index ba130473d..91c8ae153 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -989,4 +989,7 @@ $lang['Recipients'] = 'Recipients'; $lang['No recipient selected'] = 'No recipient selected'; $lang['No user is permitted to see this private album'] = 'No user is permitted to see this private album'; $lang['Each email sent will contain its own automatic authentication key on links, valid for %s.'] = 'Each email sent will contain its own automatic authentication key on links, valid for %s.'; -$lang['For security reason, authentication keys do not work for administrators.'] = 'For security reason, authentication keys do not work for administrators.'; \ No newline at end of file +$lang['For security reason, authentication keys do not work for administrators.'] = 'For security reason, authentication keys do not work for administrators.'; +$lang['Select tags'] = 'Select tags'; +$lang['No tag selected, no action possible.'] = 'No tag selected, no action possible.'; +$lang['Display form'] = 'Display form'; \ No newline at end of file diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index 0036542eb..cdc34ad6c 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -991,4 +991,7 @@ $lang['No recipient selected'] = 'Choisissez un destinataire'; $lang['No user is permitted to see this private album'] = 'Aucun utilisateur n\'est autorisé à voir cet album privé'; $lang['Each email sent will contain its own automatic authentication key on links, valid for %s.'] = 'Chaque email envoyé contiendra sa propre clef d\'identification automatique sur les liens, valide %s.'; $lang['For security reason, authentication keys do not work for administrators.'] = 'Par mesure de sécurité les clefs d\'identification ne fonctionnent pas pour les administrateurs.'; -$lang['Y Repeat'] = 'Répétition Y'; \ No newline at end of file +$lang['Y Repeat'] = 'Répétition Y'; +$lang['Select tags'] = 'Sélectionner des tags'; +$lang['No tag selected, no action possible.'] = 'Aucun tag sélectionné, aucune action possible.'; +$lang['Display form'] = 'Afficher le formulaire'; \ No newline at end of file