Rework school access page.

1) add a crapload of missing i18n's
2) disable feedback form until an email address is entered
3) update the headers of the email sent so 'reply' works
This commit is contained in:
james 2008-03-27 04:33:00 +00:00
parent e41072e076
commit 63a48c8fbf

View File

@ -77,38 +77,40 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
if($_POST['action']=="feedback")
{
$body="";
$body.=$_SERVER['REMOTE_ADDR']." (".$_SERVER['REMOTE_HOST'].")\n";
$body.=date("r")."\n";
$body.=$_SERVER['REMOTE_ADDR']." (".$_SERVER['REMOTE_HOST'].")\n";
$body.="School ID: $school->id\n";
$body.="School Name: $school->school\n";
$body.="Feedback:\n".$_POST['feedbacktext']."\n";
echo "mailing ".$config['fairmanageremail'];
mail($config['fairmanageremail'],"School Feedback",$body,"From: webpage@".$_SERVER['SERVER_NAME']);
echo happy(i18n("Thanks for your feedback!"));
if($school->sciencehead) $body.="Science Teacher: $school->sciencehead\n";
if($school->scienceheadphone) $body.="Science Teacher Phone: $school->scienceheadphone\n";
if($school->scienceheademail) $body.="Science Teacher Email: $school->scienceheademail\n";
$body.="\nFeedback:\n".stripslashes($_POST['feedbacktext'])."\n";
$returnEmailAddress = $school->scienceheademail;
mail($config['fairmanageremail'],"School Feedback",$body,"From: ". $returnEmailAddress."\nReply-To: ".$returnEmailAddress."\nReturn-Path: ".$returnEmailAddress);
echo happy(i18n("Your feedback has been sent"));
}
echo "<h3>$school->school</h3>";
echo "<h4>School Information</h4>";
echo "Please make sure your school contact information is correct, make any necessary changes:";
echo "<h4>".i18n("School Information")."</h4>";
echo i18n("Please make sure your school contact information is correct, make any necessary changes:");
echo "<form method=POST action=\"schoolaccess.php\">";
echo "<input type=hidden name=action value=\"save\">";
echo "<table border=0 cellspacing=0 cellpadding=3>";
echo "<tr><td>School Name</td><td><input value=\"$school->school\" type=text name=school size=40></td></tr>";
echo "<tr><td>".i18n("School Name")."</td><td><input value=\"$school->school\" type=text name=school size=40></td></tr>";
// echo "<tr><td>Registration Password</td><td><input value=\"$school->registration_password\" type=text name=\"registration_password\" size=\"20\"></td></tr>";
echo "<tr><td>Address</td><td><input value=\"$school->address\" type=text name=address size=40></td></tr>";
echo "<tr><td>City</td><td><input value=\"$school->city\" type=text name=city size=30></td></tr>";
echo "<tr><td>".i18n("Address")."</td><td><input value=\"$school->address\" type=text name=address size=40></td></tr>";
echo "<tr><td>".i18n("City")."</td><td><input value=\"$school->city\" type=text name=city size=30></td></tr>";
echo "<tr><td>".i18n("Province")."</td><td>";
emit_province_selector("province_code",$school->province_code);
echo "</td></tr>\n";
echo "<tr><td>Postalcode</td><td><input value=\"$school->postalcode\" type=text name=postalcode size=10></td></tr>";
echo "<tr><td>Phone Number</td><td><input value=\"$school->phone\" type=text name=phone size=30></td></tr>";
echo "<tr><td>Fax Number</td><td><input value=\"$school->fax\" type=text name=fax size=30></td></tr>";
echo "<tr><td>Science Teacher</td><td><input value=\"$school->sciencehead\" type=text name=sciencehead size=40></td></tr>";
echo "<tr><td>Science Teacher Email</td><td><input value=\"$school->scienceheademail\" type=text name=scienceheademail size=40></td></tr>";
echo "<tr><td>Science Teacher Phone <br><font size=1>(If different than above)</font></td><td><input value=\"$school->scienceheadphone\" type=text name=scienceheadphone size=30></td></tr>";
echo "<tr><td>".i18n("Postal Code")."</td><td><input value=\"$school->postalcode\" type=text name=postalcode size=10></td></tr>";
echo "<tr><td>".i18n("Phone Number")."</td><td><input value=\"$school->phone\" type=text name=phone size=30></td></tr>";
echo "<tr><td>".i18n("Fax Number")."</td><td><input value=\"$school->fax\" type=text name=fax size=30></td></tr>";
echo "<tr><td>".i18n("Science Teacher")."</td><td><input value=\"$school->sciencehead\" type=text name=sciencehead size=40></td></tr>";
echo "<tr><td>".i18n("Science Teacher Email")."</td><td><input value=\"$school->scienceheademail\" type=text name=scienceheademail size=40></td></tr>";
echo "<tr><td>".i18n("Science Teacher Phone")."<br><font size=1>(".i18n("If different than above").")</font></td><td><input value=\"$school->scienceheadphone\" type=text name=scienceheadphone size=30></td></tr>";
echo "</table>";
echo "<input type=submit value=\"Save Changes\">";
echo "<input type=submit value=\"".i18n("Save Changes")."\">";
echo "</form>";
echo "<br>";
@ -137,78 +139,25 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<br />";
}
/*
//the participation section needs to be updated to handle the age categories as specified
//in the categories table and the numbers from configuration, for now, lets just not do it.
//this code is copied from the ORSF schoolaccess page, thats why its here, but just commented out.
echo "<h4>Participation Information</h4>";
echo "Please select the number of <b>projects</b> you anticipate on sending to the fair in each of the age categories";
echo "<form method=POST action=\"schoolaccess.php\">";
echo "<input type=hidden name=action value=\"numbers\">";
echo "<table border=0 cellspacing=0 cellpadding=3>";
echo "<tr><td>Junior (Grades 7-8)</td><td>";
echo "<select name=junior>";
for($x=0;$x<=12;$x++)
{
if($school->junior==$x) $sel="selected"; else $sel="";
echo "<option $sel value=\"$x\">$x</option>\n";
}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>Intermediate (Grades 9-10)</td><td>";
echo "<select name=intermediate>";
for($x=0;$x<=12;$x++)
{
if($school->intermediate==$x) $sel="selected"; else $sel="";
echo "<option $sel value=\"$x\">$x</option>\n";
}
echo "</select>";
echo "</td></tr>";
echo "<tr><td>Senior (Grades 11-12)</td><td>";
echo "<select name=senior>";
for($x=0;$x<=12;$x++)
{
if($school->senior==$x) $sel="selected"; else $sel="";
echo "<option $sel value=\"$x\">$x</option>\n";
}
echo "</select>";
echo "</td></tr>";
echo "</table>";
echo "<input type=submit value=\"Save Participation Numbers\">";
echo "<br>Please note, these numbers are only an <b>estimate</b> to help us plan the fair. Choosing small numbers here in <b>no way</b> limits your actual participation.<br>\n";
echo "</form>";
*/
echo "<br>";
echo "<h4>School Feedback / Questions</h4>";
echo "<h4>".i18n("School Feedback / Questions")."</h4>";
echo i18n("We are always welcome to any feedback (both positive and constructive crisicism!), or any questions you may have. Please use the following form to communicate with the science fair committee!");
if($school->scienceheademail) {
echo "<form method=POST action=\"schoolaccess.php\">";
echo "<input type=hidden name=action value=\"feedback\">";
echo "We are always welcome to any feedback (both positive and constructive crisicism!), or any questions you may have. Please use the following box to communicate with us!";
echo "<br><textarea name=feedbacktext rows=8 cols=60></textarea><br>";
echo "<input type=submit value=\"Send Feedback\">";
echo "</form>";
}
else
{
echo "Invalid School ID or Access Code (2)";
echo error(i18n("Feedback is disabled until a science teacher email address is entered above"));
}
else {
echo error(i18n("Invalid School ID or Access Code"));
}
}
else
{
else {
if($errormsg) echo "<font color=red><b>$errormsg</b></font>";
if($happymsg) echo happy($happymsg);
@ -234,9 +183,15 @@ else
<select name="schoolid">
<option value=""><?=i18n("Choose your school")?></option>
<?
$q=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY city,school");
while($r=mysql_fetch_object($q)) {
echo "<option $sel value=\"$r->id\">".htmlspecialchars($r->city).' - '.htmlspecialchars($r->school)."</option>\n";
$q=mysql_query("SELECT id,school,city FROM schools WHERE year='".$config['FAIRYEAR']."' ORDER BY school");
$prev="somethingthatdoesnotexist";
while($r=mysql_fetch_object($q))
{
if($r->school==$prev)
echo "<option value=\"$r->id\">$r->school ($r->city)</option>\n";
else
echo "<option value=\"$r->id\">$r->school</option>\n";
$prev=$r->school;
}
?>
</select>