- Switch to a global message status area

This commit is contained in:
dave 2009-09-18 03:29:13 +00:00
parent de7d7eb4a7
commit 20fe1d8b13
4 changed files with 30 additions and 32 deletions

View File

@ -91,7 +91,7 @@
//now add the new ones //now add the new ones
if(!is_array($_POST['categories']) || !is_array($_POST['divisions'])) { if(!is_array($_POST['categories']) || !is_array($_POST['divisions'])) {
echo error(i18n("Invalid data")); error_("Invalid data");
exit; exit;
} }
@ -255,7 +255,6 @@ function update_awardinfo()
var id = award_id; var id = award_id;
if(!award_id) return false; if(!award_id) return false;
// alert("id="+award_id); // alert("id="+award_id);
notice_div_id('award_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=awardinfo_load&id="+id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=awardinfo_load&id="+id,
function(json){ function(json){
$("#awardinfo_id").val(json.id); $("#awardinfo_id").val(json.id);
@ -283,7 +282,6 @@ function awardinfo_save()
function update_eligibility() function update_eligibility()
{ {
var id = award_id; var id = award_id;
notice_div_id('eligibility_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibilty_load&id="+id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibilty_load&id="+id,
function(json){ function(json){
$("#eligibility_id").val(json.id); $("#eligibility_id").val(json.id);
@ -311,7 +309,6 @@ function prizelist_refresh()
function update_prizeinfo() function update_prizeinfo()
{ {
var id = award_id; var id = award_id;
notice_div_id('prize_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+id,
function(json) { function(json) {
$(".prizelist_tr").remove(); $(".prizelist_tr").remove();
@ -396,7 +393,6 @@ function prize_create()
function update_feeder() function update_feeder()
{ {
var id = award_id; var id = award_id;
notice_div_id('feeder_notice');
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+id,
function(json) { function(json) {
$("#feeder_id").val(id); $("#feeder_id").val(id);
@ -461,7 +457,6 @@ $(document).ready(function() {
<div id="editor_tab_awardinfo"> <div id="editor_tab_awardinfo">
<h4><?=i18n("Award Info")?></h4> <h4><?=i18n("Award Info")?></h4>
<div id="award_notice" class="notice_area"></div>
<form id="awardinfo"> <form id="awardinfo">
<input type="hidden" name="id" id="awardinfo_id" value="0" /> <input type="hidden" name="id" id="awardinfo_id" value="0" />
<table class="tableedit"> <table class="tableedit">
@ -520,7 +515,6 @@ $(document).ready(function() {
<? /* Next Tab */ ?> <? /* Next Tab */ ?>
<div id="editor_tab_eligibility"> <div id="editor_tab_eligibility">
<h4><?=i18n("Eligibility")?></h4> <h4><?=i18n("Eligibility")?></h4>
<div id="eligibility_notice" class="notice_area"></div>
<br /> <br />
<form id="eligibility"> <form id="eligibility">
<input type="hidden" id="eligibility_id" name="id" value="" /> <input type="hidden" id="eligibility_id" name="id" value="" />
@ -557,7 +551,6 @@ $(document).ready(function() {
<? /* Next Tab */ ?> <? /* Next Tab */ ?>
<div id="editor_tab_prizes"> <div id="editor_tab_prizes">
<div id="prize_notice" class="notice_area"></div>
<h4><?=i18n("Prizes")?></h4> <h4><?=i18n("Prizes")?></h4>
<br /> <br />
<table id="prizelist" class="tableview"> <table id="prizelist" class="tableview">
@ -622,7 +615,6 @@ $(document).ready(function() {
<? /* Next Tab */ ?> <? /* Next Tab */ ?>
<div id="editor_tab_feeder"> <div id="editor_tab_feeder">
<div id="feeder_notice" class="notice_area"></div>
<h4><?=i18n("Feeder Fairs")?></h4> <h4><?=i18n("Feeder Fairs")?></h4>
<form id="feeder_form"> <form id="feeder_form">
<input type="hidden" id="feeder_id" name="award_awards_id" value=""/> <input type="hidden" id="feeder_id" name="award_awards_id" value=""/>

View File

@ -394,6 +394,7 @@ if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config")
require_once("../translationseditor.inc.php"); require_once("../translationseditor.inc.php");
?> ?>
<div id="notice_area" class="notice_area"></div>
<div id="header"> <div id="header">
<? <?
if(file_exists($prependdir."data/logo-100.gif")) if(file_exists($prependdir."data/logo-100.gif"))
@ -1139,10 +1140,22 @@ function message_push($m)
$_SESSION['messages'][] = $m; $_SESSION['messages'][] = $m;
} }
function happy_($str, $timeout=5000, $i18n_array=array()) function notice_($str, $timeout=5000, $i18n_array=array(), $type='notice')
{ {
if($timeout == -1) $timeout = 5000;
echo "<script type=\"text/javascript\"> echo "<script type=\"text/javascript\">
notice_create('happy',\"".i18n($str,$i18n_array)."\",$timeout); notice_create('$type',\"".i18n($str,$i18n_array)."\",$timeout);
</script>"; </script>";
} }
function happy_($str, $timeout=5000, $i18n_array=array())
{
notice_($str, $timeout, $i18n_array, 'happy');
}
function error_($str, $timeout=5000, $i18n_array=array())
{
notice_($str, $timeout, $i18n_array, 'error');
}
?> ?>

View File

@ -40,8 +40,6 @@ function confirmChanges()
} }
var _notice_id = 0; var _notice_id = 0;
var _notice_div_id = 'notice_div';
function notice_delete(id) function notice_delete(id)
{ {
$("#notice_"+id).slideUp('slow', function() { $("#notice_"+id).slideUp('slow', function() {
@ -52,28 +50,12 @@ function notice_delete(id)
function notice_create(type,str,timeout) function notice_create(type,str,timeout)
{ {
_notice_id++; _notice_id++;
var style="padding: 0.1em 0; text-align: center; position: relative; "; $("#notice_area").append("<div id=\"notice_"+_notice_id+"\" class=\"notice "+type+"\" >"+str+"</div>");
$("#"+_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'); $("#notice_"+_notice_id).effect('bounce');
$("#notice_"+_notice_id).fadeTo('fast', 0.85);
setTimeout("notice_delete("+_notice_id+")", timeout); 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();
$("#"+id).css( { left: o.left+"px", top: o.top+"px", width: w+"px"} );
// $("#"+id).css( { left: 0, top: 0, width: "100%" });
$("#"+id).show();
_notice_div_id = id;
}
/* Stuff to do after the document loads */ /* Stuff to do after the document loads */
$(document).ready(function() $(document).ready(function()
{ {

View File

@ -314,9 +314,20 @@ tr.externalaward {
} }
/* Notice area floating along the top of the page */
div.notice_area { div.notice_area {
left: 0;
top: 0;
width: 100%;
position: fixed; position: fixed;
z-index: 9999;
}
div.notice_area div.notice {
padding: 0.1em 0;
text-align: center;
position: relative;
font-size: 1.2em;
} }
/* The popup windows created with jquery-ui use the following classes: /* The popup windows created with jquery-ui use the following classes: