A working user editor. It uses the same pages that the user actually sees (via

a $_SESSION['embed'] variable to change the behaviour).  It uses tabs to switch
between the various sections.  Converted committee, volunteer, and judge
editor.  Relies on using a popup window, don't know if that's a good idea or
not, but it sure looks cool.
This commit is contained in:
dave 2009-01-19 23:33:54 +00:00
parent 27f40a0fc9
commit 9c40cc91f8
17 changed files with 647 additions and 332 deletions

View File

@ -41,17 +41,13 @@ if($_POST['users_id'])
exit; exit;
} }
if($_POST['action'] == 'edit') {
header("location: {$config['SFIABDIRECTORY']}/user_personal.php?edit=$uid");
exit;
}
/* Now, start the output for this page */ /* Now, start the output for this page */
send_header("Committee Management", send_header("Committee Management",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php' ), 'Administration' => 'admin/index.php' ),
"committee_management"); "committee_management");
$_SESSION['last_page'] = 'committee_management'; $_SESSION['last_page'] = 'committee_management';
?> ?>
@ -59,6 +55,17 @@ if($_POST['users_id'])
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function openeditor(id)
{
currentid=id;
/* else
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;*/
window.open("user_editor_window.php?id="+currentid,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
}
function getElement(e,f) function getElement(e,f)
{ {
if(document.layers) if(document.layers)
@ -105,10 +112,18 @@ function actionSubmit()
return false; return false;
} }
if(document.forms.memberaction.action.selectedIndex == 2) {
// Edit
var id = document.forms.memberaction.users_id.options[document.forms.memberaction.users_id.selectedIndex];
openeditor(id.value);
// alert("id="+id.value);
return false;
}
if(document.forms.memberaction.action.selectedIndex==3) //remove if(document.forms.memberaction.action.selectedIndex==3) //remove
{ {
return confirmClick('Are you sure you want to completely remove this member?'); return confirmClick('Are you sure you want to completely remove this member?');
} }
return true; return true;
} }
//--> //-->
@ -335,7 +350,7 @@ if($_POST['add_member_to_committees_id'])
while($r2=mysql_fetch_object($q2)) while($r2=mysql_fetch_object($q2))
{ {
echo "<tr><td align=\"right\">&nbsp;&nbsp;&nbsp;&nbsp;"; echo "<tr><td align=\"right\">&nbsp;&nbsp;&nbsp;&nbsp;";
echo "<a title=\"Edit Member\" href=\"{$config['SFIABDIRECTORY']}/user_personal.php?edit={$r2->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\" border=\"0\" alt=\"Edit\" /></a>"; echo "<a title=\"Edit Member\" href=\"#\" onclick=\"openeditor($r2->id)\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/edit.{$config['icon_extension']}\" border=\"0\" alt=\"Edit\" /></a>";
echo "&nbsp;"; echo "&nbsp;";
echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember=$r2->id&amp;unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>"; echo "<a title=\"Unlink Member from Committee\" onclick=\"return confirmClick('Are you sure you want to unlink this member from this committee?');\" href=\"committees.php?unlinkmember=$r2->id&amp;unlinkcommittee={$r->id}\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/undo.{$config['icon_extension']}\" border=\"0\" alt=\"Unlink\" /></a>";
echo "</td>"; echo "</td>";

View File

@ -34,8 +34,7 @@
echo "<br />"; echo "<br />";
echo '<b>'.i18n('Judges').'</b><ul>'; echo '<b>'.i18n('Judges').'</b><ul>';
echo "<li><a href=\"../user_invite.php?type=judge\">".i18n("Invite Judges")."</a></li></li>"; echo "<li><a href=\"../user_invite.php?type=judge\">".i18n("Invite Judges")."</a></li></li>";
echo "<li><a href=\"judges_manager.php\">".i18n("Manage Judges")."</a> - ".i18n("Add, Delete, Edit, and List judges").'</li>'; echo "<li><a href=\"user_list.php?show_types[]=judge\">".i18n("Manage Judges")."</a> - ".i18n("Add, Delete, Edit, and List judges").'</li>';
echo "<li><a href=\"judges_judges.php\">".i18n("List Judges")."</a></li>";
echo '</ul>'; echo '</ul>';
echo '<b>'.i18n('Create the Judging Schedule').'</b><ul>'; echo '<b>'.i18n('Create the Judging Schedule').'</b><ul>';
echo "<li><a href=\"judges_timeslots.php\">".i18n("Create/Edit Judging Timeslots")."</a></li>"; echo "<li><a href=\"judges_timeslots.php\">".i18n("Create/Edit Judging Timeslots")."</a></li>";

View File

@ -1,132 +0,0 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
include "judges.inc.php";
send_header("Judge List",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php')
);
?>
<script language="javascript" type="text/javascript">
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;
}
</script>
<?
if($_GET['action']=="remove" && $_GET['remove'])
{
//we need to remove them from:
// judges_teams
// judges_years
mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_GET['remove']."' AND year=".$config['FAIRYEAR']."'");
mysql_query("DELETE FROM judges_years WHERE judges_id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'");
echo happy(i18n("Successfully removed judge from this year's fair"));
}
echo "<h3>".i18n("Active Judges list for %1",array($config['FAIRYEAR']))."</h3>";
echo "<table class=\"viewtable\">";
$querystr="SELECT
judges.id,
judges.firstname,
judges.lastname,
judges.email,
judges.complete,
judges_years.year
FROM
judges
JOIN judges_years ON judges.id=judges_years.judges_id
WHERE
judges_years.year='".$config['FAIRYEAR']."'
AND judges.deleted='no'
ORDER BY
lastname,
firstname";
$q=mysql_query($querystr);
$num=mysql_num_rows($q);
echo i18n("Listing %1 judges total. See the bottom for breakdown of judges by complete status",array($num),array("the number of judges"));
echo mysql_error();
echo "<tr>";
echo " <th>".i18n("Judge Name")."</th>";
echo " <th>".i18n("Email Address")."</th>";
echo " <th>".i18n("Complete")."</th>";
echo " <th>".i18n("Actions")."</th>";
echo "</tr>";
$completeyes=0;
$completeno=0;
while($r=mysql_fetch_object($q))
{
echo "<tr><td>";
echo "<a href=\"\" onclick=\"return openjudgeinfo($r->id)\">$r->firstname $r->lastname</a>";
echo "</td>";
echo "<td>$r->email</td>";
if($r->complete=="yes" && $r->year)
{
echo "<td class=\"happy\" align=\"center\">".i18n("yes")."</td>";
$completeyes++;
}
else
{
echo "<td class=\"error\" align=\"center\">".i18n("no")."</td>";
$cl="error";
$completeno++;
}
echo "<td align=\"center\">";
echo "<a onclick=\"return confirmClick('Are you sure you want to deactivate this judge from this years fair?')\" href=\"judges_judges.php?action=remove&remove=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo i18n("Note: Deleting judges from this list only deactivates the judge for this year's fair. To completely delete a judge, use the 'Manage Judges' page");
echo "<br />";
echo "<br />";
echo i18n("There are %1 total active judges.",array($num),array("the number of judges"));
echo "<br />";
echo i18n("There are %1 complete judges.",array($completeyes),array("the number of judges"));
echo "<br />";
echo i18n("There are %1 incomplete judges.",array($completeno),array("the number of judges"));
echo "<br />";
echo "<br />";
echo "<br />";
send_footer();
?>

View File

@ -1,100 +0,0 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
include "judges.inc.php";
require("../tableeditor.class.php");
require("../judge.class.php");
send_header("Judge Manager",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php',
'Judges' => 'admin/judges.php') );
?>
<script language="javascript" type="text/javascript">
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;
}
</script>
<?
$icon_path = $config['SFIABDIRECTORY']."/images/16/";
$icon_exitension = $config['icon_extension'];
print("<br />");
if(isset($_GET['show_what'])) {
$_SESSION['judgesmanager_show_what']=$_GET['show_what'];
}
if($_SESSION['judgesmanager_show_what']) {
$show_what = $_SESSION['judgesmanager_show_what'];
} else {
$show_what = "cy_complete";
}
print("<form name=\"ShowJudges\" method=\"get\" action=\"{$_SERVER['PHP_SELF']}\">");
print("<select id=\"show_what\" name=\"show_what\">");
$s = ($show_what == 'all') ? " selected=\"selected\" " : "";
print("<option value=\"all\" $s>All Judges</option>");
$s = ($show_what == 'cy_active') ? " selected=\"selected\" " : "";
print("<option value=\"cy_active\" $s>All {$config['FAIRYEAR']} Judges (complete and incomplete)</option>");
$s = ($show_what == 'cy_complete') ? " selected=\"selected\" " : "";
print("<option value=\"cy_complete\" $s>All {$config['FAIRYEAR']} Judges (only complete)</option>");
print("</select>");
print("<input type=submit value=\"".i18n("Show")."\">");
print("</form>");
// echo i18n("Note: Deleting a judge from this screen only unlinks them from the current fairyear");
$editor = new TableEditor('judge');
// $editor->setDebug(true);
switch($show_what) {
case "all":
$editor->setOption('judges_show_what', 'all');
break;
case "cy_active":
$editor->setOption('judges_show_what', 'current_year_active');
break;
case "cy_complete":
$editor->setOption('judges_show_what', 'current_year_complete');
break;
}
$editor->execute();
send_footer();
?>

