diff --git a/unl_theme/views/default/page_elements/header.php b/unl_theme/views/default/page_elements/header.php index d8ed28b31b844fd3962f0fc58cfa309ac98880e6..77be2c51a158f9df69a2041f46b2dc11e0ec8794 100644 --- a/unl_theme/views/default/page_elements/header.php +++ b/unl_theme/views/default/page_elements/header.php @@ -71,7 +71,7 @@ if ($vars['title'] == "Edit profile") { (function(){ // Edit Profile Stuff function updateLL () { - var city = $("input[name=form_data_profile_city]").val(), state = $("input[name=form_data_profile_state]").val(), country = $("input[name=form_data_profile_country]").val(); + var city = $("input[name=form_data_profile_city]").val(), state = $("select[name=form_data_profile_state]").val(), country = $("select[name=form_data_profile_country]").val(); $.get("<?php echo $vars['url']; ?>mod/unl_theme/scripts/latlon.php",{city:city,state:state,country:country},function(response){ try { var data = eval(response); @@ -80,11 +80,22 @@ if ($vars['title'] == "Edit profile") { } catch (e) {} }); }; + + function updateLLhome () { + var city = $("input[name=form_data_profile_homecity]").val(), state = $("select[name=form_data_profile_homestate]").val(), country = $("select[name=form_data_profile_homecountry]").val(); + $.get("<?php echo $vars['url']; ?>mod/unl_theme/scripts/latlon.php",{city:city,state:state,country:country},function(response){ + try { + var data = eval(response); + $("input[name=form_data_hometown_latitude]").val(data.latitude); + $("input[name=form_data_hometown_longitude]").val(data.longitude); + } catch (e) {} + }); + }; $(document).ready(function(){ /* SET UP PROFILE EDIT FORM */ - - + $("form.cool fieldset:first-child").css("margin-top","0"); + $("p.form-description").remove(); // get the year and country values for later use var dob_year = $("input[name=form_data_profile_dob_year]").val(); @@ -131,8 +142,8 @@ if ($vars['title'] == "Edit profile") { 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"); + $("input[name=form_data_map_explanation]").parent().parent().css("border-bottom","#CCC 1px dotted"); + $("input[name=form_data_profile_city]").parent().parent().prepend('<h6 style="width:150px;margin:0;text-align:right;"><strong>Your Map Location</strong></h6>'); /* set up various year inputs */ @@ -454,10 +465,16 @@ if ($vars['title'] == "Edit profile") { // don't display the latitude/longitude fields $("input[name=form_data_latitude],input[name=form_data_longitude]").parent().parent().hide(); // update the lat/long automatically whenever current location is changed - $("input[name=form_data_profile_city],input[name=form_data_profile_state],input[name=form_data_profile_country]").change(function(){ + $("input[name=form_data_profile_city],select[name=form_data_profile_state],select[name=form_data_profile_country]").change(function(){ updateLL(); }); + $("input[name=form_data_hometown_latitude],input[name=form_data_hometown_longitude]").parent().parent().hide(); + // update the lat/long automatically whenever current location is changed + $("input[name=form_data_profile_homecity],select[name=form_data_profile_homestate],select[name=form_data_profile_homecountry]").change(function(){ + updateLLhome(); + }); + $("form.cool label").each(function(){ if (this.innerHTML.match(/day/i) || this.innerHTML.match(/year\s*$/i) ){ $(this).parent().remove();