Skip to content

Commit

Permalink
Fixed issue #05204: Action on selected tokens doesn't process
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Tony Partner committed May 27, 2011
1 parent 8a342a3 commit 7277aa6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 76 deletions.
144 changes: 70 additions & 74 deletions 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('<p><img style="margin-top:42px" src="../images/ajax-loader.gif" width="200" height="25" /></p>');
$('#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('<p><img style="margin-top:42px" src="../images/ajax-loader.gif" width="200" height="25" /></p>');
$('#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);
}

4 changes: 2 additions & 2 deletions admin/tokens.php
Expand Up @@ -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&amp;sid={$surveyid}&amp;subaction=delete&amp;tids=document.getElementById('tokenboxeschecked').value&amp;limit={$limit}&amp;start={$start}&amp;order={$order}")."}\" />";
."')) {".get2post("{$scriptname}?action=tokens&amp;sid={$surveyid}&amp;subaction=delete&amp;tids=document.getElementById('tokenboxeschecked').value&amp;limit={$limit}&amp;start={$start}&amp;order={$order}")."}}else{alert('".$clang->gT("No tokens selected")."');}\" />";

}

Expand Down

0 comments on commit 7277aa6

Please sign in to comment.