View File

@ -0,0 +1,100 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
$tabs = array('personal' => array(
'name' => 'Personal',
'types' => array('student','judge','committee','volunteer'),
'file' => '../user_personal.php',
),
'judgeother' => array(
'name' => 'Judge Other',
'types' => array('judge'),
'file' => '../judge_other.php',
),
'judgeexpertise' => array(
'name' => 'Expertise',
'types' => array('judge'),
'file' => '../judge_expertise.php',
),
'judgesa' => array(
'name' => 'Special Awards',
'types' => array('judge'),
'file' => '../judge_special_awards.php',
),
'volunteerpos' => array(
'name' => 'Volunteer Positions',
'types' => array('volunteer'),
'file' => '../volunteer_position.php',
),
);
$selected = $_GET['tab'];
if(!array_key_exists($selected, $tabs)) $selected = 'personal';
$id = $_GET['id'];
$u = user_load($id);
send_popup_header(i18n("User Editor").": {$u['name']}");
?>
<link rel="stylesheet" type="text/css" href="<?=$config['SFIABDIRECTORY']?>/htabs.css" />
<?
echo '<ul id="htabs">';
foreach($tabs as $k=>$t) {
$i = array_intersect($t['types'], $u['types']);
if(count($i) == 0) continue;
$sel = ($selected == $k) ? 'htabsel' : '';
$href = "$PHP_SELF?id=$id&tab=$k";
echo "<li class=\"$sel\"><a href=\"$href\">".i18n($t['name'])."</a></li>";
}
echo '</ul>';
$t = $tabs[$selected];
/* Setup some things */
$_SESSION['embed'] = true;
$_SESSION['embed_submit_url'] = "{$_SERVER['PHP_SELF']}?id=$id&tab=$selected";
$_SESSION['embed_edit_id'] = $id;
echo '<div id="htabmain">';
include("{$t['file']}");
echo '</div>';
unset($_SESSION['embed']);
unset($_SESSION['embed_edit_id']);
unset($_SESSION['embed_submit_url']);
$icon_path = $config['SFIABDIRECTORY']."/images/16/";
$icon_exitension = $config['icon_extension'];
send_popup_footer();
?>

225
admin/user_list.php Normal file
View File

@ -0,0 +1,225 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("../common.inc.php");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
include "judges.inc.php";
send_header("User Editor",
array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php')
);
?>
<script language="javascript" type="text/javascript">
function openeditor(id)
{
if(id)
currentid=id;
/* else
currentid=document.forms.judges["judgelist[]"].options[document.forms.judges["judgelist[]"].selectedIndex].value;*/
window.open("user_editor_window.php?id="+currentid,"User Editor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
return false;
}
function toggleoptions()
{
if(document.getElementById('options').style.display == 'none') {
document.getElementById('options').style.display = 'block';
document.getElementById('optionstext').innerHTML = '- <?=i18n('Hide Display Options')?>';
} else {
document.getElementById('options').style.display = 'none';
document.getElementById('optionstext').innerHTML = '+ <?=i18n('Show Display Options')?>';
}
}
</script>
<?
$show_types = $_GET['show_types'];
if(user_valid_type($show_types) == false) {
$show_types = array('judge');
}
$show_complete = ($_GET['show_complete'] == 'yes') ? 'yes' : 'no';
$show_year = ($_GET['show_year'] == 'all') ? 'all' : 'current';
$uid = intval($_GET['uid']);
if($_GET['action']=='remove') {
if(!$uid) {
echo "Invalid uid for delete";
exit;
}
user_delete($uid);
}
echo "<div class=\"notice\">";
echo "<a id=\"optionstext\" href=\"javascript:toggleoptions()\">- ".i18n('Hide Display Options')."</a>";
echo "<form method=\"GET\" action=\"$PHP_SELF\">";
echo "<div id=\"options\" style=\"display: block;\" >";
echo "<table><tr><td>".i18n('Type').":</td>";
$x = 0;
foreach($user_what as $k=>$v ) {
$sel = (in_array($k, $show_types)) ? 'checked="checked"' : '';
echo "<td><input type=\"checkbox\" name=\"show_types[]\" value=\"$k\" $sel >".i18n($v)."</input></td>";
if($x) echo "</tr><tr><td></td>";
$x = ~$x;
}
echo "</tr>";
echo "<tr><td>".i18n('Complete').":</td><td>";
echo "<select name=\"show_complete\">";
$s = ($show_complete == 'yes') ? 'selected="selected"' : '';
echo "<option value=\"all\" $s>".i18n('Show only complete registrations')."</option>";
$s = ($show_complete == 'no') ? 'selected="selected"' : '';
echo "<option value=\"no\" $s>".i18n('Show ALL registrations')."</option>";
echo "</select>";
echo "</tr>";
echo "<tr><td>".i18n('Year').":</td><td>";
echo "<select name=\"show_year\">";
$s = ($show_year == 'current') ? 'selected="selected"' : '';
echo "<option value=\"current\" $s>".i18n('Show only registrations from %1', array($config['FAIRYEAR']))."</option>";
$s = ($show_year == 'all') ? 'selected="selected"' : '';
echo "<option value=\"all\" $s>".i18n('Show ALL years')."</option>";
echo "</select>";
echo "</td></tr></table>";
echo "<br />";
echo "<input type=submit value=\"".i18n('Filter')."\">";
echo "</div>";
echo "</form>";
echo "</div>";
echo "<br />";
/* Grab a list of users */
$w = array();
foreach($show_types as $t) {
$w [] = "users.types LIKE '%$t%'";
}
$where_types = "AND (".join(" OR ", $w).")";
$where_complete = "";
if($show_complete == 'yes') {
foreach($show_types as $t) {
$where_complete .= "AND ({$t}_complete='yes' OR {$t}_complete IS NULL) ";
}
}
if($show_year == 'current')
$where_year = "AND year={$config['FAIRYEAR']}";
echo "<table class=\"viewtable\">";
$querystr="SELECT
*
FROM
users
LEFT JOIN `users_committee` ON `users_committee`.`users_id`=`users`.`id`
LEFT JOIN `users_judge` ON `users_judge`.`users_id`=`users`.`id`
LEFT JOIN `users_volunteer` ON `users_volunteer`.`users_id`=`users`.`id`
LEFT JOIN `users_fair` ON `users_fair`.`users_id`=`users`.`id`
LEFT JOIN `users_sponsor` ON `users_sponsor`.`users_id`=`users`.`id`
WHERE
users.deleted='no'
$where_year
$where_types
$where_complete
ORDER BY
lastname ASC,
firstname ASC,
year DESC";
$q=mysql_query($querystr);
echo mysql_error();
// echo $querystr;
$num=mysql_num_rows($q);
echo i18n("Listing %1 people total. See the bottom for breakdown of by complete status",array($num));
echo mysql_error();
echo "<tr>";
echo " <th>".i18n("Name")."</th>";
echo " <th>".i18n("Type(s)")."</th>";
echo " <th>".i18n("Email Address")."</th>";
echo " <th>".i18n("Year")."</th>";
echo " <th>".i18n("Complete")."</th>";
echo " <th>".i18n("Actions")."</th>";
echo "</tr>";
$completeyes=0;
$completeno=0;
while($r=mysql_fetch_assoc($q))
{
echo "<tr><td>";
echo "<a href=\"#\" onclick=\"return openeditor({$r['id']})\">{$r['firstname']} {$r['lastname']}</a>";
echo "</td><td>";
$types = split(',', $r['types']);
foreach($types as $t) {
echo $user_what[$t]."<br />";
}
echo "</td>";
echo "<td>{$r['email']}</td>";
echo "<td>{$r['year']}</td>";
echo "<td>";
foreach($types as $t) {
if($r["{$t}_complete"] == 'yes') {
echo "<div class=\"happy\" align=\"center\">".i18n("yes")."</div>";
$completeyes++;
} else {
echo "<div class=\"error\" align=\"center\">".i18n("no")."</div>";
$completeno++;
}
}
echo "</td>";
echo "<td align=\"center\">";
echo "<a onclick=\"return confirmClick('Are you sure you want to deactivate this judge from this years fair?')\" href=\"judges_judges.php?action=remove&remove=$r->id\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
echo i18n("Note: Deleting judges from this list only deactivates the judge for this year's fair. To completely delete a judge, use the 'Manage Judges' page");
echo "<br />";
echo "<br />";
echo "$num ".i18n("people listed.");
echo "<br />";
echo "$completeyes ".i18n('complete');
echo "<br />";
echo "$completeno ".i18n('incomplete');
echo "<br />";
echo "<br />";
echo "<br />";
send_footer();
?>

View File

@ -32,8 +32,9 @@
"volunteer_management" "volunteer_management"
); );
echo "<br />"; echo "<br />";
echo "<a href=\"../user_invite.php?type=volunteer\">".i18n("Invite Volunteers")."</a><br />"; echo "<a href=\"user_list.php?show_types[]=volunteer\">".i18n("Volunteer Manager")."</a><br />";
echo "<a href=\"volunteer_positions_manager.php\">".i18n("Volunteer Position Management")."</a> <br />"; echo "<a href=\"volunteer_positions_manager.php\">".i18n("Volunteer Position Management")."</a> <br />";
echo "<a href=\"../user_invite.php?type=volunteer\">".i18n("Invite Volunteers")."</a><br />";
send_footer(); send_footer();

