- Add status area on each page for award div

- Redirect all ajax load output to a debug div (which can be turned on with
  debug=true).  The output has to go somewhere, and it can't go to the
  notification div, because it will overwrite what's already there.  The ajax
  methods emit javascript now to add notifications.
This commit is contained in:
dave 2009-09-13 19:25:03 +00:00
parent 1f830c7845
commit d2535f46bc
4 changed files with 39 additions and 29 deletions

View File

@ -65,7 +65,7 @@
criteria='".mysql_escape_string(stripslashes($_POST['criteria']))."',
description='".mysql_escape_string(stripslashes($_POST['description']))."'
WHERE id='$id'";
echo happy(i18n('Award Info Saved'));
happy_("Award Information Saved.");
mysql_query($q);
exit;
@ -111,7 +111,7 @@
mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,year)
VALUES ('$id','$div','{$config['FAIRYEAR']}')");
}
echo happy(i18n("Saved."));
happy_("Saved.");
exit;
case 'prize_order':
@ -122,7 +122,7 @@
mysql_query("UPDATE `award_prizes` SET `order`='$order' WHERE `id`='$id'");
}
// print_r($_GET);
// echo happy(i18n("Order Updated."));
happy_("Order Updated.");
exit;
case 'award_order':
@ -132,7 +132,7 @@
$order++;
mysql_query("UPDATE `award_awards` SET `order`='$order' WHERE `id`='$id'");
}
// echo happy(i18n("Order Updated."));
happy_("Order Updated.");
exit;
case 'prizeinfo_load':
@ -183,14 +183,14 @@
mysql_query($q);
// echo $q;
// echo mysql_error();
echo happy(i18n("Prize saved"));
happy_("Prize saved");
exit;
case 'prize_delete':
$id = intval($_GET['id']);
mysql_query("DELETE FROM award_prizes WHERE id='$id'");
// echo "DELETE FROM award_prizes WHERE id='$id'";
echo happy(i18n("Prize deleted"));
happy_("Prize deleted");
exit;
case 'feeder_load':
@ -207,6 +207,7 @@
case 'feeder_save':
// print_r($_POST);
$id = intval($_POST['award_awards_id']);
$dl = is_array($_POST['feeder_dl']) ? $_POST['feeder_dl'] : array();
$ul = is_array($_POST['feeder_ul']) ? $_POST['feeder_ul'] : array();
@ -245,6 +246,7 @@ function update_awardinfo()
{
var id = award_id;
// alert("id="+award_id);
notice_div_id('award_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=awardinfo_load&id="+id,
function(json){
$("#awardinfo_id").val(json.id);
@ -265,13 +267,14 @@ function update_awardinfo()
function awardinfo_save()
{
$("#awardinfo_info").load("<?$_SERVER['PHP_SELF']?>?action=awardinfo_save", $("#awardinfo").serializeArray());
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=awardinfo_save", $("#awardinfo").serializeArray());
return 0;
}
function update_eligibility()
{
var id = award_id;
notice_div_id('eligibility_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibilty_load&id="+id,
function(json){
$("#eligibility_id").val(json.id);
@ -299,6 +302,7 @@ function prizelist_refresh()
function update_prizeinfo()
{
var id = award_id;
notice_div_id('prize_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+id,
function(json) {
$(".prizelist_tr").remove();
@ -343,13 +347,13 @@ function edit_prize(id)
function eligibility_save()
{
$("#eligibility_info").load("<?$_SERVER['PHP_SELF']?>?action=eligibility_save", $("#eligibility").serializeArray());
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=eligibility_save", $("#eligibility").serializeArray());
return 0;
}
function prize_save()
{
$("#prizeinfo_info").load("<?$_SERVER['PHP_SELF']?>?action=prize_save", $("#prizeinfo").serializeArray());
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=prize_save", $("#prizeinfo").serializeArray());
update_prizeinfo();
return 0;
}
@ -383,7 +387,7 @@ function prize_create()
function update_feeder()
{
var id = award_id;
notice_div_id('feeder_info');
notice_div_id('feeder_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+id,
function(json) {
$("#feeder_id").val(id);
@ -396,7 +400,7 @@ function update_feeder()
function feeder_save()
{
$("#feeder_info").load("<?$_SERVER['PHP_SELF']?>?action=feeder_save", $("#feeder_form").serializeArray());
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=feeder_save", $("#feeder_form").serializeArray());
return 0;
}
@ -447,7 +451,7 @@ $(document).ready(function() {
<div id="editor_tab_awardinfo">
<h4><?=i18n("Award Info")?></h4>
<div id="awardinfo_info"></div>
<div id="award_notice" class="notice_area"></div>
<form id="awardinfo">
<input type="hidden" name="id" id="awardinfo_id" value="0" />
<table class="tableedit">
@ -506,7 +510,7 @@ $(document).ready(function() {
<? /* Next Tab */ ?>
<div id="editor_tab_eligibility">
<h4><?=i18n("Eligibility")?></h4>
<div id="eligibility_info"></div>
<div id="eligibility_notice" class="notice_area"></div>
<form id="eligibility">
<input type="hidden" id="eligibility_id" name="id" value="" />
<table class="tableedit">
@ -542,7 +546,7 @@ $(document).ready(function() {
<? /* Next Tab */ ?>
<div id="editor_tab_prizes">
<div id="prizeinfo_info"></div>
<div id="prize_notice" class="notice_area"></div>
<h4><?=i18n("Prizes")?></h4>
<br />
<table id="prizelist" class="tableview">
@ -607,7 +611,7 @@ $(document).ready(function() {
<? /* Next Tab */ ?>
<div id="editor_tab_feeder">
<div style="position: fixed; display: hidden; border:1px" id="feeder_info"></div>
<div id="feeder_notice" class="notice_area"></div>
<h4><?=i18n("Feeder Fairs")?></h4>
<p><?=("Select which feeder fairs can download this award and upload winners.")?></p>
<form id="feeder_form">

View File

@ -602,6 +602,7 @@ if(substr($config['version'], -1) % 2 != 0)
}
echo "<a target=\"blank\" href=\"http://www.sfiab.ca\">SFIAB Version ".$config['version']."{$extra}</a>";
?>
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>"></div>
</div>
</body>

View File

@ -44,33 +44,33 @@ var _notice_div_id = 'notice_div';
function notice_delete(id)
{
$("notice_"+_notice_id).remove();
$("#notice_"+id).slideUp('slow', function() {
$("#notice_"+id).remove();
});
}
function notice_create(type,str,timeout)
{
_notice_id++;
var style="padding: 0.1em 0; text-align: center;";
$("#"+_notice_div_id).append("<div id=\"notice_"+_notice_id+"\" class=\""+type+"\" style=\""+style+"\">"+str+"</div><br />");
$("#"+_notice_div_id).fadeTo('fast', 0.75);
setTimeout(function() {
$("#notice_"+_notice_id).slideUp('slow', function() { notice_delete(_notice_id); });
}, timeout);
var style="padding: 0.1em 0; text-align: center; position: relative; ";
$("#"+_notice_div_id).append("<div id=\"notice_"+_notice_id+"\" class=\""+type+"\" style=\""+style+"\">"+str+"</div>");
$("#"+_notice_div_id).fadeTo('fast', 0.85);
$("#notice_"+_notice_id).effect('bounce');
setTimeout("notice_delete("+_notice_id+")", timeout);
}
function notice_div_id(id)
{
if(id == '') id = 'notice_div';
var par = $("#"+id).parent();
var o = par.offset();
var w = par.outerWidth();
// var h = par.outerHeight();
// $("#"+id).css( { "left": 0, "top": 0 } );
$("#"+id).css( { left: o.left+"px", top: o.top+"px" } );
$("#"+id).css( { width: w+"px"} );
$("#"+id).css( { left: o.left+"px", top: o.top+"px", width: w+"px"} );
// $("#"+id).css( { left: 0, top: 0, width: "100%" });
$("#"+id).show();
if(id == '') _notice_div_id = 'notice_div';
else _notice_div_id = id;
_notice_div_id = id;
}

View File

@ -331,6 +331,7 @@ tr.externalaward {
}
#FadeScreenDiv {
filter:alpha(opacity=50);
-moz-opacity:.50;
opacity:.50;
position: fixed;
@ -371,6 +372,10 @@ tr.externalaward {
padding: 2px;
}
div.notice_area {
position: fixed;
}
/* The popup windows created with jquery-ui use the following classes:
* div.ui-dialog
* div.ui-dialog-titlebar - includes the next 2 items in the div