update xslt

This commit is contained in:
ceb 2003-04-27 00:17:58 +00:00
parent 659b0cc03a
commit a2bce3e3a2
4 changed files with 419 additions and 503 deletions

View File

@ -17,8 +17,6 @@
(
'list_groups' => True,
'list_users' => True,
'add_group' => True,
'add_user' => True,
'delete_group' => True,
'delete_user' => True,
'edit_user' => True,
@ -274,116 +272,6 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('account_list' => $data));
}
function add_user()
{
if ($GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$this->list_users();
}
else
{
$this->create_edit_user(0);
}
}
function delete_group()
{
$account_id = get_var('account_id',array('POST','GET'));
if ($GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
{
$this->list_groups();
return False;
}
if ($account_id && get_var('confirm',array('POST')))
{
$this->bo->delete_group($account_id);
$this->list_groups();
return False;
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_delete'));
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . lang('delete group');
$data = array
(
'delete_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account_id),
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
'lang_yes' => lang('Yes'),
'lang_no' => lang('No'),
'lang_yes_statustext' => lang('Delete the entry'),
'lang_no_statustext' => lang('Back to the list'),
'lang_error_msg' => lang('are you sure you want to delete this group ?')
);
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location(intval($account_id),1,'phpgw_group');
if($old_group_list)
{
$group_name = $GLOBALS['phpgw']->accounts->id2name($account_id);
$user_list = '';
while (list(,$id) = each($old_group_list))
{
$data['user_list'][] = array
(
'user_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_user&account_id=' . $id),
'user_name' => $GLOBALS['phpgw']->common->grab_owner_name($id),
'lang_user_url_statustext' => lang('edit user')
);
}
$data['lang_confirm_msg'] = lang('the users bellow are still members of group %1',$group_name) . '. '
. lang('they must be removed before you can continue');
$data['lang_remove_user'] = lang('Remove all users from this group ?');
}
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function delete_user()
{
if ($GLOBALS['phpgw']->acl->check('account_access',32,'admin') || $GLOBALS['phpgw_info']['user']['account_id'] == $_GET['account_id'])
{
$this->list_users();
return False;
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_file(
Array(
'form' => 'delete_account.tpl'
)
);
$var = Array(
'form_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boaccounts.delete_user'),
'account_id' => $_GET['account_id']
);
// the account can have special chars/white spaces, if it is a ldap dn
$account_id = rawurlencode($_GET['account_id']);
// Find out who the new owner is of the deleted users records...
$users = $GLOBALS['phpgw']->accounts->get_list('accounts');
$c_users = count($users);
$str = '';
for($i=0;$i<$c_users;$i++)
{
$str .= '<option value='.$users[$i]['account_id'].'>'.$GLOBALS['phpgw']->common->display_fullname($users[$i]['account_lid'],$users[$i]['account_firstname'],$users[$i]['account_lastname']).'</option>'."\n";
}
$var['lang_new_owner'] = lang('Who would you like to transfer ALL records owned by the deleted user to?');
$var['new_owner_select'] = '<select name="new_owner" size="5">'."\n".'<option value=0 selected>'.lang('Delete All Records').'</option>'."\n".$str.'</select>'."\n";
$var['cancel'] = lang('cancel');
$var['delete'] = lang('delete');
$t->set_var($var);
$t->pparse('out','form');
}
function edit_group()
{
$account_id = get_var('account_id',array('POST','GET'));
@ -581,33 +469,263 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('group_edit' => $data));
}
function edit_user($cd='',$account_id='')
function edit_user()
{
if ($GLOBALS['phpgw']->acl->check('account_access',16,'admin'))
$cd = get_var('cd',array('GET'));
$account_id = get_var('account_id',array('GET','POST'));
$values = get_var('values',array('POST'));
$account_groups = get_var('account_groups',array('POST'));
$account_permissions = get_var('account_permissions',array('POST'));
if (!$account_id && $GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$this->list_users();
$this->list_user();
return False;
}
$cdid = $cd;
if ($account_id && $GLOBALS['phpgw']->acl->check('account_access',16,'admin'))
{
$this->list_user();
return False;
}
/*$cdid = $cd;
settype($cd,'integer');
$cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
$accountid = $account_id;
settype($account_id,'integer');
$account_id = ($_GET['account_id']?$_GET['account_id']:intval($accountid));
$account_id = ($_GET['account_id']?$_GET['account_id']:intval($accountid));*/
// todo
// not needed if i use the same file for new users too
if (! $account_id)
if ($values['save'])
{
$this->list_users();
return False;
$error = $this->bo->validate_user($values);
if (is_array($error))
{
}
else
{
if (is_array($account_groups))
{
$values['account_groups'] = $account_groups;
}
if (is_array($account_permissions))
{
$values['account_permissions'] = $account_permissions;
}
if ($values['account_id'])
{
$this->bo->edit_user($values);
$account_id = $values['account_id'];
}
else
{
$this->bo->add_user($values);
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_user'));
}
}
}
else
$sbox = createobject('phpgwapi.sbox');
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] && ($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap'))
{
$this->create_edit_user($account_id);
}
print_debug('Type : '.gettype($_userData).'<br>_userData(size) = "'.$_userData.'"('.strlen($_userData).')');
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data','users'));
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . ($account_id?lang('edit user account'):lang('add user account'));
if (is_array($_userData))
{
$userData = Array();
$userData=$_userData;
@reset($userData['account_groups']);
while (list($key, $value) = @each($userData['account_groups']))
{
$userGroups[$key]['account_id'] = $value;
}
$account = CreateObject('phpgwapi.accounts');
$allGroups = $account->get_list('groups');
}
elseif(is_string($_userData) && $_userData=='')
{
if($_account_id)
{
$account = CreateObject('phpgwapi.accounts',intval($_account_id),'u');
$userData = $account->read_repository();
$userGroups = $account->membership($_account_id);
}
else
{
$account = CreateObject('phpgwapi.accounts');
$userData = Array();
$userData['status'] = 'A';
$userGroups = Array();
}
$allGroups = $account->get_list('groups');
if ($userData['expires'] == -1)
{
$userData['account_expires_month'] = 0;
$userData['account_expires_day'] = 0;
$userData['account_expires_year'] = 0;
}
else
{
/* Change this to be an admin/setup setting. For now, default to expire one week from today. */
$time_var = time() + (60*60*24*7);
$userData['account_expires_month'] = date('m',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
$userData['account_expires_day'] = date('d',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
$userData['account_expires_year'] = date('Y',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
}
}
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'])
{
$lang_homedir = lang('home directory');
$lang_shell = lang('login shell');
$homedirectory = '<input name="homedirectory" value="'
. ($_account_id?$userData['homedirectory']:$GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_lid)
. '">';
$loginshell = '<input name="loginshell" value="'
. ($_account_id?$userData['loginshell']:$GLOBALS['phpgw_info']['server']['ldap_account_shell'])
. '">';
}
$_y = $sbox->getyears('account_expires_year',$userData['account_expires_year'],date('Y'),date('Y')+10);
$_m = $sbox->getmonthtext('account_expires_month',$userData['account_expires_month']);
$_d = $sbox->getdays('account_expires_day',$userData['account_expires_day']);
/* $account_file_space = '';
if (!$userData['file_space'])
{
$userData['file_space'] = $GLOBALS['phpgw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['phpgw_info']['server']['vfs_default_account_size_type'];
}
$file_space_array = explode ('-', $userData['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = ' selected';
$account_file_space = '<input type=text name="account_file_space_number" value="' . trim($account_file_space_number) . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$account_file_space_types = array ('gb', 'mb', 'kb', 'b');
while (list ($num, $type) = each ($account_file_space_types))
{
$account_file_space_select .= '<option value="'.$type.'"' . $account_file_space_type_selected[$type] . '>' . strtoupper ($type) . '</option>';
}
$account_file_space_select .= '</select>';
$var = Array(
'lang_file_space' => 'File space',
'account_file_space' => $account_file_space,
'account_file_space_select' => $account_file_space_select
);
$t->set_var($var);
*/
$groups_select = '';
reset($allGroups);
while (list($key,$value) = each($allGroups))
{
$group_list[] = array
(
'account_id' => $value['account_id'],
'account_lid' => $value['account_lid']
);
for ($i=0; $i<count($userGroups); $i++)
{
/* print "Los1:".$userData["account_id"].$userGroups[$i]['account_id']." : ".$value['account_id']."<br>"; */
if (@$userGroups[$i]['account_id'] == $value['account_id'])
{
$group_list[]['selected'] = 'yes';
}
}
}
/* create list of available apps */
$i = 0;
$apps = CreateObject('phpgwapi.applications',$_account_id);
$db_perms = $apps->read_account_specific();
@reset($GLOBALS['phpgw_info']['apps']);
$availableApps = $GLOBALS['phpgw_info']['apps'];
@asort($availableApps);
@reset($availableApps);
while (list($key,$application) = each($availableApps))
{
if ($application['enabled'] && $application['status'] != 3)
{
$perm_display[$i]['appName'] = $key;
$perm_display[$i]['translatedName'] = $application['title'];
$i++;
}
}
/* create apps output */
$appRightsOutput = '';
// @reset($perm_display);
for ($i=0;$i<count($perm_display);$i++)
{
$app_list[] = array
(
'app_title' => $perm_display[$i]['translatedName'],
'checkbox_name' => 'account_permissions[' . $perm_display[$i]['appName'] . ']',
'checked' => ($userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]?'yes':'')
);
}
$page_params['menuaction'] = 'admin.boaccounts.edit_user';
if($_account_id)
{
$page_params['account_id'] = $_account_id;
$page_params['old_loginid'] = rawurlencode($userData['account_lid']);
}
$data = array
(
'edit_url' => $GLOBALS['phpgw']->link('/index.php',$page_params),
'done_url' => $GLOBALS['phpgw']->link('/admin/index.php'),
'lang_lid' => lang('loginid'),
'lang_account_active' => lang('account active'),
'lang_password' => lang('password'),
'lang_reenter_password' => lang('Re-Enter Password'),
'lang_lastname' => lang('lastname'),
'lang_groups' => lang('groups'),
'lang_expires' => lang('expires'),
'lang_firstname' => lang('firstname'),
'lang_applications' => lang('applications'),
'lang_save' => lang('save'),
'lang_cancel_done' => ((is_array($values) && !$error)?lang('done'):lang('cancel')),
'select_expires' => $GLOBALS['phpgw']->common->dateformatorder($_y,$_m,$_d,True),
'lang_never' => lang('Never'),
'account_lid' => $userData['account_lid'],
'lang_homedir' => $lang_homedir,
'lang_shell' => $lang_shell,
'homedirectory' => $homedirectory,
'loginshell' => $loginshell,
'account_status' => ($userData['status']?'yes':''),
'account_firstname' => $userData['firstname'],
'account_lastname' => $userData['lastname'],
'account_passwd' => $account_passwd,
'account_passwd_2' => $account_passwd_2,
'expires' => (($userData['expires'] == -1)?'yes':''),
'group_list' => $group_list,
'app_list' => $app_list
);
/* create the menu on the left, if needed
$menuClass = CreateObject('admin.uimenuclass');
This is now using ExecMethod()
$t->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','edit_user')); */
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('account_edit' => $data));
}
function view_user()
@ -766,6 +884,104 @@
$t->pfp('out','form');
}
function delete_group()
{
$account_id = get_var('account_id',array('POST','GET'));
if ($GLOBALS['phpgw']->acl->check('group_access',32,'admin'))
{
$this->list_groups();
return False;
}
if ($account_id && get_var('confirm',array('POST')))
{
$this->bo->delete_group($account_id);
$this->list_groups();
return False;
}
$GLOBALS['phpgw']->xslttpl->add_file(array('app_data',$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'app_delete'));
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . lang('delete group');
$data = array
(
'delete_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account_id),
'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'),
'lang_yes' => lang('Yes'),
'lang_no' => lang('No'),
'lang_yes_statustext' => lang('Delete the entry'),
'lang_no_statustext' => lang('Back to the list'),
'lang_error_msg' => lang('are you sure you want to delete this group ?')
);
$old_group_list = $GLOBALS['phpgw']->acl->get_ids_for_location(intval($account_id),1,'phpgw_group');
if($old_group_list)
{
$group_name = $GLOBALS['phpgw']->accounts->id2name($account_id);
$user_list = '';
while (list(,$id) = each($old_group_list))
{
$data['user_list'][] = array
(
'user_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_user&account_id=' . $id),
'user_name' => $GLOBALS['phpgw']->common->grab_owner_name($id),
'lang_user_url_statustext' => lang('edit user')
);
}
$data['lang_confirm_msg'] = lang('the users bellow are still members of group %1',$group_name) . '. '
. lang('they must be removed before you can continue');
$data['lang_remove_user'] = lang('Remove all users from this group ?');
}
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
function delete_user()
{
if ($GLOBALS['phpgw']->acl->check('account_access',32,'admin') || $GLOBALS['phpgw_info']['user']['account_id'] == $_GET['account_id'])
{
$this->list_users();
return False;
}
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_file(
Array(
'form' => 'delete_account.tpl'
)
);
$var = Array(
'form_action' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boaccounts.delete_user'),
'account_id' => $_GET['account_id']
);
// the account can have special chars/white spaces, if it is a ldap dn
$account_id = rawurlencode($_GET['account_id']);
// Find out who the new owner is of the deleted users records...
$users = $GLOBALS['phpgw']->accounts->get_list('accounts');
$c_users = count($users);
$str = '';
for($i=0;$i<$c_users;$i++)
{
$str .= '<option value='.$users[$i]['account_id'].'>'.$GLOBALS['phpgw']->common->display_fullname($users[$i]['account_lid'],$users[$i]['account_firstname'],$users[$i]['account_lastname']).'</option>'."\n";
}
$var['lang_new_owner'] = lang('Who would you like to transfer ALL records owned by the deleted user to?');
$var['new_owner_select'] = '<select name="new_owner" size="5">'."\n".'<option value=0 selected>'.lang('Delete All Records').'</option>'."\n".$str.'</select>'."\n";
$var['cancel'] = lang('cancel');
$var['delete'] = lang('delete');
$t->set_var($var);
$t->pparse('out','form');
}
function group_manager($cd='',$account_id='')
{
if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
@ -801,264 +1017,6 @@
}
}
function create_edit_user($_account_id,$_userData='',$_errors='')
{
$sbox = createobject('phpgwapi.sbox');
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
$t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$t->set_unknowns('remove');
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes'] && ($GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap'))
{
$t->set_file(array('account' => 'account_form_ldap.tpl'));
}
else
{
$t->set_file(array('account' => 'account_form.tpl'));
}
$t->set_block('account','form','form');
$t->set_block('account','form_passwordinfo','form_passwordinfo');
$t->set_block('account','form_buttons_','form_buttons_');
$t->set_block('account','link_row','link_row');
print_debug('Type : '.gettype($_userData).'<br>_userData(size) = "'.$_userData.'"('.strlen($_userData).')');
if (is_array($_userData))
{
$userData = Array();
$userData=$_userData;
@reset($userData['account_groups']);
while (list($key, $value) = @each($userData['account_groups']))
{
$userGroups[$key]['account_id'] = $value;
}
$account = CreateObject('phpgwapi.accounts');
$allGroups = $account->get_list('groups');
}
elseif(is_string($_userData) && $_userData=='')
{
if($_account_id)
{
$account = CreateObject('phpgwapi.accounts',intval($_account_id),'u');
$userData = $account->read_repository();
$userGroups = $account->membership($_account_id);
}
else
{
$account = CreateObject('phpgwapi.accounts');
$userData = Array();
$userData['status'] = 'A';
$userGroups = Array();
}
$allGroups = $account->get_list('groups');
if ($userData['expires'] == -1)
{
$userData['account_expires_month'] = 0;
$userData['account_expires_day'] = 0;
$userData['account_expires_year'] = 0;
}
else
{
/* Change this to be an admin/setup setting. For now, default to expire one week from today. */
$time_var = time() + (60*60*24*7);
$userData['account_expires_month'] = date('m',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
$userData['account_expires_day'] = date('d',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
$userData['account_expires_year'] = date('Y',$userData['expires'] > 0 ? $userData['expires'] : $time_var);
}
}
$page_params['menuaction'] = 'admin.boaccounts.'.($_account_id?'edit':'add').'_user';
if($_account_id)
{
$page_params['account_id'] = $_account_id;
$page_params['old_loginid'] = rawurlencode($userData['account_lid']);
}
$var = Array(
'form_action' => $GLOBALS['phpgw']->link('/index.php',$page_params),
'cancel_action' => $GLOBALS['phpgw']->link('/admin/index.php'),
'error_messages' => (!$_errors?'':'<center>'.$GLOBALS['phpgw']->common->error_list($_errors).'</center>'),
'lang_action' => ($_account_id?lang('Edit user account'):lang('Add new account')),
'lang_loginid' => lang('LoginID'),
'lang_account_active' => lang('Account active'),
'lang_password' => lang('Password'),
'lang_reenter_password' => lang('Re-Enter Password'),
'lang_lastname' => lang('Last Name'),
'lang_groups' => lang('Groups'),
'lang_expires' => lang('Expires'),
'lang_firstname' => lang('First Name'),
'lang_button' => ($_account_id?lang('Save'):lang('Add')),
'lang_cancel' => lang('Cancel')
/* 'lang_file_space' => lang('File Space') */
);
$t->set_var($var);
$t->parse('form_buttons','form_buttons_',True);
if ($GLOBALS['phpgw_info']['server']['ldap_extra_attributes']) {
$lang_homedir = lang('home directory');
$lang_shell = lang('login shell');
$homedirectory = '<input name="homedirectory" value="'
. ($_account_id?$userData['homedirectory']:$GLOBALS['phpgw_info']['server']['ldap_account_home'].SEP.$account_lid)
. '">';
$loginshell = '<input name="loginshell" value="'
. ($_account_id?$userData['loginshell']:$GLOBALS['phpgw_info']['server']['ldap_account_shell'])
. '">';
}
else
{
$lang_homedir = '';
$lang_shell = '';
$homedirectory = '';
$loginshell = '';
}
$_y = $sbox->getyears('account_expires_year',$userData['account_expires_year'],date('Y'),date('Y')+10);
$_m = $sbox->getmonthtext('account_expires_month',$userData['account_expires_month']);
$_d = $sbox->getdays('account_expires_day',$userData['account_expires_day']);
$account_file_space = '';
/*
if (!$userData['file_space'])
{
$userData['file_space'] = $GLOBALS['phpgw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['phpgw_info']['server']['vfs_default_account_size_type'];
}
$file_space_array = explode ('-', $userData['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = ' selected';
$account_file_space = '<input type=text name="account_file_space_number" value="' . trim($account_file_space_number) . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$account_file_space_types = array ('gb', 'mb', 'kb', 'b');
while (list ($num, $type) = each ($account_file_space_types))
{
$account_file_space_select .= '<option value="'.$type.'"' . $account_file_space_type_selected[$type] . '>' . strtoupper ($type) . '</option>';
}
$account_file_space_select .= '</select>';
$var = Array(
'lang_file_space' => 'File space',
'account_file_space' => $account_file_space,
'account_file_space_select' => $account_file_space_select
);
$t->set_var($var);
*/
$var = Array(
'input_expires' => $GLOBALS['phpgw']->common->dateformatorder($_y,$_m,$_d,True),
'lang_never' => lang('Never'),
'account_lid' => '<input name="account_lid" value="' . $userData['account_lid'] . '">',
'lang_homedir' => $lang_homedir,
'lang_shell' => $lang_shell,
'homedirectory' => $homedirectory,
'loginshell' => $loginshell,
'account_status' => '<input type="checkbox" name="account_status" value="A"'.($userData['status']?' checked':'').'>',
'account_firstname' => '<input name="account_firstname" value="' . $userData['firstname'] . '">',
'account_lastname' => '<input name="account_lastname" value="' . $userData['lastname'] . '">',
'account_passwd' => $account_passwd,
'account_passwd_2' => $account_passwd_2,
'account_file_space' => $account_file_space
);
if($userData['expires'] == -1)
{
$var['never_expires'] = '<input type="checkbox" name="never_expires" value="True" checked>';
}
else
{
$var['never_expires'] = '<input type="checkbox" name="never_expires" value="True">';
}
$t->set_var($var);
$t->parse('password_fields','form_passwordinfo',True);
// $allAccounts;
// $userGroups;
$groups_select = '';
reset($allGroups);
while (list($key,$value) = each($allGroups))
{
$groups_select .= '<option value="' . $value['account_id'] . '"';
for ($i=0; $i<count($userGroups); $i++)
{
/* print "Los1:".$userData["account_id"].$userGroups[$i]['account_id']." : ".$value['account_id']."<br>"; */
if (@$userGroups[$i]['account_id'] == $value['account_id'])
{
$groups_select .= ' selected';
}
}
$groups_select .= '>' . $value['account_lid'] . '</option>'."\n";
}
/* create list of available apps */
$i = 0;
$apps = CreateObject('phpgwapi.applications',$_account_id);
$db_perms = $apps->read_account_specific();
@reset($GLOBALS['phpgw_info']['apps']);
$availableApps = $GLOBALS['phpgw_info']['apps'];
@asort($availableApps);
@reset($availableApps);
while (list($key,$application) = each($availableApps))
{
if ($application['enabled'] && $application['status'] != 3)
{
$perm_display[$i]['appName'] = $key;
$perm_display[$i]['translatedName'] = $application['title'];
$i++;
}
}
/* create apps output */
$appRightsOutput = '';
// @reset($perm_display);
for ($i=0;$i<count($perm_display);$i++)
{
if ($perm_display[$i]['translatedName'])
{
$part1 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
$perm_display[$i]['translatedName'],
$perm_display[$i]['appName'],
($userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]?' checked':''));
}
$i++;
if ($perm_display[$i]['translatedName'])
{
$part2 = sprintf('<td>%s</td><td><input type="checkbox" name="account_permissions[%s]" value="True"%s></td>',
$perm_display[$i]['translatedName'],
$perm_display[$i]['appName'],
($userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']]?' checked':''));
}
else
{
$part2 = '<td colspan="2">&nbsp;</td>';
}
$appRightsOutput .= '<tr class="'.($i&2?'row_off':'row_on').'">'.$part1.$part2.'</tr>';
}
$var = Array(
'groups_select' => '<select name="account_groups[]" multiple>'."\n".$groups_select.'</select>'."\n",
'permissions_list' => $appRightsOutput
);
$t->set_var($var);
// create the menu on the left, if needed
// $menuClass = CreateObject('admin.uimenuclass');
// This is now using ExecMethod()
$t->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','edit_user'));
echo $t->fp('out','form');
}
function edit_group_managers($group_info,$_errors='')
{
if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))