View File

@ -353,6 +353,15 @@ function happy($str,$type="normal")
return "<span class=\"happy\">$str</span><br />"; return "<span class=\"happy\">$str</span><br />";
} }
function display_messages()
{
/* Dump any messages in the queue */
if(is_array($_SESSION['messages'])) {
foreach($_SESSION['messages'] as $m) echo $m;
}
$_SESSION['messages'] = array();
}
$HEADER_SENT=false; $HEADER_SENT=false;
function send_header($title="", $nav=null, $icon=null, $titletranslated=false) function send_header($title="", $nav=null, $icon=null, $titletranslated=false)
{ {
@ -610,13 +619,10 @@ if(substr(getcwd(),-6)=="/admin" || substr(getcwd(),-7)=="/config")
} }
"</td></tr>"; "</td></tr>";
echo "</table>"; echo "</table>";
/* Dump any messages in the queue */
if(is_array($_SESSION['messages'])) { display_messages();
foreach($_SESSION['messages'] as $m) echo $m;
}
$_SESSION['messages'] = array();
} }
/* END OF send_header */
function send_footer() function send_footer()
{ {
@ -665,6 +671,7 @@ function send_popup_header($title="")
<? <?
if($title) if($title)
echo "<h2>".i18n($title)."</h2>"; echo "<h2>".i18n($title)."</h2>";
} }
function send_popup_footer() function send_popup_footer()

