From 7277aa67f4e9e0acd1b0cfe7a5ea657e714d212f Mon Sep 17 00:00:00 2001 From: Tony Partner Date: Fri, 27 May 2011 20:53:03 +0000 Subject: [PATCH] Fixed issue #05204: Action on selected tokens doesn't process Dev Fix invalid JavaScript causing errors in IE7 and unselected tokens to be deleted Dev Prevent token-delete function from firing if no tokens selected git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@10134 b72ed6b6-b9f8-46b5-92b4-906544132732 --- admin/scripts/tokens.js | 144 +++++++++++++++++++--------------------- admin/tokens.php | 4 +- 2 files changed, 72 insertions(+), 76 deletions(-) diff --git a/admin/scripts/tokens.js b/admin/scripts/tokens.js index 65d0bf2f095..797171a95d3 100644 --- a/admin/scripts/tokens.js +++ b/admin/scripts/tokens.js @@ -1,74 +1,70 @@ -// $Id: tokens.js 8633 2010-04-25 12:57:33Z c_schmitz -$(document).ready(function(){ - $("#bounceprocessing").change(turnoff); - turnoff(); - $('img[id=bounceprocessing]').bind('click',function(){ - $("#dialog-modal").dialog({ - title: "Summary", - modal: true, - autoOpen: false, - height: 200, - width: 400, - show: 'blind', - hide: 'blind', - }); - checkbounces(surveyid); - }); - $("#filterduplicatetoken").change(function(){ - if ($("#filterduplicatetoken").attr('checked')==true) - { - $("#lifilterduplicatefields").slideDown(); - } - else - { - $("#lifilterduplicatefields").slideUp(); - } - }) - //Token checkbox toggles - var tog=false; - $('#tokencheckboxtoggle').click(function() { - var selecteditems=''; - $("input[type=checkbox]").attr("checked",!tog); - $("input[type=checkbox]").each(function(index) { - if($(this).attr("name") && $(this).attr("checked")) { - selecteditems = selecteditems + "|" + $(this).attr("name"); - /* alert(index + ': '+$(this).attr("name")); */ - $('#tokenboxeschecked').val(selecteditems); - /* alert(selecteditems); */ - } - }); - tog=!tog; - }); - $('input[type=checkbox]').click(function() { - var selecteditems=''; - $("input[type=checkbox]").each(function(index) { - if($(this).attr("name") && $(this).attr("checked")) { - selecteditems = selecteditems + "|" + $(this).attr("name"); - /* alert(index + ': '+$(this).attr("name")); */ - $('#tokenboxeschecked').val(selecteditems); - /* alert(selecteditems); */ - } - }); - }); -}); - -function checkbounces(surveyid) { -$("#dialog-modal").dialog('open'); - var url = 'admin.php?action=tokens&subaction=bounceprocessing&sid='+surveyid - $('#dialog-modal').html('

'); - $('#dialog-modal').load(url); -} - -function turnoff(ui,evt) -{ - bounce_disabled=($("#bounceprocessing").val()=='N' || $("#bounceprocessing").val()=='G'); - if (bounce_disabled==true) {bounce_disabled='disabled';} - else {bounce_disabled='';} - $("#bounceaccounttype").attr('disabled',bounce_disabled); - $("#bounceaccounthost").attr('disabled',bounce_disabled); - $("#bounceaccountuser").attr('disabled',bounce_disabled); - $("#bounceaccountpass").attr('disabled',bounce_disabled); - $("#bounceencryption").attr('disabled',bounce_disabled); - $("#bounceaccountencryption").attr('disabled',bounce_disabled); -} - +// $Id: tokens.js 8633 2010-04-25 12:57:33Z c_schmitz +$(document).ready(function(){ + $("#bounceprocessing").change(turnoff); + turnoff(); + $('img#bounceprocessing').bind('click',function(){ + $("#dialog-modal").dialog({ + title: "Summary", + modal: true, + autoOpen: false, + height: 200, + width: 400, + show: 'blind', + hide: 'blind' + }); + checkbounces(surveyid); + }); + $("#filterduplicatetoken").change(function(){ + if ($("#filterduplicatetoken").attr('checked')==true) + { + $("#lifilterduplicatefields").slideDown(); + } + else + { + $("#lifilterduplicatefields").slideUp(); + } + }) + //Token checkbox toggles + var tog=false; + $('#tokencheckboxtoggle').click(function() { + var selecteditems=''; + $("input[type=checkbox]").attr("checked",!tog); + $("input[type=checkbox]").each(function(index) { + if($(this).attr("name") && $(this).attr("checked")) { + selecteditems = selecteditems + "|" + $(this).attr("name"); + } + }); + $('#tokenboxeschecked').val(selecteditems); + tog=!tog; + }); + $('input[type=checkbox]').click(function() { + var selecteditems=''; + $("input[type=checkbox]").each(function(index) { + if($(this).attr("name") && $(this).attr("checked")) { + selecteditems = selecteditems + "|" + $(this).attr("name"); + } + }); + $('#tokenboxeschecked').val(selecteditems); + }); +}); + +function checkbounces(surveyid) { +$("#dialog-modal").dialog('open'); + var url = 'admin.php?action=tokens&subaction=bounceprocessing&sid='+surveyid + $('#dialog-modal').html('

'); + $('#dialog-modal').load(url); +} + +function turnoff(ui,evt) +{ + bounce_disabled=($("#bounceprocessing").val()=='N' || $("#bounceprocessing").val()=='G'); + if (bounce_disabled==true) {bounce_disabled='disabled';} + else {bounce_disabled='';} + $("#bounceaccounttype").attr('disabled',bounce_disabled); + $("#bounceaccounthost").attr('disabled',bounce_disabled); + $("#bounceaccountuser").attr('disabled',bounce_disabled); + $("#bounceaccountpass").attr('disabled',bounce_disabled); + $("#bounceencryption").attr('disabled',bounce_disabled); + $("#bounceaccountencryption").attr('disabled',bounce_disabled); +} + diff --git a/admin/tokens.php b/admin/tokens.php index 857c89bd708..069c8bc942e 100644 --- a/admin/tokens.php +++ b/admin/tokens.php @@ -1294,9 +1294,9 @@ .$clang->gT("Delete the selected entries") ."' alt='" .$clang->gT("Delete the selected entries") - ."' onclick=\"if (confirm('" + ."' onclick=\"if($('#tokenboxeschecked').val()){if (confirm('" .$clang->gT("Are you sure you want to delete the selected entries?","js") - ."')) {".get2post("{$scriptname}?action=tokens&sid={$surveyid}&subaction=delete&tids=document.getElementById('tokenboxeschecked').value&limit={$limit}&start={$start}&order={$order}")."}\" />"; + ."')) {".get2post("{$scriptname}?action=tokens&sid={$surveyid}&subaction=delete&tids=document.getElementById('tokenboxeschecked').value&limit={$limit}&start={$start}&order={$order}")."}}else{alert('".$clang->gT("No tokens selected")."');}\" />"; }