Add the judge inviter to the judge administration section

Add the new judge invite email
This commit is contained in:
james 2005-11-25 21:15:29 +00:00
parent 5df07701a0
commit e8353f011f
5 changed files with 84 additions and 2 deletions

View File

@ -30,6 +30,10 @@
echo "<br />";
echo "<br />";
if($config['judge_registration_type']=="invite")
{
echo "<a href=\"judges_invite.php\">".i18n("Invite Judges")."</a><br />";
}
echo "<a href=\"judges_teams.php\">".i18n("Manage Judging Teams")."</a><br />";
echo "<a href=\"judges_teams_members.php\">".i18n("Manage Judging Team Members")."</a><br />";
echo "<a href=\"judges_timeslots.php\">".i18n("Manage Judging Timeslots")."</a><br />";

63
admin/judges_invite.php Normal file
View File

@ -0,0 +1,63 @@
<?
/*
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");
auth_required('admin');
include "judges.inc.php";
send_header("Administration - Invite Judges");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>\n";
echo "<a href=\"judges.php\">&lt;&lt; ".i18n("Back to Judges")."</a>\n";
echo "<br />";
echo "<br />";
if($_POST['action']=="invite" && $_POST['email'])
{
$q=mysql_query("SELECT id FROM judges WHERE email='".$_POST['email']."'");
if(mysql_num_rows($q))
{
echo error(i18n("A judge already exists with that email address"));
}
else
{
$pass=generatePassword();
mysql_query("INSERT INTO judges (email,password) VALUES ('".mysql_escape_string(stripslashes($_POST['email']))."','$pass')");
email_send("new_judge_invite",stripslashes($_POST['email']),array("FAIRNAME"=>$config['fairname']),array("FAIRNAME"=>$config['fairname'],"EMAIL"=>stripslashes($_POST['email']),"PASSWORD"=>$pass));
echo happy(i18n("%1 has been invited to be a judge",array($_POST['email'])));
}
}
echo i18n("Enter the judge's email address to invite them to be a judge");
echo "<br />\n";
echo "<br />\n";
echo "<form method=\"post\" action=\"judges_invite.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"invite\" />\n";
echo i18n("Email").": ";
echo "<input type=\"text\" name=\"email\" size=\"40\" />\n";
echo "<input type=\"submit\" value=\"".i18n("Invite Judge")."\" />\n";
echo "</form>\n";
send_footer();
?>

View File

@ -757,4 +757,20 @@ function output_page_text($textname)
}
echo nl2br(i18n($r->text));
}
function generatePassword()
{
//these are good characters that are not easily confused with other characters :)
$available="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789";
$len=strlen($available);
$key="";
for($x=0;$x<8;$x++)
{
$key.=$available[rand(0,$len)];
}
return $key;
}
?>

View File

@ -6,4 +6,4 @@ INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'judge_
ALTER TABLE `schools` ADD `registration_password` VARCHAR( 32 ) NOT NULL;
INSERT INTO `emails` VALUES ('', 'register_participants_resend_regnum', 'Participant Registration - Resend Registration Number', 'Resend the password to the participant if they submit a ''forgot regnum'' request', 'website@sfiab.ca', 'Registration for [FAIRNAME]', 'We have received a request for the retrieval if your registration number from this email address. Please find your existing registration number below\r\n\r\nRegistration Number: [REGNUM]\r\n', 'system');
INSERT INTO `emails` VALUES ('', 'new_participant', 'New Participant', 'Email that new participants receive when they are added to the system', 'website@sfiab.ca', 'Registration for [FAIRNAME]', 'A new registration account has been created for you. To access your registration account, please enter enter the following registration number into the registration website:\r\n\r\nRegistration Number: [REGNUM]\r\n', 'system');
INSERT INTO `emails` VALUES ('', 'new_judge_invite', 'New Judge Invitation', 'This is sent to a new judge when they are invited using the invite judges administration section, only available when judge_registraiton_type=invite', 'registration@sfiab.ca', 'Judge Registration for [FAIRNAME]', 'You have been invited to be a judge for the [FAIRNAME]. An account has been created for you to login with and complete your information. You can login to the judge registration site with:\r\n\r\nEmail Address: [EMAIL]\r\nPassword: [PASSWORD]\r\n\r\nYou can change your password once you login.', 'system');

View File

@ -102,7 +102,6 @@
if($_SESSION['email'] && $_SESSION['judges_id'])
header("Location: register_judges_main.php");
send_header("Judges Registration");
$_POST['email']=trim($_POST['email']);