64
htabs.css Normal file
View File

@ -0,0 +1,64 @@
/* Ideas borrowed from: http://unraveled.com/projects/assets/css_tabs/ */
ul#htabs {
text-align: left; /* set to left, right or center */
margin: 1em 0 0 0; /* set margins as desired */
font-family: Verdana, Arial, Sans-Serif;
font-size: 10px;
font-weight: bold;
border-bottom-width: 1px;
border-bottom-style: solid;
/* border-color: defined in sfiab.css */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}
ul#htabs li { /* do not change */
display: inline;
margin-right: 5px; /* set additional spacing between tabs as desired */
}
ul#htabs li.htabsel { /* settings for selected tab */
border-bottom-width: 1px;
border-bottom-style: solid;
/* border-bottom-color: defined in sfiab.css */
/* background-color: defined in sfiab.css */
}
ul#htabs li a { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border-width: 1px;
border-style: solid;
/* border-color: defined in sfiab.css */
/* background-color: defined in sfiab.css */
/* color: defined in sfiab.css */
margin-right: 0px; /* Use margin-right in the li def to change spacing */
text-decoration: none;
border-bottom: none;
text-align: center;
}
ul#htabs li.htabsel a { /* settings for selected tab link */
/* background-color: defined in sfiab.css */
/* color: defined in sfiab.css */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}
ul#htabs a:hover { /* settings for hover effect */
/* background: defined in sfiab.css */
}
#htabmain {
margin-top: 0;
margin-right: 10px;
/* background: defined in sfiab.css */
padding: 3px;
padding-top: 0;
border-width: 1px;
border-style: solid;
/* border-color: defined in sfiab.css */
border-top: none;
}

View File

@ -26,13 +26,12 @@
require_once('user.inc.php'); require_once('user.inc.php');
require_once('judge.inc.php'); require_once('judge.inc.php');
$u = user_load($_SESSION['users_id']); if($_SESSION['embed'] == true) {
$u = user_load($_SESSION['embed_edit_id']);
} else {
$u = user_load($_SESSION['users_id']);
}
//send the header
// $type = $_SESSION['users_type'];
send_header('Category and Division Preferences',
array('Judge Registration' => 'judge_main.php')
);
if($_POST['action']=="save") if($_POST['action']=="save")
{ {
@ -67,14 +66,28 @@
$u = user_load($u['id']); $u = user_load($u['id']);
} }
if($_SESSION['embed'] == true) {
echo "<br />";
display_messages();
// echo "<h3>".i18n('Category and Division Preferences')."</h3>";
echo "<br />";
} else {
//send the header
send_header('Category and Division Preferences',
array('Judge Registration' => 'judge_main.php')
);
}
judge_status_update($u); judge_status_update($u);
//output the current status if($_SESSION['embed'] != true) {
$newstatus=judge_status_expertise($u); //output the current status
if($newstatus!="complete") $newstatus=judge_status_expertise($u);
echo error(i18n("Divisional Judging Information Incomplete")); if($newstatus!="complete")
else echo error(i18n("Divisional Judging Information Incomplete"));
echo happy(i18n("Divisional Judging Information Complete")); 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.");
@ -83,7 +96,11 @@ else
exit; exit;
} }
echo "<form name=\"expertiseform\" method=\"post\" action=\"judge_expertise.php\">\n"; if($_SESSION['embed'] == true) {
echo "<form name=\"expertiseform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
} else {
echo "<form name=\"expertiseform\" method=\"post\" action=\"judge_expertise.php\">\n";
}
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\">\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");
@ -181,5 +198,6 @@ else
echo "</form>"; echo "</form>";
send_footer(); if($_SESSION['embed'] != true) send_footer();
?> ?>

