forked from science-ation/science-ation
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:
parent
e69e6bc64e
commit
78f4bcb43a
@ -222,10 +222,10 @@
|
|||||||
value='".intval($_POST['value'])."',
|
value='".intval($_POST['value'])."',
|
||||||
number='".intval($_POST['number'])."',
|
number='".intval($_POST['number'])."',
|
||||||
excludefromac='".(($_POST['excludefromac']==1)? 1 : 0)."',
|
excludefromac='".(($_POST['excludefromac']==1)? 1 : 0)."',
|
||||||
trophystudentkeeper='".(($_POST['trophystudentkeeper']==1) ? 1 : 0)."',
|
trophystudentkeeper='".(array_key_exists('trophystudentkeeper', $_POST) ? 1 : 0)."',
|
||||||
trophystudentreturn='".(($_POST['trophystudentreturn']==1) ? 1 : 0)."',
|
trophystudentreturn='".(array_key_exists('trophystudentreturn', $_POST) ? 1 : 0)."',
|
||||||
trophyschoolkeeper='".(($_POST['trophyschoolkeeper']==1) ? 1 : 0)."',
|
trophyschoolkeeper='".(array_key_exists('trophyschoolkeeper', $_POST) ? 1 : 0)."',
|
||||||
trophyschoolreturn='".(($_POST['trophyschoolreturn']==1) ? 1 : 0)."'
|
trophyschoolreturn='".(array_key_exists('trophyschoolreturn', $_POST) ? 1 : 0)."'
|
||||||
WHERE id='$id'";
|
WHERE id='$id'";
|
||||||
mysql_query($q);
|
mysql_query($q);
|
||||||
// echo $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()
|
function prizelist_refresh()
|
||||||
{
|
{
|
||||||
$("#prizelist").tableDnD({
|
$("#prizelist").tableDnD({
|
||||||
@ -498,11 +504,31 @@ function edit_prize(id)
|
|||||||
$("#prizeinfo_scholarship").val(json.scholarship);
|
$("#prizeinfo_scholarship").val(json.scholarship);
|
||||||
$("#prizeinfo_value").val(json.value);
|
$("#prizeinfo_value").val(json.value);
|
||||||
$("#prizeinfo_number").val(json.number);
|
$("#prizeinfo_number").val(json.number);
|
||||||
$("#prizeinfo_trophystudentkeeper").val([json.trophystudentkeeper]);
|
if(json.trophystudentkeeper == 1) {
|
||||||
$("#prizeinfo_trophystudentreturn").val([json.trophystudentreturn]);
|
$("#prizeinfo_trophystudentkeeper").attr("checked", "checked");
|
||||||
$("#prizeinfo_trophyschoolreturn").val([json.trophyschoolreturn]);
|
} else {
|
||||||
$("#prizeinfo_trophyschoolkeeper").val([json.trophyschoolkeeper]);
|
$("#prizeinfo_trophystudentkeeper").removeAttr("checked");
|
||||||
$("#prizeinfo_excludefromac").val([json.excludefromac]);
|
}
|
||||||
|
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").removeAttr("disabled");
|
||||||
$("#prizeinfo_save").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?');
|
var confirm = confirmClick('Are you sure you want to delete this prize?');
|
||||||
if(confirm == true) {
|
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)
|
function(responseText, textStatus, XMLHttpRequest)
|
||||||
{
|
{
|
||||||
$(".prizelist_tr#"+id).fadeTo('slow', 0);
|
$(".prizelist_tr#"+id).fadeTo('slow', 0);
|
||||||
$(".prizelist_tr#"+id).remove();
|
$(".prizelist_tr#"+id).remove();
|
||||||
prizelist_refresh();
|
prizelist_refresh();
|
||||||
|
prizefields_reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -825,6 +852,8 @@ function popup_editor(id, mode)
|
|||||||
* activation anyway */
|
* activation anyway */
|
||||||
award_tab_update = new Array();
|
award_tab_update = new Array();
|
||||||
|
|
||||||
|
prizefields_reset();
|
||||||
|
|
||||||
/* Force no tabs to be selected, need to set collapsible
|
/* Force no tabs to be selected, need to set collapsible
|
||||||
* to true first */
|
* to true first */
|
||||||
$('#editor_tabs').tabs('option', 'collapsible', true);
|
$('#editor_tabs').tabs('option', 'collapsible', true);
|
||||||
|
Loading…
Reference in New Issue
Block a user