View File

@ -1,79 +0,0 @@
<!-- BEGIN form -->
{error_messages}
<form method="POST" action="{form_action}">
<div align="center">
<table border="0" width="95%">
<tr>
<td valign="top">
{rows}
</td>
<td valign="top">
<table border=0 width=100%>
<tr class="th">
<td colspan="4"><b>{lang_action}</b></td>
</tr>
<tr class="row_on">
<td width="25%">{lang_loginid}</td>
<td width="25%">{account_lid}&nbsp;</td>
<td width="25%">{lang_account_active}:</td>
<td width="25%">{account_status}</td>
</tr>
<tr class="row_off">
<td>{lang_firstname}</td>
<td>{account_firstname}&nbsp;</td>
<td>{lang_lastname}</td>
<td>{account_lastname}&nbsp;</td>
</tr>
{password_fields}
<tr class="row_on">
<td>{lang_groups}</td>
<td colspan="3">{groups_select}&nbsp;</td>
</tr>
<tr class="row_off">
<td>{lang_expires}</td>
<td colspan="3">{input_expires}&nbsp;&nbsp;{lang_never}&nbsp;{never_expires}</td>
</tr>
{permissions_list}
{form_buttons}
</table>
</td>
</tr>
</table>
</div>
</form>
<!-- END form -->
<!-- BEGIN form_passwordinfo -->
<tr class="row_on">
<td>{lang_password}</td>
<td><input type="password" name="account_passwd" value="{account_passwd}"></td>
<td>{lang_reenter_password}</td>
<td><input type="password" name="account_passwd_2" value="{account_passwd_2}"></td>
</tr>
<!-- END form_passwordinfo -->
<!-- BEGIN form_buttons_ -->
<tr>
<td colspan="2" align="left"><input type="submit" name="submit" value="{lang_button}"></td>
</form>
<form method="POST" action="{cancel_action}">
<td colspan="2" align="right"><input type="submit" name="cancel" value="{lang_cancel}"></td>
</tr>
<!-- END form_buttons_ -->
<!-- BEGIN form_logininfo -->
<tr class="row_on">
<td>{lang_lastlogin}</td>
<td>{account_lastlogin}</td>
<td>{lang_lastloginfrom}</td>
<td>{account_lastloginfrom}</td>
</tr>
<!-- END form_logininfo -->
<!-- BEGIN link_row -->
<tr class="{tr_color}">
<td>&nbsp;<a href="{row_link}">{row_text}</a></td>
</tr>
<!-- END link_row -->

