- Make the notice divs a bit easier to see (light yellow background)

- Don't reload tabs all the times, remember the current award_id for each tab
  and only reload if necessary
- Add a little notice for downloaded awards, telling the user why they can't edit some fields.
This commit is contained in:
dave 2009-09-20 18:45:32 +00:00
parent 5989a8c254
commit 1e1a7d6202
3 changed files with 56 additions and 13 deletions

View File

@ -251,9 +251,12 @@
<script type="text/javascript"> <script type="text/javascript">
var award_id = 0; var award_id = 0;
var award_tab_update = new Array();
function update_awardinfo() function update_awardinfo()
{ {
if(award_tab_update['awardinfo'] == award_id) return;
award_tab_update['awardinfo'] = award_id;
// alert(award_id); // alert(award_id);
if(award_id == -1) { if(award_id == -1) {
/* New award, set defaults and clear everythign else */ /* New award, set defaults and clear everythign else */
@ -281,6 +284,7 @@ function update_awardinfo()
function(json){ function(json){
$("#awardinfo_id").val(json.id); $("#awardinfo_id").val(json.id);
$("#awardinfo_name").val(json.name); $("#awardinfo_name").val(json.name);
$("#awardinfo_award_source_fairs_id").val(json.award_source_fairs_id);
$("#awardinfo_sponsors_id").val(json.sponsors_id); $("#awardinfo_sponsors_id").val(json.sponsors_id);
$("#awardinfo_presenter").val(json.presenter); $("#awardinfo_presenter").val(json.presenter);
$("#awardinfo_description").val(json.description); $("#awardinfo_description").val(json.description);
@ -300,6 +304,15 @@ function update_awardinfo()
$("#awardinfo_criteria").attr('disabled', 'disabled'); $("#awardinfo_criteria").attr('disabled', 'disabled');
} }
/* Update the dialog title */
$('#popup_editor').dialog('option', 'title', "<?=i18n('Award')?>: " + $('#awardinfo_name').val());
/* Update the status */
if($('#awardinfo_award_source_fairs_id').val() != 0) {
$('#popup_status').html("<?=addslashes(notice(i18n('This award was downloaded, some fields are not edittable')))?>");
} else {
$('#popup_status').html("");
}
}); });
} }
@ -328,6 +341,8 @@ function awardinfo_save()
function update_eligibility() function update_eligibility()
{ {
if(award_tab_update['eligibility'] == award_id) return;
award_tab_update['eligibility'] = award_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibilty_load&id="+award_id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=eligibilty_load&id="+award_id,
function(json){ function(json){
$("#eligibility_id").val(json.id); $("#eligibility_id").val(json.id);
@ -354,6 +369,10 @@ function prizelist_refresh()
function update_prizeinfo() function update_prizeinfo()
{ {
/* We can't do this filtering here, sometimes we need to fiorce
* a prizeinfo reload */
// if(award_tab_update['prizeinfo'] == award_id) return;
// award_tab_update['prizeinfo'] = award_id;
/* This also works for the prize template, id=-1 */ /* This also works for the prize template, id=-1 */
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+award_id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=prizeinfo_load&id="+award_id,
function(json) { function(json) {
@ -437,6 +456,8 @@ function prize_create()
function update_feeder() function update_feeder()
{ {
if(award_tab_update['feeder'] == award_id) return;
award_tab_update['feeder'] = award_id;
$.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+award_id, $.getJSON("<?=$_SERVER['PHP_SELF']?>?action=feeder_load&id="+award_id,
function(json) { function(json) {
$("#feeder_id").val(award_id); $("#feeder_id").val(award_id);
@ -495,12 +516,13 @@ $(document).ready(function() {
}); });
</script> </script>
<?
/* Begin popup */
echo "<div id=\"popup_editor\" title=\"Award Editor\" style=\"display: none\">";
<?
/* Begin popup */
?> ?>
<div id="popup_editor" title="Award Editor" style="display: none">
<div id="popup_status"></div>
<div id="editor_tabs"> <div id="editor_tabs">
<ul><li><a href="#editor_tab_awardinfo"><span><?=i18n('Award Info')?></span></a></li> <ul><li><a href="#editor_tab_awardinfo"><span><?=i18n('Award Info')?></span></a></li>
<li><a href="#editor_tab_eligibility"><span><?=i18n('Eligibility')?></span></a></li> <li><a href="#editor_tab_eligibility"><span><?=i18n('Eligibility')?></span></a></li>
@ -510,6 +532,11 @@ $(document).ready(function() {
<div id="editor_tab_awardinfo"> <div id="editor_tab_awardinfo">
<h4><?=i18n("Award Info")?></h4> <h4><?=i18n("Award Info")?></h4>
<form>
<?/* We dont' want to ever change this, but we want it's value, so put it in
* a form by itself */?>
<input type="hidden" name="award_source_fairs_id" id="awardinfo_award_source_fairs_id" value="0" />
</form>
<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">
@ -720,6 +747,9 @@ function popup_editor(id, mode)
var h = (document.documentElement.clientHeight * 0.8); var h = (document.documentElement.clientHeight * 0.8);
award_id = id; award_id = id;
/* We don't really need this, but we'll force all the tabs to reload on
* activation anyway */
award_tab_update = new Array();
/* Force no tabs to be selected, need to set collapsible /* Force no tabs to be selected, need to set collapsible
* to true first */ * to true first */
@ -744,11 +774,16 @@ function popup_editor(id, mode)
/* Don't let anything collapse */ /* Don't let anything collapse */
$('#editor_tabs').tabs('option', 'collapsible', false); $('#editor_tabs').tabs('option', 'collapsible', false);
/* Force an awardinfo update, there's some info in there that we want now */
update_awardinfo();
/* Show the dialog */ /* Show the dialog */
$('#popup_editor').dialog('option', 'width', w); $('#popup_editor').dialog('option', 'width', w);
$('#popup_editor').dialog('option', 'height', h); $('#popup_editor').dialog('option', 'height', h);
$("#popup_editor").dialog('open'); $("#popup_editor").dialog('open');
return true; return true;
} }

View File

@ -51,7 +51,7 @@ function notice_create(type,str,timeout)
{ {
if(timeout == -1) timeout = 5000; if(timeout == -1) timeout = 5000;
_notice_id++; _notice_id++;
$("#notice_area").append("<div id=\"notice_"+_notice_id+"\" class=\"notice "+type+"\" >"+str+"</div>"); $("#notice_area").append("<div id=\"notice_"+_notice_id+"\" class=\""+type+"\" >"+str+"</div>");
$("#notice_"+_notice_id).show('puff'); $("#notice_"+_notice_id).show('puff');
$("#notice_"+_notice_id).fadeTo('fast', 0.85); $("#notice_"+_notice_id).fadeTo('fast', 0.85);
setTimeout("notice_delete("+_notice_id+")", timeout); setTimeout("notice_delete("+_notice_id+")", timeout);

View File

@ -207,7 +207,8 @@ a:hover {
.notice { .notice {
font-weight: bold; font-weight: bold;
border: 1px solid Silver; border: 1px solid Silver;
background: #E0E0FF; /*background: #E0E0FF; */
background: #FFFFE0;
font-size: 1em; font-size: 1em;
} }
@ -323,23 +324,30 @@ div.notice_area {
z-index: 9999; z-index: 9999;
} }
div.notice_area div.notice { div.notice_area div {
padding: 0.1em 0; padding: 0.1em 0;
text-align: center; text-align: center;
position: relative; position: relative;
font-size: 1.5em; font-size: 1.5em;
background-color: #FFFFE0;
}
div.notice_area div.notice {
border: 3px solid yellow;
color: black;
background-color: #FFFFE0;
} }
div.notice_area div.error { div.notice_area div.error {
border: 3px solid red; border: 3px solid red;
color: red; color: red;
background-color: #FF9999; background-color: #FF9999;
} }
div.notice_area div.happy { div.notice_area div.happy {
border: 3px solid green; border: 3px solid green;
color: green; color: green;
background-color: #99FF99; background-color: #99FF99;
} }
/* The popup windows created with jquery-ui use the following classes: /* The popup windows created with jquery-ui use the following classes: