Formatting changes

This commit is contained in:
Miles Lott 2001-03-26 14:16:16 +00:00
parent e6d9173490
commit e0d2f43d0a

View File

@ -16,14 +16,14 @@
'currentapp' => 'admin', 'currentapp' => 'admin',
'parent_page' => 'accounts.php' 'parent_page' => 'accounts.php'
); );
include('../header.inc.php'); include('../header.inc.php');
// creates the html for the user data // creates the html for the user data
function createPageBody($_account_id,$_userData='',$_errors='') function createPageBody($_account_id,$_userData='',$_errors='')
{ {
global $phpgw, $phpgw_info; global $phpgw, $phpgw_info;
$t = new Template($phpgw->common->get_tpl_dir('admin')); $t = new Template($phpgw->common->get_tpl_dir('admin'));
$t->set_unknowns('remove'); $t->set_unknowns('remove');
$t->set_file(array( $t->set_file(array(
@ -31,7 +31,7 @@
'form_passwordinfo' => 'account_form_password.tpl', 'form_passwordinfo' => 'account_form_password.tpl',
'form_buttons_' => 'account_form_buttons.tpl', 'form_buttons_' => 'account_form_buttons.tpl',
)); ));
if ($_userData) if ($_userData)
{ {
$userData=$_userData; $userData=$_userData;
@ -114,7 +114,6 @@
$groups_select .= '</select>'; $groups_select .= '</select>';
$t->set_var('groups_select',$groups_select); $t->set_var('groups_select',$groups_select);
// create list of available apps // create list of available apps
$i = 0; $i = 0;
@ -137,7 +136,6 @@
// create apps output // create apps output
@reset($db_perms); @reset($db_perms);
for ($i=0;$i<=count($perm_display);$i++) for ($i=0;$i<=count($perm_display);$i++)
{ {
$checked = ''; $checked = '';
@ -145,7 +143,7 @@
{ {
$checked = ' checked'; $checked = ' checked';
} }
if ($perm_display[$i]['translatedName']) if ($perm_display[$i]['translatedName'])
{ {
$part1 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>', $part1 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
@ -155,13 +153,13 @@
} }
$i++; $i++;
$checked = ''; $checked = '';
if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]) if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
{ {
$checked = ' checked'; $checked = ' checked';
} }
if ($perm_display[$i]['translatedName']) if ($perm_display[$i]['translatedName'])
{ {
$part2 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>', $part2 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
@ -176,7 +174,7 @@
$appRightsOutput .= sprintf('<tr bgcolor="%s">%s%s</tr>',$phpgw_info['theme']['row_on'], $part1, $part2); $appRightsOutput .= sprintf('<tr bgcolor="%s">%s%s</tr>',$phpgw_info['theme']['row_on'], $part1, $part2);
} }
$t->set_var('permissions_list',$appRightsOutput); $t->set_var('permissions_list',$appRightsOutput);
echo $t->finish($t->parse('out','form')); echo $t->finish($t->parse('out','form'));
@ -195,13 +193,12 @@
} }
$apps = CreateObject('phpgwapi.applications',array(intval($_userData['account_id']),'u')); $apps = CreateObject('phpgwapi.applications',array(intval($_userData['account_id']),'u'));
# $apps->read_installed_apps();
# $apps_before = $apps->read_account_specific();
$apps->account_type = 'u'; $apps->account_type = 'u';
$apps->account_id = $_userData['account_id']; $apps->account_id = $_userData['account_id'];
$apps->account_apps = Array(Array()); $apps->account_apps = Array(Array());
if ($_userData['account_permissions']) { if ($_userData['account_permissions'])
{
while($app = each($_userData['account_permissions'])) while($app = each($_userData['account_permissions']))
{ {
if($app[1]) if($app[1])
@ -216,10 +213,9 @@
} }
$apps->save_repository(); $apps->save_repository();
$account = CreateObject('phpgwapi.accounts'); $account = CreateObject('phpgwapi.accounts');
$allGroups = $account->get_list('groups'); $allGroups = $account->get_list('groups');
if ($_userData['account_groups']) { if ($_userData['account_groups']) {
reset($_userData['account_groups']); reset($_userData['account_groups']);
while (list($key,$value) = each($_userData['account_groups'])) { while (list($key,$value) = each($_userData['account_groups'])) {
@ -246,16 +242,16 @@
} }
} }
} }
// checks if the userdata are valid // checks if the userdata are valid
// returns FALSE if the data are correct // returns FALSE if the data are correct
// otherwise the error array // otherwise the error array
function userDataInvalid($_userData) function userDataInvalid($_userData)
{ {
global $phpgw_info; global $phpgw_info;
$totalerrors = 0; $totalerrors = 0;
if ($phpgw_info['server']['account_repository'] == 'ldap' && ! $allow_long_loginids) if ($phpgw_info['server']['account_repository'] == 'ldap' && ! $allow_long_loginids)
{ {
if (strlen($_userData['account_lid']) > 8) if (strlen($_userData['account_lid']) > 8)
@ -264,7 +260,7 @@
$totalerrors++; $totalerrors++;
} }
} }
if ($_userData['old_loginid'] != $_userData['account_lid']) if ($_userData['old_loginid'] != $_userData['account_lid'])
{ {
if (account_exsists($_userData['account_loginid'])) if (account_exsists($_userData['account_loginid']))
@ -273,7 +269,7 @@
$totalerrors++; $totalerrors++;
} }
} }
if ($_userData['account_passwd'] || $_userData['account_passwd_2']) if ($_userData['account_passwd'] || $_userData['account_passwd_2'])
{ {
if ($_userData['account_passwd'] != $_userData['account_passwd_2']) if ($_userData['account_passwd'] != $_userData['account_passwd_2'])
@ -282,13 +278,13 @@
$totalerrors++; $totalerrors++;
} }
} }
if (!count($_userData['account_permissions']) && !count($_userData['account_groups'])) if (!count($_userData['account_permissions']) && !count($_userData['account_groups']))
{ {
$error[$totalerrors] = lang('You must add at least 1 permission or group to this account'); $error[$totalerrors] = lang('You must add at least 1 permission or group to this account');
$totalerrors++; $totalerrors++;
} }
if ($totalerrors == 0) if ($totalerrors == 0)
{ {
return FALSE; return FALSE;
@ -298,7 +294,7 @@
return $error; return $error;
} }
} }
// todo // todo
// not needed if i use the same file for new users too // not needed if i use the same file for new users too
if (! $account_id) if (! $account_id)
@ -397,5 +393,4 @@
{ {
$phpgw->common->hook_single('show_user_data', $app[0]); $phpgw->common->hook_single('show_user_data', $app[0]);
} }
?> ?>