View File

@ -27,12 +27,12 @@
require_once('judge.inc.php'); require_once('judge.inc.php');
require_once("questions.inc.php"); require_once("questions.inc.php");
$u = user_load($_SESSION['users_id']); if($_SESSION['embed'] == true) {
$u = user_load($_SESSION['embed_edit_id']);
} else {
$u = user_load($_SESSION['users_id']);
}
//send the header
send_header('Other Information',
array('Judge Registration' => 'judge_main.php')
);
if($_POST['action']=="save") if($_POST['action']=="save")
{ {
@ -55,16 +55,36 @@
$u = user_load($u['id']); $u = user_load($u['id']);
} }
if($_SESSION['embed'] == true) {
echo "<br />";
display_messages();
echo "<h3>".i18n('Other Information')."</h3>";
echo "<br />";
} else {
//send the header
send_header('Other Information',
array('Judge Registration' => 'judge_main.php')
);
}
judge_status_update($u); judge_status_update($u);
//output the current status
$newstatus=judge_status_other($u);
if($newstatus!="complete")
echo error(i18n("Other Information Incomplete"));
else
echo happy(i18n("Other Information Complete"));
echo "<form name=\"otherform\" method=\"post\" action=\"judge_other.php\">\n"; if($_SESSION['embed'] != true) {
//output the current status
$newstatus=judge_status_other($u);
if($newstatus!="complete")
echo error(i18n("Other Information Incomplete"));
else
echo happy(i18n("Other Information Complete"));
}
if($_SESSION['embed'] == true) {
echo "<form name=\"otherform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
} else {
echo "<form name=\"otherform\" method=\"post\" action=\"judge_other.php\">\n";
}
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>\n"; echo "<table>\n";
@ -134,5 +154,5 @@ echo "</table>";
echo "</form>"; echo "</form>";
send_footer(); if($_SESSION['embed'] != true) send_footer();
?> ?>

View File

@ -25,13 +25,13 @@
require_once('common.inc.php'); require_once('common.inc.php');
require_once('user.inc.php'); require_once('user.inc.php');
require_once('judge.inc.php'); require_once('judge.inc.php');
$u = user_load($_SESSION['users_id']);
//send the header if($_SESSION['embed'] == true) {
send_header('Special Awards', $u = user_load($_SESSION['embed_edit_id']);
array('Judge Registration' => 'judge_main.php') } else {
); $u = user_load($_SESSION['users_id']);
}
if($_POST['action']=="save") { if($_POST['action']=="save") {
//first delete all their old associations for this year.. //first delete all their old associations for this year..
@ -43,20 +43,37 @@
VALUES ('{$u['id']}','$aid')"); VALUES ('{$u['id']}','$aid')");
} }
} }
echo notice(i18n("Special Award preferences successfully saved")); message_push(notice(i18n("Special Award preferences successfully saved")));
} }
if($_SESSION['embed'] == true) {
echo "<br />";
display_messages();
echo "<h3>".i18n('Special Awards')."</h3>";
echo "<br />";
} else {
//send the header
send_header('Special Awards',
array('Judge Registration' => 'judge_main.php')
);
}
judge_status_update($u); judge_status_update($u);
//output the current status if($_SESSION['embed'] != true) {
$newstatus=judge_status_special_awards($u); //output the current status
if($newstatus!='complete') $newstatus=judge_status_special_awards($u);
echo error(i18n("Special Award Preferences Incomplete")); if($newstatus!='complete')
else echo error(i18n("Special Award Preferences Incomplete"));
echo happy(i18n("Special Award Preferences Complete")); else
echo happy(i18n("Special Award Preferences Complete"));
}
echo "<form name=\"specialawardform\" method=\"post\" action=\"judge_special_awards.php\">\n"; if($_SESSION['embed'] == true) {
echo "<form name=\"specialawardform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
} else {
echo "<form name=\"specialawardform\" method=\"post\" action=\"judge_special_awards.php\">\n";
}
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
if($u['special_award_only'] == 'yes') { if($u['special_award_only'] == 'yes') {
echo i18n("Please select the special award you are supposed to judge."); echo i18n("Please select the special award you are supposed to judge.");
@ -113,5 +130,6 @@ else
echo "</form>"; echo "</form>";
send_footer(); if($_SESSION['embed'] != true) send_footer();
?> ?>

View File

@ -31,6 +31,7 @@ td {
vertical-align: top; vertical-align: top;
} }
table tr.even { table tr.even {
background: #EEEEFF; background: #EEEEFF;
} }
@ -422,4 +423,38 @@ tr.externalaward {
padding: 2px; padding: 2px;
} }
/* Tab colours, boy this will be nice when CSS variables exist */
/* Tab Line Colour */
ul#htabs {
border-bottom-color: #A5B5C6; /* Line colour */
}
/* Non-selected tab */
ul#htabs li a {
background-color: #D0D0FF; /* Background Colour */
color: #000000; /* Font colour */
border-color: #A5B5C6;
}
/* Selected tab */
ul#htabs li.htabsel {
background-color: #EEEEFF; /* Backgroudn Colour */
border-bottom-color: #EEEEFF; /* Bottom border colour, should match the bkgrnd */
}
/* Selected tab link */
ul#htabs li.htabsel a {
background-color: #EEEEFF; /* Background Colour */
color: #000000; /* Font colour */
}
/* Hover over colour */
ul#htabs a:hover {
background: #ffffff;
}
#htabmain {
background: #EEEEFF; /* Should match selected tab background */
border-color: #A5B5C6;/* Should match UL border */
}

