From a984354ee7768fdbc11943ee40f1c31dd357dc97 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sun, 12 Jan 2014 12:16:46 +0000 Subject: change behavior of reset/cancel button on tags manager + reorganize code git-svn-id: http://piwigo.org/svn/trunk@26650 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/tags.php | 19 +--- admin/themes/default/template/tags.tpl | 193 +++++++++++++++++---------------- 2 files changed, 106 insertions(+), 106 deletions(-) (limited to 'admin') diff --git a/admin/tags.php b/admin/tags.php index 92a38e805..a7c58f796 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -38,7 +38,7 @@ if (!empty($_POST)) // | edit tags | // +-----------------------------------------------------------------------+ -if (isset($_POST['submit'])) +if (isset($_POST['edit_submit'])) { $query = ' SELECT name @@ -194,7 +194,7 @@ SELECT id, name // | merge tags | // +-----------------------------------------------------------------------+ -if (isset($_POST['confirm_merge'])) +if (isset($_POST['merge_submit'])) { if (!isset($_POST['destination_tag'])) { @@ -428,11 +428,7 @@ if ((isset($_POST['edit']) or isset($_POST['duplicate']) or isset($_POST['merge' $list_name = 'MERGE_TAGS_LIST'; } - $template->assign( - array( - $list_name => implode(',', $_POST['tags']), - ) - ); + $template->assign($list_name, implode(',', $_POST['tags'])); $query = ' SELECT id, name @@ -441,17 +437,12 @@ SELECT id, name ;'; $result = pwg_query($query); while ($row = pwg_db_fetch_assoc($result)) - { - $name_of[ $row['id'] ] = $row['name']; - } - - foreach ($_POST['tags'] as $tag_id) { $template->append( 'tags', array( - 'ID' => $tag_id, - 'NAME' => $name_of[$tag_id], + 'ID' => $row['id'], + 'NAME' => $row['name'], ) ); } diff --git a/admin/themes/default/template/tags.tpl b/admin/themes/default/template/tags.tpl index 9ca054f14..e54362637 100644 --- a/admin/themes/default/template/tags.tpl +++ b/admin/themes/default/template/tags.tpl @@ -1,26 +1,68 @@ {include file='include/tag_selection.inc.tpl'} -{footer_script}{literal} -jQuery(document).ready(function(){ - function displayDeletionWarnings() { - jQuery(".warningDeletion").show(); - jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide(); - } +{html_style} +.showInfo { text-indent:5px; } +{/html_style} + +{footer_script require='jquery'} +jQuery('.showInfo').tipTip({ + 'delay' : 0, + 'fadeIn' : 200, + 'fadeOut' : 200, + 'maxWidth':'300px', + 'keepAlive':true, + 'activation':'click' +}); +function displayDeletionWarnings() { + jQuery(".warningDeletion").show(); + jQuery("input[name=destination_tag]:checked").parent("label").children(".warningDeletion").hide(); +} + +displayDeletionWarnings(); + +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"); - jQuery("#mergeTags label").click(function() { - displayDeletionWarnings(); - }); + if (timer) { + clearTimeout(timer); + } - jQuery("input[name=merge]").click(function() { - if (jQuery("ul.tagSelection input[type=checkbox]:checked").length < 2) { - alert("{/literal}{'Select at least two tags for merging'|@translate}{literal}"); - return false; + $this.data("timer", setTimeout(function() { + var val = $this.val(); + if (!val) { + $(".tagSelection>li").show(); + $("#filterIcon").css("visibility","hidden"); } - }); + else { + $("#filterIcon").css("visibility","visible"); + var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" ); + $(".tagSelection>li").each(function() { + var $li = $(this), + text = $.trim( $("label", $li).text() ); + $li.toggle(regex.test(text)); + }); + } + + }, 300) ); + + if (e.keyCode == 13) { // Enter + e.preventDefault(); + } }); -{/literal}{/footer_script} +{/footer_script}
@@ -46,12 +88,12 @@ jQuery(document).ready(function(){

- - - + +

{/if} + {if isset($DUPLIC_TAGS_LIST)}
{'Edit tags'|@translate} @@ -70,23 +112,28 @@ jQuery(document).ready(function(){

- - - + +

{/if} {if isset($MERGE_TAGS_LIST)} - -
{'Merge tags'|@translate} - {'Select the destination tag'|@translate}

+ {'Select the destination tag'|@translate} + +

{foreach from=$tags item=tag name=tagloop}
{/foreach} -
+

+ +

+ + + +

{/if} @@ -103,73 +150,35 @@ jQuery(document).ready(function(){
{'Tag selection'|@translate} -{html_style} -.showInfo{ldelim}text-indent:5px} -{/html_style} -{footer_script}{literal} -jQuery('.showInfo').tipTip({ - 'delay' : 0, - 'fadeIn' : 200, - 'fadeOut' : 200, - 'maxWidth':'300px', - 'keepAlive':true, - 'activation':'click' - }); -{/literal}{/footer_script} -{if count($all_tags)} -
-{footer_script}{literal} -$("#searchInput").on( "keydown", function(e) { - var $this = $(this), - timer = $this.data("timer"); - if (timer) - clearTimeout(timer); - - $this.data("timer", setTimeout( function() { - var val = $this.val(); - if (!val) { - $(".tagSelection>li").show(); - $("#filterIcon").css("visibility","hidden"); - } - else { - $("#filterIcon").css("visibility","visible"); - var regex = new RegExp( val.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"), "i" ); - $(".tagSelection>li").each( function(i, li) { - var $li = $(li), - text = $.trim( $("label", $li).text() ); - if (regex.test( text )) - $li.show(); - else - $li.hide(); - }); - } - - }, 300) ); - - if (e.keyCode == 13) { // Enter - e.preventDefault(); - } -}); -{/literal}{/footer_script} -{/if} - - -

- - - - - -

+ + {if count($all_tags)} +
+ {/if} + +
    + {foreach from=$all_tags item=tag} +
  • + {capture name='showInfo'}{strip} + {$tag.name} ({$tag.counter|@translate_dec:'%d photo':'%d photos'})
    + {'View in gallery'|@translate} | + {'Manage photos'|@translate} + {if !empty($tag.alt_names)}
    {$tag.alt_names}{/if} + {/strip}{/capture} + + +
  • + {/foreach} +
+ +

+ + + + + +

-- cgit v1.2.3