Modified the info pop-up for judges in the team members editing form. The info now comes

up in a compact div within the page rather than a separate window.  When the info div is
clicked on, the user editor opens up that user.
This commit is contained in:
jacob 2010-04-13 20:11:15 +00:00
parent 21bb3ec994
commit 0cd172c48b
3 changed files with 215 additions and 131 deletions

View File

@ -40,104 +40,146 @@ $preferencechoices=array(
);
$id = intval($_GET['id']);
$id = intval($_GET['id']);
$judgeinfo = user_load($id);
echo '<div style="text-align:center; padding: 5px;">';
send_popup_header("Judge Information");
send_popup_header("Judge Information");
if($id < 1) {
echo error(i18n("No Judge ID passed to Judges Info"));
send_popup_footer();
exit;
}
$judgeinfo = user_load($id);
?>
<table class="tableview" style="margin:auto; width:100%; text-align:left">
<tr>
<th><?=i18n("First Name");?></th>
<th><?=i18n("Last Name");?></th>
<th><?=i18n("Organization");?></th>
</tr>
<tr>
<td><?=$judgeinfo['firstname'];?></td>
<td><?=$judgeinfo['lastname'];?></td>
<td><?=$judgeinfo['organization'];?></td>
</tr>
</table>
send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo['firstname'],$judgeinfo['lastname'])));
<table class="tableview" style="margin:auto; width:100%; margin-top: 5px; text-align:left">
<tr>
<th><?=i18n("Email Address");?>:</th>
<td><?=$judgeinfo['email'];?></td>
<th><?=i18n("City");?>:</th>
<td><?=$judgeinfo['city'];?></td>
</tr>
<tr>
<th><?=i18n("Phone (Home)");?>:</th>
<td><?=$judgeinfo['phonehome'];?></td>
<th><?=i18n("Address 1");?>:</th>
<td><?=$judgeinfo['address'];?></td>
</tr>
<tr>
<th><?=i18n("Phone (Work)");?>:</th>
<td><?=$judgeinfo['phonework'];?></td>
<th><?=i18n("Address 2");?>:</th>
<td><?=$judgeinfo['address2'];?></td>
</tr>
<tr>
<th><?=i18n("Phone (Cell)");?>:</th>
<td><?=$judgeinfo['phonecell'];?></td>
<th><?=i18n($config['provincestate']);?>:</th>
<td><?=$judgeinfo['province'];?></td>
</tr>
<tr>
<th><?=i18n("Languages");?>:</th>
<td><?=join(', ', $judgeinfo['languages']);?></td>
<th><?=i18n($config['postalzip']);?>:</th>
<td><?=$judgeinfo['postalcode'];?></td>
</tr>
</table>
echo "Complete for {$config['FAIRYEAR']}: ".(($judgeinfo['complete']=="yes") ? "Yes" : "No");
echo "<br />";
<?php
echo "<h3>".i18n("Personal Info")."</h3>";
echo "<table class=\"tableview\">\n";
echo "<tr>\n";
echo " <th align=\"right\">".i18n("First Name").": </th><td>{$judgeinfo['firstname']}</td>\n";
echo " <th align=\"right\">".i18n("Last Name").":</th><td>{$judgeinfo['lastname']}</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th align=\"right\">".i18n("Email Address").":</th><td>{$judgeinfo['email']}</td>\n";
echo " <th align=\"right\">".i18n("City").":</th><td>{$judgeinfo['city']}</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th align=\"right\">".i18n("Address 1").":</th><td>{$judgeinfo['address']}</td>\n";
echo " <th align=\"right\">".i18n($config['provincestate']).": </th><td>{$judgeinfo['province']}</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th align=\"right\">".i18n("Address 2").":</th><td>{$judgeinfo['address2']}</td>\n";
echo " <th align=\"right\">".i18n("Phone (Home)").":</th><td>{$judgeinfo['phonehome']}</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <th align=\"right\">".i18n($config['postalzip']).":</th><td>{$judgeinfo['postalcode']}</td>\n";
echo " <th align=\"right\">".i18n("Phone (Work)").":</th><td>{$judgeinfo['phonework']}</td>\n";
echo "</tr>";
echo "<tr>\n";
echo " <th align=\"right\">".i18n("Organization").":</th><td>{$judgeinfo['organization']}</td>\n";
echo " <th align=\"right\">".i18n("Phone (Cell)").":</th><td>{$judgeinfo['phonecell']}</td>\n";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "</table>";
echo "<table>";
echo "<tr>\n";
echo " <th valign=\"top\" align=\"right\" colspan=\"2\">".i18n("Time Availability").":</th><td colspan=\"2\">";
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"{$judgeinfo['id']}\" ORDER BY `start`");
$sel = array();
while($r=mysql_fetch_object($q)) {
$st = substr($r->start, 0, 5);
$end = substr($r->end, 0, 5);
echo "$st - $end<br />";
// get their availability
$availabilityText = "";
if($config['judges_availability_enable'] == 'yes'){
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"{$judgeinfo['id']}\" ORDER BY `start`");
$sel = array();
while($r=mysql_fetch_object($q)) {
$st = substr($r->start, 0, 5);
$end = substr($r->end, 0, 5);
$availabilityText .= "<li>$st - $end</li>";
}
if(strlen($availabilityText) > 0){
$availabilityText = '<ul>' . $availabilityText . '</ul>';
}else{
$availabilityText = i18n("Unspecified");
}
}
echo "</td></tr>";
echo "<tr>";
echo " <th valign=\"top\" align=\"right\" colspan=\"2\">".i18n("Age category preference").":</th><td colspan=\"2\">";
echo '<div style="text-align:left">';
$q=mysql_query("SELECT * FROM projectcategories
WHERE year='{$config['FAIRYEAR']}'");
echo mysql_error();
// is their info complete?
$completeText = $judgeinfo['complete']=="yes" ? "Yes" : "No";
// find out if they've signed up for judging any special awards
$specialAwardsText = "";
if($judgeinfo['special_award_only'] == "yes"){
$query = "SELECT aa.name AS awardname FROM judges_specialaward_sel jss"
. " JOIN users ON jss.users_id = users.id"
. " JOIN award_awards aa ON aa.id = jss.award_awards_id"
. " WHERE users.id=" . $id;
$results = mysql_query($query);
while($record = mysql_fetch_array($results)){
$awardList[] = $record['awardname'];
}
$specialAwardsText .= implode(', ', $awardList);
}else{
$specialAwardsText .= i18n("None");
}
// get their preference for age category
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}'");
$catPreferenceText = mysql_error() . "<ul>";
while($r=mysql_fetch_object($q)) {
$p = intval($judgeinfo['cat_prefs'][$r->id]);
echo i18n($r->category).": {$preferencechoices[$p]}<br />";
$catPreferenceText .= "<li><em>" . i18n($r->category)."</em>: {$preferencechoices[$p]}</li>";
}
$catPreferenceText .= "</ul>";
echo "</td>\n";
echo "</tr>\n";
?>
echo "</td>\n";
echo "</tr>\n";
<table class="tableview" style="margin:auto; width:100%; text-align:left; margin-top:5px;">
<tr><td>
<ul>
echo "<tr>\n";
echo " <th align=\"right\" colspan=\"2\">".i18n("Highest post-secondary degree").":</th>";
echo " <td colspan=\"2\">{$judgeinfo['highest_psd']}</td>\n";
echo "</tr>\n";
<li><strong><?="Complete for {$config['FAIRYEAR']}";?>: </strong>
<?=$completeText;?></li>
echo "<tr>\n";
echo " <th align=\"right\" colspan=\"2\" valign=\"top\">".i18n("Languages").":</th>";
echo " <td colspan=\"2\">".join(', ', $judgeinfo['languages']). "<br />";
echo " </td>\n";
echo "</tr>\n";
<li><strong><?=i18n("Special awards");?>: </strong>
<?=$specialAwardsText;?></li>
//questions_print_answers('judgereg',$judgeinfo['id'], $config['FAIRYEAR']);
<li><strong><?=i18n("Highest post-secondary degree");?>: </strong>
<?=$judgeinfo['highest_psd'];?></li>
echo "</table>";
<li><strong><?=i18n("Age category preference");?>: </strong>
<?=$catPreferenceText;?></li>
echo "<hr />";
echo "<br />";
echo "<h3>Areas of Expertise</h3>";
echo "<table class=\"tableview\">";
<?php
if($availabilityText != ""){
echo "<li><strong>" . i18n("Time Availability") . ": </strong>";
echo $availabilityText . "</li>";
}
?>
</ul>
</td>
<td>
<h3><?=i18n("Areas of Expertise");?></h3>
<table class="tableview" style="margin:auto;width:100%">
<?php
//grab the list of divisions, because the last fields of the table will be the sub-divisions
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
@ -148,32 +190,6 @@ while($r=mysql_fetch_object($q))
$divnames[$r->id]=$r->division;
}
/*
$subdivq=mysql_query("SELECT judges_expertise.*,
projectsubdivisions.subdivision,
projectsubdivisions.projectdivisions_id AS parent_id
FROM judges_expertise
LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id
WHERE judges_id='{$judgeinfo['id']}'
AND judges_expertise.year='".$config['FAIRYEAR']."'
ORDER BY projectdivisions_id, projectsubdivisions_id");
echo mysql_error();
$judge_divs=array();
$judge_subdivs=array();
$divdata=array();
*/
/*
while($subdivr=mysql_fetch_object($subdivq))
{
if($subdivr->projectdivisions_id)
{
$judge_divs[$subdivr->projectdivisions_id]=$subdivr->val;
}
else
$judge_subdivs[$subdivr->parent_id][]=$subdivr->subdivision;
}
*/
foreach($divs as $div)
{
$p = $judgeinfo['div_prefs'][$div];
@ -190,7 +206,7 @@ foreach($divs as $div)
}
}
/* Only show subdiv if main div >=3 */
// Only show subdiv if main div >=3
if($p >= 3) echo implode(", ",$sd);
else echo "&nbsp;";
@ -202,13 +218,36 @@ echo " <th align=\"right\" valign=\"top\">".i18n("Other").":</th>";
echo " <td colspan=\"2\">{$judgeinfo['expertise_other']}<br />";
echo " </td>\n";
echo "</tr>\n";
echo "</table>";
send_popup_footer();
?>
</table>
</td></tr>
</table>
<?php
// get the judge's special award info
//print_r($judgeinfo);
echo '</div></div>';
/*
send_popup_header("Judge Information");
*/
/*
echo "<tr>\n";
echo " <th valign=\"top\" align=\"right\" colspan=\"2\">".i18n("Time Availability").":</th><td colspan=\"2\">";
$q = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"{$judgeinfo['id']}\" ORDER BY `start`");
$sel = array();
while($r=mysql_fetch_object($q)) {
$st = substr($r->start, 0, 5);
$end = substr($r->end, 0, 5);
echo "$st - $end<br />";
}
echo "</td></tr>";
echo "<tr>";
*/
//send_popup_footer();
?>

