forked from science-ation/science-ation
- Implement the generic prize template editor (not fully tested)
- Doesn't launch from awards.php yet for some reason.
This commit is contained in:
parent
2270593d65
commit
074d39171f
@ -139,7 +139,11 @@ case 'award_create':
|
|||||||
|
|
||||||
case 'prizeinfo_load':
|
case 'prizeinfo_load':
|
||||||
$id = intval($_GET['id']);
|
$id = intval($_GET['id']);
|
||||||
$q = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='$id' ORDER BY `order`");
|
if($id == -1) {
|
||||||
|
$q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`");
|
||||||
|
} else {
|
||||||
|
$q = mysql_query("SELECT * FROM award_prizes WHERE award_awards_id='$id' ORDER BY `order`");
|
||||||
|
}
|
||||||
while($r=mysql_fetch_assoc($q)) {
|
while($r=mysql_fetch_assoc($q)) {
|
||||||
$ret[] = $r;
|
$ret[] = $r;
|
||||||
}
|
}
|
||||||
@ -152,15 +156,21 @@ case 'award_create':
|
|||||||
echo json_encode($ret);
|
echo json_encode($ret);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
case 'prize_create':
|
||||||
|
$aaid = intval($_GET['award_awards_id']);
|
||||||
|
$year = $config['FAIRYEAR'];
|
||||||
|
if($aaid == -1) {
|
||||||
|
$aaid = 0;
|
||||||
|
$year = -1;
|
||||||
|
}
|
||||||
|
mysql_query("INSERT INTO award_prizes(award_awards_id,year) VALUES ('$aaid','$year');");
|
||||||
|
$ret = array('id' => mysql_insert_id() );
|
||||||
|
echo json_encode($ret);
|
||||||
|
exit;
|
||||||
|
|
||||||
case 'prize_save':
|
case 'prize_save':
|
||||||
print_R($_GET);
|
print_R($_GET);
|
||||||
$id = intval($_GET['id']);
|
$id = intval($_GET['id']);
|
||||||
if($id == -1) {
|
|
||||||
$aaid = intval($_GET['award_awards_id']);
|
|
||||||
mysql_query("INSERT INTO award_prizes(award_awards_id,year) VALUES ('$aaid','{$config['FAIRYEAR']}');");
|
|
||||||
$id = mysql_insert_id();
|
|
||||||
echo happy(i18n("Created new prize"));
|
|
||||||
}
|
|
||||||
$q="UPDATE award_prizes SET
|
$q="UPDATE award_prizes SET
|
||||||
prize='".mysql_escape_string(stripslashes($_GET['prize']))."',
|
prize='".mysql_escape_string(stripslashes($_GET['prize']))."',
|
||||||
cash='".intval($_GET['cash'])."',
|
cash='".intval($_GET['cash'])."',
|
||||||
@ -255,6 +265,7 @@ function prizelist_refresh()
|
|||||||
dragHandle: "drag_handle",
|
dragHandle: "drag_handle",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_prizeinfo()
|
function update_prizeinfo()
|
||||||
{
|
{
|
||||||
var id = award_id;
|
var id = award_id;
|
||||||
@ -328,12 +339,15 @@ function prize_delete(id)
|
|||||||
function prize_create()
|
function prize_create()
|
||||||
{
|
{
|
||||||
var id = award_id;
|
var id = award_id;
|
||||||
$(".prizeinfo").val("");
|
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prize_create&award_awards_id="+id,
|
||||||
$("#prizeinfo_id").val("-1");
|
function(json){
|
||||||
$("#prizeinfo_award_awards_id").val(id);
|
$(".prizeinfo").val("");
|
||||||
$("#prizeinfo_edit_header").html("<?=i18n("New Prize")?>");
|
$("#prizeinfo_id").val(json.id);
|
||||||
$(".prizeinfo").removeAttr("disabled");
|
$("#prizeinfo_edit_header").html("<?=i18n("New Prize")?>");
|
||||||
$("#prizeinfo_save").removeAttr("disabled");
|
$(".prizeinfo").removeAttr("disabled");
|
||||||
|
$("#prizeinfo_save").removeAttr("disabled");
|
||||||
|
update_prizeinfo();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -534,6 +548,8 @@ htabs_end();
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Here's all the code for the award list, except for the AJAX queries which are
|
/* Here's all the code for the award list, except for the AJAX queries which are
|
||||||
* at the top of this file */
|
* at the top of this file */
|
||||||
?>
|
?>
|
||||||
@ -549,7 +565,11 @@ function popup_editor(id)
|
|||||||
$("#popup_editor").dialog('open');
|
$("#popup_editor").dialog('open');
|
||||||
|
|
||||||
award_id = id;
|
award_id = id;
|
||||||
htabs_open("editortabs");
|
if(id == -1) {
|
||||||
|
htabs_open('prizes');
|
||||||
|
} else {
|
||||||
|
htabs_open("editortabs");
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -581,7 +601,7 @@ function award_create()
|
|||||||
popup_editor(json.id);
|
popup_editor(json.id);
|
||||||
/* Ensure we open on the first tab */
|
/* Ensure we open on the first tab */
|
||||||
$("#htabs_awardinfo_tab").click();
|
$("#htabs_awardinfo_tab").click();
|
||||||
/* FUIXME: insert data into the list */
|
/* FIXME: insert data into the list */
|
||||||
awardlist_refresh();
|
awardlist_refresh();
|
||||||
});
|
});
|
||||||
// alert("ok");
|
// alert("ok");
|
||||||
@ -604,6 +624,15 @@ function award_delete(id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function popup_edit_prize_template()
|
||||||
|
{
|
||||||
|
$("#htabs_editortabs_awardinfo").remove();
|
||||||
|
$("#htabs_editortabs_eligibility").remove();
|
||||||
|
$("#htabs_editortabs_prizes").html("<?=i18n("Generic Prize Template")?>");
|
||||||
|
popup_editor(-1);
|
||||||
|
$("#htabs_editortabs_prizes").click();
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
awardlist_refresh();
|
awardlist_refresh();
|
||||||
// $(".awardlist_tr#166").css('background-color','red');
|
// $(".awardlist_tr#166").css('background-color','red');
|
||||||
@ -612,10 +641,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div id="info_info"></div>
|
<div id="info_info"></div>
|
||||||
|
|
||||||
<?
|
<?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* List filtering */
|
/* List filtering */
|
||||||
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
|
if($_GET['sponsors_id'] && $_GET['sponsors_id']!="all")
|
||||||
@ -698,6 +729,9 @@ echo "</table>";
|
|||||||
?>
|
?>
|
||||||
<br />
|
<br />
|
||||||
<a href="#" onClick="award_create();"><?=i18n("Create New Award")?></a>
|
<a href="#" onClick="award_create();"><?=i18n("Create New Award")?></a>
|
||||||
|
<a href="#" onClick="popup_edit_prize_template();"><?=i18n("Edit Generic Prize Template")?></a>
|
||||||
|
<input type="submit" onClick="award_create();" value="<?=i18n("Create New Award")?>" />
|
||||||
|
<input type="submit" onClick="popup_edit_prize_template();" value="<?=i18n("Edit Generic Prize Template")?>" />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
|
||||||
<?
|
<?
|
||||||
@ -775,7 +809,17 @@ if(mysql_num_rows($q))
|
|||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<a href=\"award_prizes.php?award_awards_id=-1\">Edit prizes for the generic prize template</a>";
|
// echo "<a href=\"award_prizes.php?award_awards_id=-1\">Edit prizes for the generic prize template</a>";
|
||||||
|
|
||||||
|
|
||||||
|
if($_GET['action'] == 'edit_prize_template') {
|
||||||
|
|
||||||
|
?><script type="text/javascript">
|
||||||
|
popup_edit_prize_template();
|
||||||
|
</script>
|
||||||
|
<?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
send_footer();
|
send_footer();
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
echo "<a href=\"sponsor_contacts.php\">".i18n('Award Sponsors Contacts')."</a><br />";
|
echo "<a href=\"sponsor_contacts.php\">".i18n('Award Sponsors Contacts')."</a><br />";
|
||||||
echo "<a href=\"award_awards.php\">".i18n('Awards Management')."</a><br />";
|
echo "<a href=\"award_awards.php\">".i18n('Awards Management')."</a><br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<a href=\"award_prizes.php?award_awards_id=-1\">".i18n('Edit prize template for the divisional awards')."</a>";
|
echo "<a href=\"award_awards.php?action=edit_prize_template\">".i18n('Edit prize template for the divisional awards')."</a>";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<a href=\"award_awardcreatedivisional.php\">".i18n('Create divisional awards for all divisions & categories')."</a><br />";
|
echo "<a href=\"award_awardcreatedivisional.php\">".i18n('Create divisional awards for all divisions & categories')."</a><br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
Loading…
Reference in New Issue
Block a user