View File

@ -20,6 +20,9 @@
<xsl:when test="account_list">
<xsl:call-template name="users"/>
</xsl:when>
<xsl:when test="account_edit">
<xsl:call-template name="users"/>
</xsl:when>
<xsl:when test="delete">
<xsl:call-template name="app_delete"/>
</xsl:when>

View File

@ -5,8 +5,8 @@
<xsl:when test="account_list">
<xsl:apply-templates select="account_list"/>
</xsl:when>
<xsl:when test="group_edit">
<xsl:apply-templates select="user_edit"/>
<xsl:when test="account_edit">
<xsl:apply-templates select="account_edit"/>
</xsl:when>
</xsl:choose>
</xsl:template>
@ -133,10 +133,10 @@
<!-- END user_list -->
<!-- BEGIN group_edit -->
<!-- BEGIN account_edit -->
<xsl:template match="group_edit">
<table border="0" cellpadding="2" cellspacing="2" align="center" width="79%">
<xsl:template match="account_edit">
<table border="0" cellpadding="2" cellspacing="2" align="center" width="95%">
<tr>
<td><xsl:value-of select="error"/></td>
</tr>
@ -148,47 +148,87 @@
<table border="0" width="100%">
<xsl:variable name="edit_url"><xsl:value-of select="edit_url"/></xsl:variable>
<xsl:variable name="account_id" select="account_id"/>
<xsl:variable name="select_size" select="select_size"/>
<xsl:variable name="account_lid" select="account_lid"/>
<xsl:variable name="account_firstname" select="account_firstname"/>
<xsl:variable name="account_lastname" select="account_lastname"/>
<xsl:variable name="account_passwd" select="account_passwd"/>
<xsl:variable name="account_passwd_2" select="account_passwd_2"/>
<form action="{$edit_url}" method="POST">
<input type="hidden" name="values[account_id]" value="{$account_id}"/>
<tr>
<td><xsl:value-of select="lang_account_name"/></td>
<td><input name="values[account_name]">
<xsl:attribute name="value">
<xsl:value-of select="value_account_name"/>
</xsl:attribute>
</input>
<tr class="row_on">
<td width="25%"><xsl:value-of select="lang_lid"/></td>
<td width="25%"><input type="text" name="values[account_lid]" value="{$account_lid}"/></td>
<td width="25%"><xsl:value-of select="lang_account_active"/></td>
<td width="25%">
<xsl:choose>
<xsl:when test="account_status = 'yes'">
<input type="checkbox" name="values[account_status]" value="A" checked="checked"/>
</xsl:when>
<xsl:otherwise>
<input type="checkbox" name="values[account_status]" value="A"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td><xsl:value-of select="lang_include_user"/></td>
<td>
<select name="account_user[]" multiple="multiple" size="{$select_size}">
<xsl:apply-templates select="user_list"/>
<tr class="row_off">
<td><xsl:value-of select="lang_firstname"/></td>
<td><input type="text" name="values[account_firstname]" value="{$account_firstname}"/></td>
<td><xsl:value-of select="lang_lastname"/></td>
<td><input type="text" name="values[account_lastname]" value="{$account_lastname}"/></td>
</tr>
<!-- BEGIN form_passwordinfo -->
<tr class="row_on">
<td><xsl:value-of select="lang_password"/></td>
<td><input type="password" name="values[account_passwd]" value="{$account_passwd}"/></td>
<td><xsl:value-of select="lang_reenter_password"/></td>
<td><input type="password" name="values[account_passwd_2]" value="{$account_passwd_2}"/></td>
</tr>
<!-- END form_passwordinfo -->
<tr class="row_off">
<td><xsl:value-of select="lang_groups"/></td>
<td colspan="3">
<select name="account_groups[]" multiple="multiple">
<xsl:apply-templates select="group_list"/>
</select>
</td>
</tr>
<tr>
<td><xsl:value-of select="lang_file_space"/></td>
<tr class="row_on">
<td><xsl:value-of select="lang_expires"/></td>
<td><xsl:value-of disable-output-escaping="yes" select="select_expires"/></td>
<td><xsl:value-of select="lang_never"/></td>
<td>
<!-- {account_file_space}{account_file_space_select} -->
<xsl:choose>
<xsl:when test="never_expires = 'yes'">
<input type="checkbox" name="values[never_expires]" value="True" checked="checked"/>
</xsl:when>
<xsl:otherwise>
<input type="checkbox" name="values[never_expires]" value="True"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td valign="top"><xsl:value-of select="lang_permissions"/></td>
<td>
<td colspan="4" height="5"></td>
</tr>
<tr>
<td colspan="4">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr class="th">
<td><xsl:value-of select="lang_application"/></td>
<td>&nbsp;</td>
<td><xsl:value-of select="lang_acl"/></td>
<td><xsl:value-of select="lang_applications"/></td>
<td></td>
</tr>
<xsl:apply-templates select="app_list"/>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="left">
<td colspan="2">
<xsl:variable name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
<input type="submit" name="values[save]" value="{$lang_save}"/>
</td>
@ -196,10 +236,10 @@
</form>
<tr>
<xsl:variable name="done_url"><xsl:value-of select="done_url"/></xsl:variable>
<xsl:variable name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
<xsl:variable name="lang_cancel_done"><xsl:value-of select="lang_cancel_done"/></xsl:variable>
<form method="POST" action="{$done_url}">
<td align="left">
<input type="submit" name="done" value="{$lang_done}"/>
<td>
<input type="submit" name="done" value="{$lang_cancel_done}"/>
</td>
</form>
</tr>
@ -209,7 +249,9 @@
</table>
</xsl:template>
<xsl:template match="user_list">
<!-- BEGIN group_list -->
<xsl:template match="group_list">
<xsl:variable name="account_id" select="account_id"/>
<xsl:choose>
<xsl:when test="selected != ''">
@ -221,6 +263,8 @@
</xsl:choose>
</xsl:template>
<!-- BEGIN app_list -->
<xsl:template match="app_list">
<xsl:variable name="checkbox_name" select="checkbox_name"/>
<tr>
@ -237,7 +281,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td width="40%"><xsl:value-of select="app_name"/></td>
<td width="40%"><xsl:value-of select="app_title"/></td>
<td width="5%" align="center">
<xsl:choose>
<xsl:when test="checked != ''">
@ -248,15 +292,5 @@
</xsl:otherwise>
</xsl:choose>
</td>
<td width="5%" align="center">
<xsl:choose>
<xsl:when test="acl_url != ''">
<xsl:variable name="acl_url" select="acl_url"/>
<xsl:variable name="acl_img" select="acl_img"/>
<xsl:variable name="img_name" select="img_name"/>
<a href="{$acl_url}"><img src="{$acl_img}" border="0" hspace="3" align="absmiddle" alt="{$img_name}" name="{$img_name}"/></a>
</xsl:when>
</xsl:choose>
</td>
</tr>
</xsl:template>