Skip to content
Snippets Groups Projects
Commit 220751fb authored by Matthew Juhl's avatar Matthew Juhl
Browse files

Modifications of profile editor. Still a few things to work out in enhanceProfileForm.js.

parent d9347668
No related branches found
No related tags found
No related merge requests found
<script type="text/javascript">
(function(){
// Edit Profile Stuff
function updateLL () {
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);
$("input[name=form_data_latitude]").val(data.latitude);
$("input[name=form_data_longitude]").val(data.longitude);
WDN.log("Long/lat: " + data.latitude + "/" + data.longitude);
} catch (e) {}
});
};
......@@ -19,6 +24,7 @@
var data = eval(response);
$("input[name=form_data_hometown_latitude]").val(data.latitude);
$("input[name=form_data_hometown_longitude]").val(data.longitude);
WDN.log("Long/lat: " + data.latitude + "/" + data.longitude);
} catch (e) {}
});
};
......@@ -40,23 +46,6 @@
$("input[name=form_data_profile_dob_year]").remove();
// wrap the fields in <li>s
$("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({
fontSize: "75%",
color: "#1091D1"
})*/;
});
$("form.cool fieldset input[type!=submit], form.cool fieldset select, form.cool fieldset textarea").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();
......@@ -72,9 +61,7 @@
var to_parent = $("input[name=form_data_profile_attended_to]").parent();
$("input[name=form_data_profile_attended_to]").remove();
$("input[name=form_data_map_explanation]").parent().parent().css("border-bottom","#CCC 1px dotted");
$("input[name=form_data_profile_city]").parent().parent().prepend('<h6><strong>Your Map Location</strong></h6>'
+ '<p>Please enter the location you want to use for yourself on the map.</p>');
$("input[name=form_data_profile_city]").parent().find("label").html('Your map location <span class="helper">Please enter the location you want to use for yourself on the map</span>');
/* set up various year inputs */
......@@ -126,7 +113,7 @@
$(selTo).html(html);
from_parent.append(" to ");
from_parent.append(selTo);
to_parent.parent().remove();
//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", "NV", "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"];
......@@ -394,13 +381,15 @@
$("input[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();
$("input[name=form_data_latitude],input[name=form_data_longitude]").parent().hide();
// update the lat/long automatically whenever current location is changed
$("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();
$("input[name=form_data_hometown_latitude],input[name=form_data_hometown_longitude]").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();
......@@ -484,9 +473,9 @@
$("input[name=form_data_info_alumni_opt_in]").parent().parent().children("label").css("width","350px");
function alumniCheckbox () {
if ($("select[name=form_data_profile_role]").val() == "Alumnus") {
$("input[name=form_data_info_alumni_opt_in]").parent().parent().show();
$("input[name=form_data_info_alumni_opt_in]").parent().show();
} else {
$("input[name=form_data_info_alumni_opt_in]").parent().parent().hide();
$("input[name=form_data_info_alumni_opt_in]").parent().hide();
}
};
......
<?php
/**
* Elgg field display
* Displays the specified Elgg title, field and description
*
* @package Elgg
* @subpackage Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
$field = $vars['field'];
$title = $vars['title'];
$description = $vars['description'];
$internalname = preg_replace('/\<[\w\W]+name="/i','',$vars['field']);
$internalname = trim(preg_replace('/"[\W\w]*\>/i','',$internalname));
$body = <<<END
<li>
<label for="$internalname">
$title
<span class="helper">$description</span>
</label>
$field
</li>
END;
print $body;
?>
\ No newline at end of file
<?php
/**
* Elgg text input
* Displays a text input field
*
* @package Elgg
* @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*
* @uses $vars['value'] The current value, if any
* @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
* @uses $vars['disabled'] If true then control is read-only
* @uses $vars['class'] Class override
*/
$class = $vars['class'];
if (!$class) $class = "input-text";
if (isset($vars['internalid'])) {
$id_bit = ' id = "'.$vars['internalid'].'" ';
} else {
$id_bit = '';
}
?>
<input type="text" <?php echo $id_bit; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($vars['value'], null, 'UTF-8'); ?>" class="<?php echo $class ?>"/>
\ No newline at end of file
......@@ -72,22 +72,6 @@ if (preg_match('/friend/', $vars['title'])) { // if on a friends page, interst l
?>
<style type="text/css">
#maincontent form.cool {
display: none;
}
#maincontent form.cool div.element {
__margin: 0;
}
#maincontent form.cool label {
vertical-align: inherit !important;
}
#maincontent form.cool fieldset li {
padding-bottom: 15px;
}
#maincontent form.cool input[name$="city"] {
text-transform: capitalize;
......
<?php
/**
* Elgg flex profile edit form
* Allows user to edit profile
*
* @package Elgg
* @subpackage Form
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
/* copied from flexprofile and modified for UNL */
// Load flexprofile model
require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/flexprofile/models/model.php");
include(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/unl_theme/scripts/JS/enhanceProfileForm.php');
$user = $vars['entity'];
$form = flexprofile_get_profile_form($user);
if ($form) {
$tab_data = flexprofile_get_data_for_edit_form($form, $user);
if ($_GET['firstlogin'] == 'yes'){
?>
<div class="zenbox soothing">
<h3>Thanks for joining Planet Red!</h3>
<p>You're just a few quick steps from putting yourself on the map. Start by filling out your profile information.</p>
</div>
<?php
}
//echo '<div id="formloading"><img src="/wdn/templates_3.0/css/header/images/colorbox/loading.gif" alt="Loading Form" /><noscript>Please enable JavaScript to use the profile editor.</noscript></div>';
echo '<form action="'.$vars['url'].'action/flexprofile/edit" method="post" enctype="multipart/form-data" class="zenform cool">';
echo elgg_view('input/securitytoken');
echo "<fieldset><ol>";
echo elgg_view('form/forms/display_form_content',array('tab_data'=>$tab_data,'description'=>'','preview'=>0,'form'=>$form,'form_data_id'=>0));
if ($_GET['firstlogin'] == 'yes'){
?>
<input type="hidden" name="firstlogin" value="yes" />
<?php
}
echo "</ol></fieldset>";
?>
<p>
<input type="hidden" name="username" value="<?php echo page_owner_entity()->username; ?>" />
<input type="submit" value="<?php echo elgg_echo("save"); ?>" />
</p>
<?php
echo '</form>';
} else {
echo elgg_echo('form:error_no_profile_form');
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment