diff --git a/admin/award_awards.php b/admin/award_awards.php index ee6f262..9daf926 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -70,26 +70,55 @@ echo json_encode($ret); exit; case 'saveawardinfo': - print_r($_POST); + $id=intval($_GET['id']); + $q = "UPDATE award_awards SET + name='".mysql_escape_string(stripslashes($_GET['name']))."', + `order`='".intval($_GET['order'])."', + sponsors_id='".intval($_GET['sponsors_id'])."', + award_types_id='".intval($_GET['award_types_id'])."', + presenter='".mysql_escape_string(stripslashes($_GET['presenter']))."', + excludefromac='".(($_GET['excludefromac'] == 1) ? 1 : 0)."', + cwsfaward='".(($_GET['cwsfaward'] == 1) ? 1 : 0)."', + self_nominate='".(($_GET['self_nominate'] == 'yes') ? 'yes' : 'no')."', + schedule_judges='".(($_GET['schedule_judges'] == 'yes') ? 'yes' : 'no')."', + criteria='".mysql_escape_string(stripslashes($_GET['criteria']))."', + description='".mysql_escape_string(stripslashes($_GET['description']))."' + WHERE id='$id'"; + echo $q; + echo happy(i18n('Settings Saved')); +// mysql_query($q); + /* + //whipe out any old award-category links + mysql_query("DELETE FROM award_awards_projectcategories WHERE award_awards_id='$id'"); -/* - $r=mysql_fetch_object($q); - $award_awards_id=$r->id; - $award_awards_name=$r->name; - $award_awards_order=$r->order; - $award_awards_criteria=$r->criteria; - $award_awards_description=$r->description; - $award_types_id=$r->award_types_id; - $award_type=$r->type; - $sponsors_id=$r->sponsors_id; - $award_sponsor=$r->organization; - $award_awards_presenter=$r->presenter; - $award_awards_excludefromac=$r->excludefromac; - $award_awards_cwsfaward=$r->cwsfaward; - $award_awards_self_nominate=$r->self_nominate; - $award_awards_schedule_judges=$r->schedule_judges;*/ + //now add the new ones + if(is_array($_POST['eligiblecategories'])) + { + foreach($_POST['eligiblecategories'] AS $cat) + { + mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,year) VALUES ('$id','$cat','".$config['FAIRYEAR']."')"); + } + } + //whipe out any old award-divisions links + mysql_query("DELETE FROM award_awards_projectdivisions WHERE award_awards_id='$id'"); + + //now add the new ones + if(is_array($_POST['eligibledivisions'])) + { + foreach($_POST['eligibledivisions'] AS $div) + { + mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year) VALUES ('$id','$div','".$config['FAIRYEAR']."')"); + } + } + + if($_POST['save']=="add") + echo happy("Award successfully added"); + else + echo happy("Successfully saved changes to award"); + */ exit; + case 'geteligibility': $id = intval($_GET['id']); //select the current categories that this award is linked to @@ -158,16 +187,11 @@ function popup_begin($name, $title, $width=0, $height=0) { - $size= $width ? "style=\"width:$width%; height:$height%\"" : ''; - echo "
"; - echo ""; } @@ -182,8 +206,14 @@ var award_id = 0; function popup_editor(id) { + var w = (document.documentElement.clientWidth * 0.8); + var h = (document.documentElement.clientHeight * 0.8); + + $('#popup_editor').dialog('option', 'width', w); + $('#popup_editor').dialog('option', 'height', h); + $("#popup_editor").dialog('open'); + award_id = id; - popup_open("editor"); htabs_open("editortabs"); } @@ -194,6 +224,7 @@ function update_awardinfo() // alert("id="+award_id); $.getJSON("=$_SERVER['PHP_SELF']?>?action=getawardinfo&id="+id, function(json){ + $("#awardinfo_id").val(json.id); $("#awardinfo_name").val(json.name); $("#awardinfo_order").val(json.order); $("#awardinfo_sponsors_id").val(json.sponsors_id); @@ -202,7 +233,6 @@ function update_awardinfo() $("#awardinfo_criteria").val(json.criteria); $("#awardinfo_award_types_id").val(json.award_types_id); // For some reason, with checkboxes, these have to be arrays - $("#awardinfo_excludefromac").val([json.excludefromac]); $("#awardinfo_cwsfaward").val([json.cwsfaward]); $("#awardinfo_selfnominate").val([json.self_nominate]); @@ -213,7 +243,7 @@ function update_awardinfo() function save_awardinfo() { - $.post("$_SERVER['PHP_SELF']?>?action=saveawardinfo", $("#awardinfo").serialize()); + $("#awardinfo_info").load("$_SERVER['PHP_SELF']?>?action=saveawardinfo", $("#awardinfo").serialize()); return 0; } @@ -229,20 +259,32 @@ function update_eligibility() // When the document is ready set up our sortable with it's inherant function(s) $(document).ready(function() { - $("#test-list").sortable({ - handle : '.handle', - update : function () { - var order = $('#test-list').sortable('serialize'); - $("#info").load("=$_SERVER['PHP_SELF']?>?action=orderprizes&order="+order); - } - }); + $("#test-list").sortable({ + handle : '.handle', + update : function () { + var order = $('#test-list').sortable('serialize'); + $("#info").load("=$_SERVER['PHP_SELF']?>?action=orderprizes&order="+order); + } + }); + + $("#popup_editor").dialog({ + bgiframe: true, + autoOpen: false, + height: 600, + width: 600, + modal: true, + resizable: false, + draggable: false + }); + + }); - -popup_begin('editor', "Award Editor", 80, 80); + /* Begin popup */ + echo "