From 1f830c78458fd9b49d5af69432f5a2d1f35ea43a Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 13 Sep 2009 08:33:54 +0000 Subject: [PATCH] - Proof of concept floating status messages that go away after a timeout, in the same approx. spot that SFIAB has always put status messages. --- admin/award_awards.php | 8 +++++--- common.inc.php | 6 ++++++ sfiab.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/admin/award_awards.php b/admin/award_awards.php index 7a1a471..121711e 100644 --- a/admin/award_awards.php +++ b/admin/award_awards.php @@ -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("?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() {
-
+

diff --git a/common.inc.php b/common.inc.php index 61417a0..5bdee62 100644 --- a/common.inc.php +++ b/common.inc.php @@ -1137,4 +1137,10 @@ function message_push($m) $_SESSION['messages'][] = $m; } +function happy_($str, $timeout=5000, $i18n_array=array()) +{ + echo ""; +} ?> diff --git a/sfiab.js b/sfiab.js index 888bf03..298ec9d 100644 --- a/sfiab.js +++ b/sfiab.js @@ -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("
"+str+"

"); + $("#"+_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() {