From a2b274f4b9c0a7e59ad46eb40840f766ff49b986 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 21 Feb 2005 23:07:10 +0000 Subject: [PATCH] add two new js functions: - fieldChanged - confirmChanges call fieldChanged when any field in any of the registraiton forms are chagned call confirmChanges when the "back to summary" link is changed, to warn them if they have any unsaved changes remove "(discard changes") from the "back to summary" links. --- common.inc.php | 26 ++++++++++++++++-- register_judges_expertise.php | 10 +++---- register_judges_password.php | 6 ++-- register_judges_personal.php | 52 +++++++++++++++++------------------ 4 files changed, 58 insertions(+), 36 deletions(-) diff --git a/common.inc.php b/common.inc.php index 47c46b6..73c0456 100644 --- a/common.inc.php +++ b/common.inc.php @@ -206,6 +206,28 @@ function em(str,domain) { document.write('' + str + '@' + domain + ''); } + +var anyFieldHasBeenChanged=false; + +function fieldChanged() +{ + anyFieldHasBeenChanged=true; +} + +function confirmChanges() +{ + if(anyFieldHasBeenChanged) + { + var okay=confirm(''); + if(okay) + return true; + else + return false; + } + else + return true; +} + --> @@ -352,7 +374,7 @@ function emit_year_selector($name,$selected="",$min=0,$max=0) echo "\n"; } -function emit_province_selector($name,$selected="") +function emit_province_selector($name,$selected="",$extra="") { $q=mysql_query("SELECT * FROM provinces ORDER BY province"); if(mysql_num_rows($q)==1) @@ -363,7 +385,7 @@ function emit_province_selector($name,$selected="") } else { - echo "\n"; echo "\n"; while($r=mysql_fetch_object($q)) { diff --git a/register_judges_expertise.php b/register_judges_expertise.php index cea2057..23c24b9 100644 --- a/register_judges_expertise.php +++ b/register_judges_expertise.php @@ -28,7 +28,7 @@ //send the header send_header("Judges Registration - Areas of Expertise Information"); - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; echo "
"; if($_POST['action']=="save") @@ -73,7 +73,7 @@ if($newstatus!="complete") } else { - echo happy(i18n("Areas of Expertise Inf(rmation Complete")); + echo happy(i18n("Areas of Expertise Information Complete")); } echo "
\n"; @@ -113,7 +113,7 @@ else { if($expertise[$r->id]==$x) $sel="checked=\"checked\""; else $sel=""; - echo "id]\" value=\"$x\" />"; + echo "id]\" value=\"$x\" />"; } echo ""; echo ""; @@ -129,7 +129,7 @@ else echo " "; if($subexpertise[$subr->id]) $ch="checked=\"checked\""; else $ch=""; - echo "id]\" value=\"1\" />"; + echo "id]\" value=\"1\" />"; echo ""; echo "$subr->subdivision"; echo ""; @@ -152,7 +152,7 @@ else echo "\n"; echo "
"; echo "
"; - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; send_footer(); diff --git a/register_judges_password.php b/register_judges_password.php index 5ab8a5b..7510665 100644 --- a/register_judges_password.php +++ b/register_judges_password.php @@ -30,7 +30,7 @@ if(!$_SESSION['judges_password_expired']) { - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; echo "
"; } @@ -67,7 +67,7 @@ if($_SESSION['judges_password_expired']) { unset($_SESSION['judges_password_expired']); - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; echo "
"; } } @@ -104,7 +104,7 @@ echo ""; if(!$_SESSION['judges_password_expired']) { echo "
"; - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; } send_footer(); diff --git a/register_judges_personal.php b/register_judges_personal.php index 56ca370..7469752 100644 --- a/register_judges_personal.php +++ b/register_judges_personal.php @@ -28,7 +28,7 @@ //send the header send_header("Judges Registration - Personal Information"); - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; echo "
"; if($_POST['action']=="save") @@ -96,32 +96,32 @@ else echo "\n"; echo "\n"; -echo " \n"; -echo " \n"; +echo " \n"; +echo " \n"; echo "\n"; echo "\n"; -echo " \n"; -echo " \n"; +echo " \n"; +echo " \n"; echo "\n"; echo "\n"; -echo " \n"; +echo " \n"; echo " \n"; echo "\n"; echo "\n"; -echo " \n"; -echo " \n"; +echo " \n"; +echo " \n"; echo "\n"; echo "\n"; -echo " \n"; -echo " \n"; +echo " \n"; +echo " \n"; echo ""; echo "\n"; -echo " \n"; -echo " \n"; +echo " \n"; +echo " \n"; echo ""; echo ""; @@ -129,7 +129,7 @@ echo ""; echo "\n"; echo " \n"; echo "\n"; echo " \n"; echo "\n"; echo " "; -echo " \n"; +echo " \n"; echo "\n"; echo "\n"; echo " "; -echo " \n"; +echo " \n"; echo "\n"; echo "\n"; @@ -186,7 +186,7 @@ while($r=mysql_fetch_object($q)) { if(in_array($r->lang,$currentlanguages)) $ch="checked=\"checked\""; else $ch=""; - echo "lang\" /> $r->langname
"; + echo "lang\" /> $r->langname
"; } echo " \n"; @@ -194,27 +194,27 @@ echo "\n"; echo "\n"; echo " \n"; -echo " \n"; +echo " \n"; echo "\n"; echo "\n"; echo " \n"; -echo " \n"; +echo " \n"; echo "\n"; echo "\n"; echo " \n"; -echo " \n"; +echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; @@ -222,10 +222,10 @@ echo "\n"; echo " \n"; echo " \n"; echo "\n"; @@ -235,7 +235,7 @@ echo "\ echo ""; echo "
"; - echo "<< ".i18n("Back to Judges Registration Summary (discard changes)")."
"; + echo "<< ".i18n("Back to Judges Registration Summary")."
"; send_footer(); ?>
".i18n("First Name")."firstname\" />".i18n("Last Name")."lastname\" />".i18n("First Name")."firstname\" />".i18n("Last Name")."lastname\" />
".i18n("Email Address")."email\" />".i18n("City")."city\" />".i18n("Email Address")."email\" />".i18n("City")."city\" />
".i18n("Address 1")."address\" />".i18n("Address 1")."address\" />".i18n("Province").""; -emit_province_selector("province",$judgeinfo->province); +emit_province_selector("province",$judgeinfo->province,"onchange=\"fieldChanged()\""); echo "
".i18n("Address 2")."address2\" />".i18n("Phone (Home)")."phonehome\" />".i18n("Address 2")."address2\" />".i18n("Phone (Home)")."phonehome\" />
".i18n("Postal Code")."postalcode\" />".i18n("Phone (Work)")."phonework\" /> extphoneworkext\" />".i18n("Postal Code")."postalcode\" />".i18n("Phone (Work)")."phonework\" /> extphoneworkext\" />
".i18n("Organization")."organization\" />".i18n("Phone (Cell)")."phonecell\" />".i18n("Organization")."organization\" />".i18n("Phone (Cell)")."phonecell\" />


".i18n("Age category preference").""; $q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade"); -echo ""; echo "\n"; while($r=mysql_fetch_object($q)) { @@ -146,7 +146,7 @@ echo "
".i18n("Division preference").""; $q=mysql_query("SELECT * FROM projectdivisions ORDER BY division"); -echo ""; echo "\n"; while($r=mysql_fetch_object($q)) { @@ -161,12 +161,12 @@ echo "
".i18n("Highest post-secondary degree")."highest_psd\" />highest_psd\" />
".i18n("Other professional qualifications")."professional_quals\" />professional_quals\" />
".i18n("Years of judging experience at school/local level")."years_school\" size=\"3\" />years_school\" size=\"3\" />
".i18n("Years of judging experience at regional level")."years_regional\" size=\"3\" />years_regional\" size=\"3\" />
".i18n("Years of judging experience at national level")."years_national\" size=\"3\" />years_national\" size=\"3\" />
".i18n("Willing to act as a division chair?").""; if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch=""; -echo "No"; +echo "No"; echo "    "; if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch=""; -echo "Yes"; +echo "Yes"; echo "
".i18n("Attending lunch?").""; if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch=""; -echo "No"; +echo "No"; echo "    "; if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch=""; -echo "Yes"; +echo "Yes"; echo "