forked from science-ation/science-ation
Update the status on save and on page load
This commit is contained in:
parent
d954d148d6
commit
dbad8ae320
@ -63,7 +63,7 @@
|
||||
'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}$',
|
||||
'format' => '\'NNN-NNN-NNNN\'',),
|
||||
'postalcode' => array('name' => $config['postalzip'],
|
||||
'regexp' => '^(([A-Z][0-9][A-Z]( )?[0-9][A-Z][0-9])|([0-9]{5}))$',
|
||||
'regexp' => '^(([A-Za-z][0-9][A-Za-z]( )?[0-9][A-Za-z][0-9])|([0-9]{5}))$',
|
||||
'format' => '\'ANA NAN\' or \'ANANAN\' or \'NNNNN\'',),
|
||||
|
||||
);
|
||||
@ -81,6 +81,7 @@ if($eid != $_SESSION['users_id']) {
|
||||
* a committee member */
|
||||
user_auth_required('committee','admin');
|
||||
}
|
||||
$type = $_SESSION['users_type'];
|
||||
|
||||
$u = user_load($eid);
|
||||
/* Load the fields the user can edit, and theones that are required */
|
||||
@ -160,12 +161,19 @@ case 'save':
|
||||
user_save($u);
|
||||
happy_("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname']));
|
||||
}
|
||||
|
||||
//reload the user record because we dont know if we saved or didnt save above, we just want
|
||||
//to know what the user looks like _now_
|
||||
$u = user_load($users_id);
|
||||
$newstatus=user_personal_info_status($u);
|
||||
echo "<script type=\"text/javascript\">";
|
||||
echo "personal_update_status('$newstatus');\n";
|
||||
echo "</script>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$type = $_SESSION['users_type'];
|
||||
//send the header
|
||||
if($_SESSION['embed'] == true) {
|
||||
echo "<br/>";
|
||||
@ -179,6 +187,7 @@ case 'save':
|
||||
);
|
||||
}
|
||||
|
||||
$newstatus=user_personal_info_status($u);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function personal_save()
|
||||
@ -186,28 +195,22 @@ function personal_save()
|
||||
$("#debug").load("<?=$config['SFIABDIRECTORY']?>/user_personal.php?action=save", $("#personal_form").serializeArray());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?
|
||||
|
||||
|
||||
foreach($errorfields as $f) {
|
||||
echo error(i18n('\'%1\' must use the format: %2',
|
||||
array(i18n($user_personal_fields[$f]['name']),
|
||||
$user_personal_fields[$f]['format'])));
|
||||
function personal_update_status(s) {
|
||||
if(s!='complete') {
|
||||
$("#personal_info_status").html('<?=error(i18n("Personal Information Incomplete"))?>');
|
||||
}
|
||||
if(count($errorfields)) {
|
||||
echo error(i18n('Information will not be saved until the above errors are corrected'));
|
||||
} else {
|
||||
//output the current status
|
||||
$newstatus=user_personal_info_status($u);
|
||||
if($newstatus!='complete')
|
||||
echo error(i18n("Personal Information Incomplete"));
|
||||
else
|
||||
echo happy(i18n("Personal Information Complete"));
|
||||
|
||||
$("#personal_info_status").html('<?=happy(i18n("Personal Information Complete"))?>');
|
||||
}
|
||||
|
||||
//when we're ready, output the status
|
||||
$(document).ready( function() { personal_update_status('<?=$newstatus?>');});
|
||||
|
||||
</script>
|
||||
<?
|
||||
echo "<div id=\"personal_info_status\"></div>";
|
||||
|
||||
if(count($u['types']) > 1) {
|
||||
$roles='';
|
||||
foreach($u['types'] as $t) {
|
||||
|
Loading…
Reference in New Issue
Block a user