- Proof of concept floating status messages that go away after a timeout, in

the same approx. spot that SFIAB has always put status messages.
This commit is contained in:
dave 2009-09-13 08:33:54 +00:00
parent e9d3d4ce03
commit 1f830c7845
3 changed files with 46 additions and 3 deletions

View File

@ -206,7 +206,7 @@
exit;
case 'feeder_save':
print_r($_POST);
// 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();
@ -226,7 +226,7 @@
VALUES ('$id','$fairs_id','$dl','$ul')");
echo mysql_error();
}
alert(happy, "Saved");
happy_("Saved");
exit;
}
@ -383,6 +383,7 @@ function prize_create()
function update_feeder()
{
var id = award_id;
notice_div_id('feeder_info');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+id,
function(json) {
$("#feeder_id").val(id);
@ -390,6 +391,7 @@ function update_feeder()
$("[name=feeder_ul\\[\\]]").val(json.ul);
});
}
function feeder_save()
@ -605,7 +607,7 @@ $(document).ready(function() {
<? /* Next Tab */ ?>
<div id="editor_tab_feeder">
<div id="feeder_info"></div>
<div style="position: fixed; display: hidden; border:1px" id="feeder_info"></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

@ -1137,4 +1137,10 @@ function message_push($m)
$_SESSION['messages'][] = $m;
}
function happy_($str, $timeout=5000, $i18n_array=array())
{
echo "<script type=\"text/javascript\">
notice_create('happy',\"".i18n($str,$i18n_array)."\",$timeout);
</script>";
}
?>

View File

@ -39,6 +39,41 @@ function confirmChanges()
return true;
}
var _notice_id = 0;
var _notice_div_id = 'notice_div';
function notice_delete(id)
{
$("notice_"+_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);
}
function notice_div_id(id)
{
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).show();
if(id == '') _notice_div_id = 'notice_div';
else _notice_div_id = id;
}
/* Stuff to do after the document loads */
$(document).ready(function()
{