View File

@ -41,17 +41,6 @@ function addbuttonclicked(team)
document.forms.judges.submit();
}
function openjudgeinfo(id)
{
if(id)
currentid=id;
else
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;
window.open("judges_info.php?id="+currentid,"JudgeInfo","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
}
function switchjudgeinfo()
{
if(document.forms.judges["judgelist[]"].selectedIndex != -1)
@ -71,8 +60,50 @@ function switchjudgeinfo()
}
</script>
var mousex = 0, mousey = 0;
var selectedMemberId;
function showMemberDetails(judgeId){
if(judgeId == undefined){
judgeId = document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;
}
$('#infodiv').load("judges_info.php?id=" + judgeId,
function(){ eval('doShowMemberDetails(' + judgeId + ');'); }
);
}
function editMember(memberId){
if(memberId == undefined) memberId = selectedMemberId;
hideMemberDetails();
window.open("user_editor_window.php?id="+memberId,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
}
function hideMemberDetails(){
$('#infodiv').css("display", "none");
$('#infodivcover').css("display", "none");
}
function doShowMemberDetails(judgeId){
selectedMemberId = judgeId;
$('#infodiv').css("top", mousey + 5);
$('#infodiv').css("left", mousex + 20);
$('#infodiv').css("display", "inline");
$('#infodivcover').css("top", mousey + 5);
$('#infodivcover').css("left", mousex + 20);
$('#infodivcover').css("display", "inline");
$('#infodivcover').css("width", $('#infodiv').width());
$('#infodivcover').css("height", $('#infodiv').height());
}
jQuery(document).ready(function(){
$('#infodivcover').click(function(){ editMember(); });
$(document).mousemove(function(e){
mousex = e.pageX;
mousey = e.pageY;
});
});
</script>
<?
if($_POST['action']=="add" && $_POST['team_num'] && count($_POST['judgelist'])>0)
@ -216,7 +247,7 @@ function switchjudgeinfo()
echo "<tr>";
echo "<th>".i18n("Judges List");
echo "<br />";
echo "<input disabled=\"true\" name=\"judgeinfobutton\" id=\"judgeinfobutton\" onclick=\"openjudgeinfo()\" type=\"button\" value=\"".i18n("Judge Info")."\">";
echo "<input disabled=\"true\" name=\"judgeinfobutton\" id=\"judgeinfobutton\" onclick=\"showMemberDetails()\" type=\"button\" value=\"".i18n("Judge Info")."\">";
echo "</th>";
echo "<th>".i18n("Judge Teams")."</th>";
echo "</tr>";
@ -268,7 +299,7 @@ function switchjudgeinfo()
echo "<br />";
echo "</center>";
echo mysql_error();
echo "<select name=\"judgelist[]\" onchange=\"switchjudgeinfo()\" multiple=\"multiple\" style=\"width: 250px; height: 600px;\">";
echo "<select name=\"judgelist[]\" onchange=\"switchjudgeinfo()\" multiple=\"multiple\" style=\"width: 220px; height: 600px;\">";
foreach($jlist as $jid) {
$u = &$judgelist[$jid];
@ -329,7 +360,7 @@ function switchjudgeinfo()
echo "</a>&nbsp;";
}
echo "<a href=\"\" onclick=\"return openjudgeinfo(".$member['id'].");\">";
echo "<a onclick=\"showMemberDetails(" . $member['id'] . ");\">";
echo $member['firstname']." ".$member['lastname'];
if(is_array($j['languages']))
$l = is_array($j['languages']) ? join(' ',$j['languages']) : '';
@ -363,6 +394,19 @@ function switchjudgeinfo()
echo "</td></tr>";
echo "</table>";
echo "</form>";
echo '<div id="infodiv" style="background-color: #DDF; border:solid;'
. ' border-width:1px;'
. ' border-color: #000;'
. ' position:absolute;'
. ' top: 0px; left:0px;'
. ' overflow:hidden; display:none;"'
. '></div>';
echo '<div id="infodivcover" style="'
. ' position:absolute;'
. ' display:none;"'
. ' onmouseout="hideMemberDetails();"'
. '></div>';
send_footer();

View File

@ -89,15 +89,16 @@
"user_personal.php", "user_personal_info_status", array($u));
user_page_summary_item("Other Information",
"judge_other.php", "judge_status_other", array($u));
user_page_summary_item("Areas of Expertise",
"judge_expertise.php", "judge_status_expertise", array($u));
if($config['judges_specialaward_enable'] != 'yes' || $u['special_award_only'] != 'yes') {
user_page_summary_item("Areas of Expertise",
"judge_expertise.php", "judge_status_expertise", array($u));
}
if($config['judges_availability_enable'] == 'yes') {
user_page_summary_item("Time Availability",
"judge_availability.php", "judge_status_availability", array($u));
}
if($config['judges_specialaward_enable'] == 'yes' || $u['special_award_only'] == 'yes') {
if($config['judges_specialaward_enable'] == 'yes' && $u['special_award_only'] == 'yes') {
user_page_summary_item("Special Award Preferences",
"judge_special_awards.php", "judge_status_special_awards", array($u));
}