diff --git a/unl_theme/views/default/page_elements/header.php b/unl_theme/views/default/page_elements/header.php index 697a1f205d8576b5093a664faabfe1615a5c5bf6..d8ed28b31b844fd3962f0fc58cfa309ac98880e6 100644 --- a/unl_theme/views/default/page_elements/header.php +++ b/unl_theme/views/default/page_elements/header.php @@ -55,7 +55,7 @@ if ($vars['title'] == "Edit profile") { } #maincontent form.cool div.element { - margin: 0; + __margin: 0; } #maincontent form.cool label { @@ -85,34 +85,65 @@ if ($vars['title'] == "Edit profile") { /* SET UP PROFILE EDIT FORM */ - // get the dob_year for later use + + // get the year and country values for later use var dob_year = $("input[name=form_data_profile_dob_year]").val(); - // remove the text input. will be replacing with a selector + var from_year = $("input[name=form_data_profile_attended_from]").val(); + var to_year = $("input[name=form_data_profile_attended_to]").val(); + var home_country = $("input[name=form_data_profile_homecountry]").val(); + var home_state = $("input[name=form_data_profile_homestate]").val(); + var current_country = $("input[name=form_data_profile_country]").val(); + var current_state = $("input[name=form_data_profile_state]").val(); + // remove the text inputs. will be replacing with selectors $("input[name=form_data_profile_dob_year]").remove(); + // wrap the fields in <li>s - $("form.cool label").wrap("<li></li>"); + $("form.cool label").wrap("<li></li>").addClass("element"); $("form.cool label br").remove(); $("form.cool p.form-field-description").each(function(){ $(this).appendTo($(this).prev()).css({ - marginLeft: "162px", + marginLeft: "164px", + display: "absolute", + marginTop: "33px", fontSize: "75%", color: "#1091D1" }); }); $("form.cool fieldset input, form.cool fieldset select").wrap('<div class="element"></div>'); $("form.cool label div").each(function(){ - $(this).insertAfter($(this).parent()); }); + // remove the country input + var country_parent = $("input[name=form_data_profile_country]").parent(); + $("input[name=form_data_profile_country]").remove(); + var state_parent = $("input[name=form_data_profile_state]").parent(); + $("input[name=form_data_profile_state]").remove(); + var homecountry_parent = $("input[name=form_data_profile_homecountry]").parent(); + $("input[name=form_data_profile_homecountry]").remove(); + var homestate_parent = $("input[name=form_data_profile_homestate]").parent(); + $("input[name=form_data_profile_homestate]").remove(); + var from_parent = $("input[name=form_data_profile_attended_from]").parent(); + $("input[name=form_data_profile_attended_from]").remove(); + var to_parent = $("input[name=form_data_profile_attended_to]").parent(); + $("input[name=form_data_profile_attended_to]").remove(); + country_parent.parent().css("border-bottom","#CCC 1px dotted"); + $("input[name=form_data_profile_city]").parent().parent().css("border-top","#CCC 1px dotted"); + + + /* set up various year inputs */ + + var x = 1900, html = ""; + var curYear = (new Date()).getFullYear(); + var selYear = document.createElement("select"); selYear.name = "form_data_profile_dob_year"; - var x = 1900, html = ""; - while (x++ < (new Date()).getFullYear()) { + + while (x++ < curYear) { html+= '<option'; if (x == dob_year) { html += ' selected="selected"' @@ -122,9 +153,303 @@ if ($vars['title'] == "Edit profile") { } selYear.innerHTML = html; + + var selFrom = document.createElement("select"); + selFrom.name = "form_data_profile_attended_from"; + x = 1940; + html = ""; + while (x++ < curYear + 6) { + html+= '<option'; + if (x == from_year) { + html += ' selected="selected"' + } + html += '>' + x + '</option>'; + + } + selFrom.innerHTML = html; + from_parent.append(selFrom); + + var selTo = document.createElement("select"); + selTo.name = "form_data_profile_attended_to"; + x = 1940; + html = ""; + while (x++ < curYear + 6) { + html+= '<option'; + if (x == to_year) { + html += ' selected="selected"' + } + html += '>' + x + '</option>'; + + } + selTo.innerHTML = html; + from_parent.append(" to "); + from_parent.append(selTo); + to_parent.parent().remove(); + + var states = ["", "AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NJ", "NM", "NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY"]; + + var countries = ["USA", + "Afghanistan", + "Albania", + "Algeria", + "Andorra", + "Angola", + "Antigua and Barbuda", + "Argentina", + "Armenia", + "Australia", + "Austria", + "Azerbaijan", + "Bahamas", + "Bahrain", + "Bangladesh", + "Barbados", + "Belarus", + "Belgium", + "Belize", + "Benin", + "Bhutan", + "Bolivia", + "Bosnia and Herzegovina", + "Botswana", + "Brazil", + "Brunei", + "Bulgaria", + "Burkina Faso", + "Burundi", + "Cambodia", + "Cameroon", + "Canada", + "Cape Verde", + "Central African Republic", + "Chad", + "Chile", + "China", + "Colombi", + "Comoros", + "Congo (Brazzaville)", + "Congo", + "Costa Rica", + "Cote d'Ivoire", + "Croatia", + "Cuba", + "Cyprus", + "Czech Republic", + "Denmark", + "Djibouti", + "Dominica", + "Dominican Republic", + "East Timor (Timor Timur)", + "Ecuador", + "Egypt", + "El Salvador", + "Equatorial Guinea", + "Eritrea", + "Estonia", + "Ethiopia", + "Fiji", + "Finland", + "France", + "Gabon", + "Gambia, The", + "Georgia", + "Germany", + "Ghana", + "Greece", + "Grenada", + "Guatemala", + "Guinea", + "Guinea-Bissau", + "Guyana", + "Haiti", + "Honduras", + "Hungary", + "Iceland", + "India", + "Indonesia", + "Iran", + "Iraq", + "Ireland", + "Israel", + "Italy", + "Jamaica", + "Japan", + "Jordan", + "Kazakhstan", + "Kenya", + "Kiribati", + "Korea, North", + "Korea, South", + "Kuwait", + "Kyrgyzstan", + "Laos", + "Latvia", + "Lebanon", + "Lesotho", + "Liberia", + "Libya", + "Liechtenstein", + "Lithuania", + "Luxembourg", + "Macedonia", + "Madagascar", + "Malawi", + "Malaysia", + "Maldives", + "Mali", + "Malta", + "Marshall Islands", + "Mauritania", + "Mauritius", + "Mexico", + "Micronesia", + "Moldova", + "Monaco", + "Mongolia", + "Morocco", + "Mozambique", + "Myanmar", + "Namibia", + "Nauru", + "Nepa", + "Netherlands", + "New Zealand", + "Nicaragua", + "Niger", + "Nigeria", + "Norway", + "Oman", + "Pakistan", + "Palau", + "Panama", + "Papua New Guinea", + "Paraguay", + "Peru", + "Philippines", + "Poland", + "Portugal", + "Qatar", + "Romania", + "Russia", + "Rwanda", + "Saint Kitts and Nevis", + "Saint Lucia", + "Saint Vincent", + "Samoa", + "San Marino", + "Sao Tome and Principe", + "Saudi Arabia", + "Senegal", + "Serbia and Montenegro", + "Seychelles", + "Sierra Leone", + "Singapore", + "Slovakia", + "Slovenia", + "Solomon Islands", + "Somalia", + "South Africa", + "Spain", + "Sri Lanka", + "Sudan", + "Suriname", + "Swaziland", + "Sweden", + "Switzerland", + "Syria", + "Taiwan", + "Tajikistan", + "Tanzania", + "Thailand", + "Togo", + "Tonga", + "Trinidad and Tobago", + "Tunisia", + "Turkey", + "Turkmenistan", + "Tuvalu", + "Uganda", + "Ukraine", + "United Arab Emirates", + "United Kingdom", + + "Uruguay", + "Uzbekistan", + "Vanuatu", + "Vatican City", + "Venezuela", + "Vietnam", + "Yemen", + "Zambia", + "Zimbabwe"]; + + var selCountry = document.createElement("select"); + selCountry.name = "form_data_profile_country"; + html = ""; + for (var i = 0, l = countries.length; i < l; i++){ + html+= '<option'; + if (countries[i] == current_country) { + html += ' selected="selected"' + } + html += '>' + countries[i] + '</option>'; + } + /*if (current_country == "") { + html += '<option selected="selected" value="">-Select your country-</option>'; + }*/ + selCountry.innerHTML = html; + + var selState = document.createElement("select"); + selState.name = "form_data_profile_state"; + html = ""; + for (var i = 0, l = states.length; i < l; i++){ + html+= '<option'; + if (states[i] == current_state) { + html += ' selected="selected"' + } + html += '>' + states[i] + '</option>'; + } + /*if (current_state == "") { + html += '<option selected="selected" value=""> </option>'; + }*/ + selState.innerHTML = html; + + var selhomeCountry = document.createElement("select"); + selhomeCountry.name = "form_data_profile_homecountry"; + html = ""; + for (var i = 0, l = countries.length; i < l; i++){ + html+= '<option'; + if (countries[i] == home_country) { + html += ' selected="selected"' + } + html += '>' + countries[i] + '</option>'; + } + /*if (home_country == "") { + html += '<option selected="selected" value="">-Select your country-</option>'; + }*/ + selhomeCountry.innerHTML = html; + + var selhomeState = document.createElement("select"); + selhomeState.name = "form_data_profile_homestate"; + html = ""; + for (var i = 0, l = states.length; i < l; i++){ + html+= '<option'; + if (states[i] == home_state) { + html += ' selected="selected"' + } + html += '>' + states[i] + '</option>'; + } + /*if (home_state == "") { + html += '<option selected="selected" value=""> </option>'; + }*/ + selhomeState.innerHTML = html; + $("select[name=form_data_profile_dob_month]").parent().append(selYear); - $("select[name=form_data_profile_dob_day]").insertBefore($("select[name=form_data_profile_dob_year]")); + country_parent.append(selCountry); + state_parent.append(selState); + homecountry_parent.append(selhomeCountry); + homestate_parent.append(selhomeState); + $("select[name=form_data_profile_dob_day]").insertBefore($("select[name=form_data_profile_dob_year]")); // don't display the latitude/longitude fields $("input[name=form_data_latitude],input[name=form_data_longitude]").parent().parent().hide();