View File

@ -29,6 +29,18 @@ $user_what = array('student'=>'Participant', 'judge' => 'Judge',
'committee'=>'Committee Member','volunteer' => 'Volunteer', 'committee'=>'Committee Member','volunteer' => 'Volunteer',
'fair'=>'Science Fair','sponsor' => 'Sponsor Contact'); 'fair'=>'Science Fair','sponsor' => 'Sponsor Contact');
function user_valid_type($type)
{
global $user_types;
if(is_array($type)) {
foreach($type as $t) {
if(!in_array($t, $user_types)) return false;
}
} else {
if(!in_array($type, $user_types)) return false;
}
return true;
}
/* Duplicate of common.inc.php:generatePassword, which will be deleted /* Duplicate of common.inc.php:generatePassword, which will be deleted
* eventually when ALL users are handled through this file */ * eventually when ALL users are handled through this file */

View File

@ -156,13 +156,21 @@
echo "<br />"; echo "<br />";
if($_POST['action']!="" && $_POST['email']) $allowed_types = array('judge', 'volunteer');
{ $type = $_POST['type'];
if($type == '') $type = $_GET['type'];
if($type != '') {
if(!in_array($type, $allowed_types)) {
echo "Type $type not allowed for invite<br /><br/>";
exit;
}
}
if($_POST['action']!="" && $_POST['email'] && $type != '') {
$allowed_actions = array('notexist','norole','noyear'); $allowed_actions = array('notexist','norole','noyear');
$email = stripslashes($_POST['email']); $email = stripslashes($_POST['email']);
$type = $_POST['type'];
$action = $_POST['action'];
$action = $_POST['action'];
if(!in_array($action, $allowed_actions)) if(!in_array($action, $allowed_actions))
exit; exit;
@ -213,8 +221,10 @@
echo i18n("Select a Role: "); echo i18n("Select a Role: ");
echo "</td><td><select name=\"type\" onChange=\"check_email();\">\n"; echo "</td><td><select name=\"type\" onChange=\"check_email();\">\n";
echo "<option value=\"\" >".i18n('Choose')."</option>\n"; echo "<option value=\"\" >".i18n('Choose')."</option>\n";
echo "<option value=\"judge\" >".i18n('Judge')."</option>\n"; $sel = ($type == 'judge') ? 'selected="selected"' : '';
echo "<option value=\"volunteer\">".i18n('Volunteer')."</option>\n"; echo "<option value=\"judge\" $sel >".i18n('Judge')."</option>\n";
$sel = ($type == 'volunteer') ? 'selected="selected"' : '';
echo "<option value=\"volunteer\" $sel >".i18n('Volunteer')."</option>\n";
echo "</select></td></tr><tr><td>"; echo "</select></td></tr><tr><td>";
echo i18n("Enter an Email: "); echo i18n("Enter an Email: ");
echo "</td><td><input type=\"text\" name=\"email\" size=\"40\" onKeyUp=\"check_email();\" />"; echo "</td><td><input type=\"text\" name=\"email\" size=\"40\" onKeyUp=\"check_email();\" />";

View File

@ -71,20 +71,26 @@
/* See if there is an edit request */ /* See if there is an edit request */
$eid = intval($_GET['edit']); if($_SESSION['embed_edit_id'])
$eid = $_SESSION['embed_edit_id'];
else
$eid = intval($_GET['edit']);
if($eid != 0) { /* Force them to edit themselves if no eid found */
/* There is an edit request, the user must be: if($eid == 0) $eid = $_SESSION['users_id'];
if($_SESSION['users_id'] != $eid) {
/* There is an edit request for someone other than the logged in user,
* the user must be:
* - on the committee * - on the committee
* - with admin access */ * - with admin access */
user_auth_required('committee', 'admin'); user_auth_required('committee', 'admin');
$u = user_load($eid); $ext_editor = true;
} else { } else {
/* Else, force them to edit themselves */ /* Else, they are just editing themselves */
$eid = false; $ext_editor = false;
$u = user_load($_SESSION['users_id']);
} }
$u = user_load($eid);
/* Load the fields the user can edit, and theones that are required */ /* Load the fields the user can edit, and theones that are required */
@ -166,10 +172,15 @@
} }
//send the header //send the header
if($eid == false) { if($_SESSION['embed'] == true) {
$type = $_SESSION['users_type']; echo "<br/>";
$m = ($type == 'committee') ? 'Committee' : $user_what[$type]; display_messages();
send_header("Personal Information", echo "<h3>".i18n("Personal Information")."</h3>";
echo "<br/>";
} else if($ext_editor == true) {
$type = $_SESSION['users_type'];
$m = ($type == 'committee') ? 'Committee' : $user_what[$type];
send_header("Personal Information",
array("$m Main" => "{$type}_main.php") array("$m Main" => "{$type}_main.php")
,"edit_profile" ,"edit_profile"
); );
@ -183,7 +194,7 @@
); );
} else { } else {
send_header("Personal Information for {$u['firstname']} {$u['lastname']}", send_header("Personal Information for {$u['firstname']} {$u['lastname']}",
array("Committee Main" => "committee_main.php") array("Judge Registration" => "judge_main.php")
,"edit_profile" ,"edit_profile"
); );
} }
@ -196,7 +207,7 @@
} }
if(count($errorfields)) { if(count($errorfields)) {
echo error(i18n('Information will not be saved until the above errors are corrected')); echo error(i18n('Information will not be saved until the above errors are corrected'));
} else if ($eid == false) { } else if ($ext_editor == false) {
//output the current status //output the current status
$newstatus=user_personal_info_status($u); $newstatus=user_personal_info_status($u);
if($newstatus!='complete') if($newstatus!='complete')
@ -248,11 +259,12 @@ function item($user, $fname, $subtext='')
} }
$eidstr = ''; if($_SESSION['embed'] != true) {
if($eid != false) { echo "<form name=\"personalform\" method=\"post\" action=\"user_personal.php?edit=$eid\">\n";
$eidstr="?edit=$eid"; } else {
echo "<form name=\"personalform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
} }
echo "<form name=\"personalform\" method=\"post\" action=\"user_personal.php$eidstr\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n";
echo "<table>\n"; echo "<table>\n";
@ -361,5 +373,8 @@ echo "</form>";
echo "<br />"; echo "<br />";
send_footer(); if($_SESSION['embed'] != true) {
send_footer();
}
?> ?>

