Make the status on the judge other and judge expertise pages work.

A few updates for consistency when embedded in the editor popup
This commit is contained in:
james 2009-11-26 19:09:37 +00:00
parent dbad8ae320
commit 2e65273b97
3 changed files with 47 additions and 26 deletions

View File

@ -72,11 +72,20 @@ case 'save':
} }
user_save($u); user_save($u);
happy_("Preferences successfully saved"); happy_("Preferences successfully saved");
//reload the user record because we dont know if we saved or didnt save above, we just want
//to know what the user looks like _now_
$u = user_load($eid);
$newstatus=judge_status_expertise($u);
echo "<script type=\"text/javascript\">";
echo "expertise_update_status('$newstatus');\n";
echo "</script>\n";
exit; exit;
} }
if($_SESSION['embed'] == true) { if($_SESSION['embed'] == true) {
echo "<br /><h3>".i18n("Judging Expertise")."</h3>";
display_messages(); display_messages();
} else { } else {
//send the header //send the header
@ -85,6 +94,7 @@ case 'save':
); );
} }
$newstatus=judge_status_expertise($u);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function judgeexpertise_save() function judgeexpertise_save()
@ -92,20 +102,24 @@ function judgeexpertise_save()
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_expertise.php?action=save", $("#judgeexpertise_form").serializeArray()); $("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_expertise.php?action=save", $("#judgeexpertise_form").serializeArray());
return false; return false;
} }
function expertise_update_status(s) {
if(s!='complete') {
$("#expertise_info_status").html('<?=error(i18n("Divisional Judging Information Incomplete"))?>');
}
else
$("#expertise_info_status").html('<?=happy(i18n("Divisional Judging Information Complete"))?>');
}
//when we're ready, output the status
$(document).ready( function() { expertise_update_status('<?=$newstatus?>');});
</script> </script>
<? <?
judge_status_update($u); judge_status_update($u);
if($_SESSION['embed'] != true) { echo "<div id=\"expertise_info_status\"></div>\n";
//output the current status
$newstatus=judge_status_expertise($u);
if($newstatus!="complete")
echo error(i18n("Divisional Judging Information Incomplete"));
else
echo happy(i18n("Divisional Judging Information Complete"));
}
if($u['special_award_only'] == 'yes') { if($u['special_award_only'] == 'yes') {
echo i18n("You have specified that you are a judge for a specific special award. Divisional Judging preferences have been disabled because they do not apply to you."); echo i18n("You have specified that you are a judge for a specific special award. Divisional Judging preferences have been disabled because they do not apply to you.");
@ -114,13 +128,12 @@ if($_SESSION['embed'] != true) {
exit; exit;
} }
echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n"; echo "<form name=\"expertiseform\" id=\"judgeexpertise_form\">\n";
echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n"; echo "<input type=\"hidden\" name=\"users_id\" value=\"{$u['id']}\">\n";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade"); $q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY mingrade");
echo "<h4>".i18n("Age Category Preferences")."</h4><br>"; echo "<br /><h4>".i18n("Age Category Preferences")."</h4><br>";
echo "<table class=\"editor\" >"; echo "<table class=\"editor\" style=\"width: 300px;\" >";
while($r=mysql_fetch_object($q)) while($r=mysql_fetch_object($q))
{ {
echo "<tr><td class=\"label\" >"; echo "<tr><td class=\"label\" >";

View File

@ -61,13 +61,19 @@ case 'save':
user_save($u); user_save($u);
questions_save_answers("judgereg",$u['id'],$_POST['questions']); questions_save_answers("judgereg",$u['id'],$_POST['questions']);
happy_("Preferences successfully saved"); happy_("Preferences successfully saved");
$u=user_load($eid);
$newstatus=judge_status_other($u);
echo "<script type=\"text/javascript\">";
echo "other_update_status('$newstatus');\n";
echo "</script>\n";
exit; exit;
} }
if($_SESSION['embed'] == true) { if($_SESSION['embed'] == true) {
echo "<br />"; echo "<br />";
display_messages(); display_messages();
echo "<h4>".i18n('Other Information')."</h4>"; echo "<h3>".i18n('Other Information')."</h3>";
echo "<br />"; echo "<br />";
} else { } else {
//send the header //send the header
@ -76,6 +82,7 @@ case 'save':
); );
} }
$newstatus=judge_status_other($u);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function judgeother_save() function judgeother_save()
@ -83,22 +90,23 @@ function judgeother_save()
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_other.php?action=save", $("#judgeother_form").serializeArray()); $("#debug").load("<?=$config['SFIABDIRECTORY']?>/judge_other.php?action=save", $("#judgeother_form").serializeArray());
return false; return false;
} }
</script>
<?
judge_status_update($u); function other_update_status(s) {
if(s!='complete') {
if($_SESSION['embed'] != true) { $("#other_info_status").html('<?=error(i18n("Other Information Incomplete"))?>');
//output the current status }
$newstatus=judge_status_other($u); else
if($newstatus!="complete") $("#other_info_status").html('<?=happy(i18n("Other Information Complete"))?>');
echo error(i18n("Other Information Incomplete"));
else
echo happy(i18n("Other Information Complete"));
} }
?> //when we're ready, output the status
$(document).ready( function() { other_update_status('<?=$newstatus?>');});
</script>
<?
judge_status_update($u);
echo "<div id=\"other_info_status\"></div>\n";
?>
<form name="otherform" id="judgeother_form"> <form name="otherform" id="judgeother_form">
<input type="hidden" name="users_id" value="<?=$u['id']?>"> <input type="hidden" name="users_id" value="<?=$u['id']?>">
<table class="editor"> <table class="editor">

View File

@ -59,7 +59,7 @@ case 'save':
if($_SESSION['embed'] == true) { if($_SESSION['embed'] == true) {
display_messages(); display_messages();
echo "<h4>".i18n('Special Awards')."</h4>"; echo "<br /><h3>".i18n('Special Awards')."</h3>";
echo "<br />"; echo "<br />";
} else { } else {
//send the header //send the header