From f23188f67b69c79bd27553992172d1bcbae8ea26 Mon Sep 17 00:00:00 2001
From: Matthew Juhl <mjuhl24@gmail.com>
Date: Mon, 25 Jan 2010 16:14:23 +0000
Subject: [PATCH] Fix alumni opt-in input

---
 .../scripts/JS/enhanceProfileForm.php         | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/plugins/unl_theme/scripts/JS/enhanceProfileForm.php b/plugins/unl_theme/scripts/JS/enhanceProfileForm.php
index 7cc90243..8f10d87a 100644
--- a/plugins/unl_theme/scripts/JS/enhanceProfileForm.php
+++ b/plugins/unl_theme/scripts/JS/enhanceProfileForm.php
@@ -1,3 +1,4 @@
+/*<script type="text/javascript">*/
 (function(){
 	// Edit Profile Stuff
 	function updateLL () {
@@ -52,7 +53,7 @@
 				color: "#1091D1"
 			});
 		});
-		$("form.cool fieldset input, form.cool fieldset select").wrap('<div class="element"></div>');
+		$("form.cool fieldset input[type!=submit], form.cool fieldset select").wrap('<div class="element"></div>');
 		$("form.cool label div").each(function(){
 			$(this).insertAfter($(this).parent());
 		});
@@ -475,6 +476,25 @@
 	     
 		$("select[name=form_data_profile_dob_day] option[value=" + dob_day + "]").attr("selected","selected");
 
+		WDN.log("Opt in value...... " + $("input[name=form_data_info_alumni_opt_in]").val());
+		var alumniOptIn = $("input[name=form_data_info_alumni_opt_in]").val();
+		$("input[name=form_data_info_alumni_opt_in]").replaceWith('<input type="checkbox" name="form_data_info_alumni_opt_in" value="yes" />');
+		if (alumniOptIn == "yes"){
+			$("input[name=form_data_info_alumni_opt_in]").attr("checked","checked");
+		}
+		
+		function alumniCheckbox () {
+			if ($("select[name=form_data_profile_role]").val() == "Alumnus") {
+				$("input[name=form_data_info_alumni_opt_in]").parent().parent().show();
+			} else {
+				$("input[name=form_data_info_alumni_opt_in]").parent().parent().hide();
+			}
+		};
+
+		alumniCheckbox();
+
+		$("select[name=form_data_profile_role]").change(alumniCheckbox);
+
 		
 		$("#formloading").remove();
 		$("#maincontent form.cool").show();
-- 
GitLab