resetting prize form appropriately now (issue 411). Also fixed unreported issue preventing checkboxes in this form from being properly set.

This commit is contained in:
justin 2010-07-13 02:02:31 +00:00
parent e69e6bc64e
commit 78f4bcb43a

View File

@ -222,10 +222,10 @@
value='".intval($_POST['value'])."',
number='".intval($_POST['number'])."',
excludefromac='".(($_POST['excludefromac']==1)? 1 : 0)."',
trophystudentkeeper='".(($_POST['trophystudentkeeper']==1) ? 1 : 0)."',
trophystudentreturn='".(($_POST['trophystudentreturn']==1) ? 1 : 0)."',
trophyschoolkeeper='".(($_POST['trophyschoolkeeper']==1) ? 1 : 0)."',
trophyschoolreturn='".(($_POST['trophyschoolreturn']==1) ? 1 : 0)."'
trophystudentkeeper='".(array_key_exists('trophystudentkeeper', $_POST) ? 1 : 0)."',
trophystudentreturn='".(array_key_exists('trophystudentreturn', $_POST) ? 1 : 0)."',
trophyschoolkeeper='".(array_key_exists('trophyschoolkeeper', $_POST) ? 1 : 0)."',
trophyschoolreturn='".(array_key_exists('trophyschoolreturn', $_POST) ? 1 : 0)."'
WHERE id='$id'";
mysql_query($q);
// echo $q;
@ -443,6 +443,12 @@ function update_eligibility()
});
}
function prizefields_reset() {
$(".prizeinfo").removeAttr("checked");
$(".prizeinfo").attr("disabled", "disabled").val('');
$("#prizeinfo_save").attr("disabled", "disabled");
}
function prizelist_refresh()
{
$("#prizelist").tableDnD({
@ -498,11 +504,31 @@ function edit_prize(id)
$("#prizeinfo_scholarship").val(json.scholarship);
$("#prizeinfo_value").val(json.value);
$("#prizeinfo_number").val(json.number);
$("#prizeinfo_trophystudentkeeper").val([json.trophystudentkeeper]);
$("#prizeinfo_trophystudentreturn").val([json.trophystudentreturn]);
$("#prizeinfo_trophyschoolreturn").val([json.trophyschoolreturn]);
$("#prizeinfo_trophyschoolkeeper").val([json.trophyschoolkeeper]);
$("#prizeinfo_excludefromac").val([json.excludefromac]);
if(json.trophystudentkeeper == 1) {
$("#prizeinfo_trophystudentkeeper").attr("checked", "checked");
} else {
$("#prizeinfo_trophystudentkeeper").removeAttr("checked");
}
if(json.trophystudentreturn == 1) {
$("#prizeinfo_trophystudentreturn").attr("checked", "checked");
} else {
$("#prizeinfo_trophystudentreturn").removeAttr("checked");
}
if(json.trophyschoolreturn == 1) {
$("#prizeinfo_trophyschoolreturn").attr("checked", "checked");
} else {
$("#prizeinfo_trophyschoolreturn").removeAttr("checked");
}
if(json.trophyschoolkeeper == 1) {
$("#prizeinfo_trophyschoolkeeper").attr("checked", "checked");
} else {
$("#prizeinfo_trophyschoolkeeper").removeAttr("checked");
}
if(json.excludefromac == 1) {
$("#prizeinfo_excludefromac").attr("checked", "checked");
} else {
$("#prizeinfo_excludefromac").removeAttr("checked");
}
$(".prizeinfo").removeAttr("disabled");
$("#prizeinfo_save").removeAttr("disabled");
});
@ -529,12 +555,13 @@ function prize_delete(id)
{
var confirm = confirmClick('Are you sure you want to delete this prize?');
if(confirm == true) {
$("#prizeinfo_info").load("<?$_SERVER['PHP_SELF']?>?action=prize_delete&id="+id,null,
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=prize_delete&id="+id, $("#prizeinfo").serializeArray(),
function(responseText, textStatus, XMLHttpRequest)
{
$(".prizelist_tr#"+id).fadeTo('slow', 0);
$(".prizelist_tr#"+id).remove();
prizelist_refresh();
prizefields_reset();
});
}
return 0;
@ -825,6 +852,8 @@ function popup_editor(id, mode)
* activation anyway */
award_tab_update = new Array();
prizefields_reset();
/* Force no tabs to be selected, need to set collapsible
* to true first */
$('#editor_tabs').tabs('option', 'collapsible', true);