View File

@ -27,11 +27,15 @@
require_once("user.inc.php"); require_once("user.inc.php");
require_once("volunteer.inc.php"); require_once("volunteer.inc.php");
user_auth_required('volunteer');
$u = user_load($_SESSION['users_id']); if($_SESSION['embed'] == true) {
$u = user_load($_SESSION['embed_edit_id']);
} else {
user_auth_required('volunteer');
$u = user_load($_SESSION['users_id']);
}
if($_POST['action']=="save") if($_POST['action']=="save")
{ {
$vals = ''; $vals = '';
@ -76,25 +80,29 @@
/* update overall status */ /* update overall status */
volunteer_status_update($u); volunteer_status_update($u);
//output the current status if($_SESSION['embed'] != true) {
$newstatus=volunteer_status_position($u); //output the current status
if($newstatus!='complete') $newstatus=volunteer_status_position($u);
{ if($newstatus!='complete')
message_push(error(i18n("Volunteer Position Selection Incomplete"))); message_push(error(i18n("Volunteer Position Selection Incomplete")));
} else
else message_push(happy(i18n("Volunteer Position Selection Complete")));
{
message_push(happy(i18n("Volunteer Position Selection Complete")));
} }
//send the header if($_SESSION['embed'] == true) {
send_header("Volunteer Positions", echo "<br />";
display_messages();
echo "<h3>".i18n('Volutneer Positions')."</h3>";
echo "<br />";
} else {
//send the header
send_header("Volunteer Positions",
array("Volunteer Registration" => "volunteer_main.php") array("Volunteer Registration" => "volunteer_main.php")
); );
}
$s = ($_SESSION['embed'] == true) ? $_SESSION['embed_submit_url'] : 'volunteer_position.php';
echo "<form name=\"personalform\" method=\"post\" action=\"$s\">\n";
echo "<form name=\"personalform\" method=\"post\" action=\"volunteer_position.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n";
echo "<table>\n"; echo "<table>\n";
@ -154,5 +162,5 @@ echo "</form>";
echo "<br />"; echo "<br />";
send_footer(); if($_SESSION['embed'] != true) send_footer();
?> ?>