forked from science-ation/science-ation
- Ok, so jquery does do the right thing, we just have to be careful not to read
fields that may not exist.
This commit is contained in:
parent
e07d24102c
commit
fdeef1f273
@ -56,19 +56,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE award_awards SET
|
$q = "UPDATE award_awards SET
|
||||||
name='".mysql_escape_string(stripslashes($_POST['name']))."',
|
|
||||||
sponsors_id='".intval($_POST['sponsors_id'])."',
|
|
||||||
award_types_id='".intval($_POST['award_types_id'])."',
|
award_types_id='".intval($_POST['award_types_id'])."',
|
||||||
presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."',
|
presenter='".mysql_escape_string(stripslashes($_POST['presenter']))."',
|
||||||
excludefromac='".(($_POST['excludefromac'] == 1) ? 1 : 0)."',
|
excludefromac='".(($_POST['excludefromac'] == 1) ? 1 : 0)."',
|
||||||
cwsfaward='".(($_POST['cwsfaward'] == 1) ? 1 : 0)."',
|
cwsfaward='".(($_POST['cwsfaward'] == 1) ? 1 : 0)."',
|
||||||
self_nominate='".(($_POST['self_nominate'] == 'yes') ? 'yes' : 'no')."',
|
self_nominate='".(($_POST['self_nominate'] == 'yes') ? 'yes' : 'no')."',
|
||||||
schedule_judges='".(($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no')."',
|
schedule_judges='".(($_POST['schedule_judges'] == 'yes') ? 'yes' : 'no')."',
|
||||||
criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."',
|
description='".mysql_escape_string(stripslashes($_POST['description']))."' ";
|
||||||
description='".mysql_escape_string(stripslashes($_POST['description']))."'
|
|
||||||
WHERE id='$id'";
|
if(array_key_exists('name', $_POST)) {
|
||||||
|
/* These values may be disabled, if they name key exists, assume
|
||||||
|
* they aren't disabled and save them too */
|
||||||
|
$q .= "name='".mysql_escape_string(stripslashes($_POST['name']))."',
|
||||||
|
criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."',
|
||||||
|
sponsors_id='".intval($_POST['sponsors_id'])."'";
|
||||||
|
}
|
||||||
|
$q .= "WHERE id='$id'";
|
||||||
mysql_query($q);
|
mysql_query($q);
|
||||||
// echo $q;
|
print_r($_POST);
|
||||||
|
echo $q;
|
||||||
happy_("Award information saved");
|
happy_("Award information saved");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@ -278,9 +284,7 @@ function update_awardinfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Enable all fields */
|
/* Enable all fields */
|
||||||
$("#awardinfo_name").removeAttr('disabled');
|
$("#awardinfo *").removeAttr('disabled');
|
||||||
$("#awardinfo_sponsors_id").removeAttr('disabled');
|
|
||||||
$("#awardinfo_criteria").removeAttr('disabled');
|
|
||||||
|
|
||||||
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=awardinfo_load&id="+award_id,
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=awardinfo_load&id="+award_id,
|
||||||
function(json){
|
function(json){
|
||||||
@ -301,9 +305,9 @@ function update_awardinfo()
|
|||||||
/* Disable fields we don't want the user to edit
|
/* Disable fields we don't want the user to edit
|
||||||
* for downloaded awards */
|
* for downloaded awards */
|
||||||
if(json.award_source_fairs_id != null) {
|
if(json.award_source_fairs_id != null) {
|
||||||
// $("#awardinfo_name").attr('disabled', 'disabled');
|
$("#awardinfo_name").attr('disabled', 'disabled');
|
||||||
// $("#awardinfo_sponsors_id").attr('disabled', 'disabled');
|
$("#awardinfo_sponsors_id").attr('disabled', 'disabled');
|
||||||
// $("#awardinfo_criteria").attr('disabled', 'disabled');
|
$("#awardinfo_criteria").attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the dialog title */
|
/* Update the dialog title */
|
||||||
|
Loading…
Reference in New Issue
Block a user