added email-address to the accounts-data and implemented a better account-selection (like the one in the new account-popup)

This commit is contained in:
Ralf Becker 2004-07-04 17:33:13 +00:00
parent b40f691a78
commit 1992c6982b
5 changed files with 185 additions and 120 deletions

View File

@ -331,7 +331,8 @@
'account_permissions' => $_POST['account_permissions'],
'homedirectory' => $_POST['homedirectory'],
'loginshell' => $_POST['loginshell'],
'account_expires_never' => $_POST['never_expires']
'account_expires_never' => $_POST['never_expires'],
'email' => $_POST['account_email'],
/* 'file_space' => $_POST['account_file_space_number'] . "-" . $_POST['account_file_space_type'] */
);
@ -369,13 +370,7 @@
$GLOBALS['phpgw']->acl->delete_repository('phpgwapi','anonymous',$account_id);
}
// make this information for the hooks available
$GLOBALS['hook_values']['account_lid'] = $userData['account_lid'];
$GLOBALS['hook_values']['account_id'] = $account_id;
$GLOBALS['hook_values']['new_passwd'] = $userData['account_passwd'];
$GLOBALS['hook_values']['account_status'] = $userData['account_status'];
$GLOBALS['hook_values']['account_firstname'] = $userData['account_firstname'];
$GLOBALS['hook_values']['account_lastname'] = $userData['account_lastname'];
$GLOBALS['hook_values'] = $userData;
$GLOBALS['phpgw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'addaccount'
),False,True); // called for every app now, not only enabled ones
@ -590,7 +585,8 @@
'account_permissions' => $_POST['account_permissions'],
'homedirectory' => $_POST['homedirectory'],
'loginshell' => $_POST['loginshell'],
'account_expires_never' => $_POST['never_expires']
'account_expires_never' => $_POST['never_expires'],
'email' => $_POST['account_email'],
/* 'file_space' => $_POST['account_file_space_number'] . "-" . $_POST['account_file_space_type'] */
);
if ($userData['account_primary_group'] && (!isset($userData['account_groups']) || !in_array($userData['account_primary_group'],$userData['account_groups'])))
@ -605,12 +601,7 @@
if (!$errors = $this->validate_user($userData))
{
$this->save_user($userData);
$GLOBALS['hook_values']['account_id'] = $userData['account_id'];
$GLOBALS['hook_values']['account_lid'] = $userData['account_lid'];
$GLOBALS['hook_values']['account_status'] = $userData['account_status'];
$GLOBALS['hook_values']['account_firstname'] = $userData['account_firstname'];
$GLOBALS['hook_values']['account_lastname'] = $userData['account_lastname'];
$GLOBALS['hook_values'] = $userData;
$GLOBALS['phpgw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'editaccount'
),False,True); // called for every app now, not only enabled ones)

View File

@ -128,7 +128,6 @@
'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,'menuaction=admin.uiaccounts.list_groups'),
'right_next_matchs' => $this->nextmatchs->right('/index.php',$start,$total,'menuaction=admin.uiaccounts.list_groups'),
'lang_groups' => lang('%1 - %2 of %3 user groups',$start+1,$start+count($account_info),$total),
// 'lang_groups' => lang('user groups'),
'sort_name' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('name'),'menuaction=admin.uiaccounts.list_groups'),
'header_edit' => lang('Edit'),
'header_delete' => lang('Delete')
@ -214,45 +213,50 @@
{
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php'));
}
if (!is_object($GLOBALS['phpgw']->html))
{
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
}
if($param_cd)
{
$cd = $param_cd;
}
if(isset($_POST['query']))
if(isset($_REQUEST['query']))
{
// limit query to limit characters
if(eregi('^[a-z_0-9]+$',$_POST['query']))
$GLOBALS['query'] = $_POST['query'];
if(eregi('^[a-z_0-9]+$',$_REQUEST['query']))
$GLOBALS['query'] = $_REQUEST['query'];
}
if(isset($_POST['start']))
if(isset($_REQUEST['start']))
{
$start = (int)$_POST['start'];
$start = (int)$_REQUEST['start'];
}
else
{
$start = 0;
}
switch($_GET['order'])
switch($_REQUEST['order'])
{
case 'account_lastname':
case 'account_firstname':
case 'account_lid':
$order = $_GET['order'];
case 'account_email':
$order = $_REQUEST['order'];
break;
default:
$order = 'account_lid';
break;
}
switch($_GET['sort'])
switch($_REQUEST['sort'])
{
case 'ASC':
case 'DESC':
$sort = $_GET['sort'];
$sort = $_REQUEST['sort'];
break;
default:
$sort = 'ASC';
@ -274,53 +278,87 @@
$p->set_file(
Array(
'accounts' => 'accounts.tpl'
'list' => 'accounts.tpl'
)
);
$p->set_block('accounts','list','list');
$p->set_block('accounts','row','row');
$p->set_block('accounts','row_empty','row_empty');
$p->set_block('list','row','rows');
$p->set_block('list','row_empty','row_empty');
$p->set_block('list','letter_search','letter_search_cells');
if (! $GLOBALS['phpgw']->acl->check('account_access',2,'admin'))
$search_param = array(
'type' => (int)$_REQUEST['group_id'] > 0 ? $_REQUEST['group_id'] : 'accounts',
'start' => $start,
'sort' => $sort,
'order' => $order,
'query_type' => $_REQUEST['query_type'],
);
if (!$GLOBALS['phpgw']->acl->check('account_access',2,'admin'))
{
$account_info = $GLOBALS['phpgw']->accounts->get_list('accounts',$start,$sort,$order,$GLOBALS['query']);
}
else
{
$account_info = $GLOBALS['phpgw']->accounts->get_list('accounts',$start,$sort,$order);
$search_param['query'] = $GLOBALS['query'];
}
$account_info = $GLOBALS['phpgw']->accounts->search($search_param);
$total = $GLOBALS['phpgw']->accounts->total;
$url = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users');
$var = Array(
'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'left_next_matchs' => $this->nextmatchs->left($url,$start,$total,'menuaction=admin.uiaccounts.list_users'),
'lang_user_accounts' => lang('%1 - %2 of %3 user accounts',$start+1,$start+count($account_info),$total),
'right_next_matchs' => $this->nextmatchs->right($url,$start,$total,'menuaction=admin.uiaccounts.list_users'),
'lang_loginid' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,$url,lang('LoginID')),
'lang_lastname' => $this->nextmatchs->show_sort_order($sort,'account_lastname',$order,$url,lang('last name')),
'lang_firstname' => $this->nextmatchs->show_sort_order($sort,'account_firstname',$order,$url,lang('first name')),
$link_data = array(
'menuaction' => 'admin.uiaccounts.list_users',
'group_id' => $_REQUEST['group_id'],
'query_type' => $_REQUEST['query_type'],
);
$uiaccountsel = CreateObject('phpgwapi.uiaccountsel');
$p->set_var(array(
'left_next_matchs' => $this->nextmatchs->left('/index.php',$start,$total,$link_data),
'lang_showing' => ($_REQUEST['group_id'] ? $GLOBALS['phpgw']->common->grab_owner_name($_REQUEST['group_id']).': ' : '').
($GLOBALS['query'] ? lang("Search %1 '%2'",lang($uiaccountsel->query_types[$_REQUEST['query_type']]),$GLOBALS['query']).': ' : '')
.$this->nextmatchs->show_hits($total,$start),
'right_next_matchs' => $this->nextmatchs->right('/index.php',$start,$total,$link_data),
'lang_loginid' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data),
'lang_lastname' => $this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('last name'),$link_data),
'lang_firstname' => $this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('first name'),$link_data),
'lang_email' => $this->nextmatchs->show_sort_order($sort,'account_email',$order,'/index.php',lang('email'),$link_data),
'lang_edit' => lang('edit'),
'lang_delete' => lang('delete'),
'lang_view' => lang('view'),
'accounts_url' => $url,
'lang_search' => lang('search')
));
$link_data += array(
'start' => $start,
'order' => $order,
'sort' => $sort,
);
$p->set_var($var);
$p->set_var(array(
'query_type' => is_array($uiaccountsel->query_types) ? $GLOBALS['phpgw']->html->select('query_type',$_REQUEST['query_type'],$uiaccountsel->query_types) : '',
'lang_group' => lang('group'),
'group' => $uiaccountsel->selection('group_id','admin_uiaccount_listusers_group_id',$_REQUEST['group_id'],'groups',0,False,'','this.form.submit();',lang('all')),
'accounts_url' => $GLOBALS['phpgw']->link('/index.php',$link_data),
));
$letters = lang('alphabet');
$letters = explode(',',substr($letters,-1) != '*' ? $letters : 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z');
$link_data['query_type'] = 'start';
foreach($letters as $letter)
{
$link_data['query'] = $letter;
$p->set_var(array(
'letter' => $letter,
'link' => $GLOBALS['phpgw']->link('/index.php',$link_data),
'class' => $GLOBALS['query'] == $letter && $_REQUEST['query_type'] == 'start' ? 'letter_box_active' : 'letter_box',
));
$p->fp('letter_search_cells','letter_search',True);
}
unset($link_data['query']);
unset($link_data['query_type']);
$p->set_var(array(
'letter' => lang('all'),
'link' => $GLOBALS['phpgw']->link('/index.php',$link_data),
'class' => $_REQUEST['query_type'] != 'start' || !in_array($GLOBALS['query'],$letters) ? 'letter_box_active' : 'letter_box',
));
$p->fp('letter_search_cells','letter_search',True);
if (! $GLOBALS['phpgw']->acl->check('account_access',4,'admin'))
{
$p->set_var('new_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.add_user'));
$p->set_var('input_add','<input type="submit" value="' . lang('Add') . '">');
}
if (! $GLOBALS['phpgw']->acl->check('account_access',2,'admin'))
{
$p->set_var('input_search',lang('Search') . '&nbsp;<input type="text" name="query" value='.$GLOBALS['query'].'>');
}
if (!count($account_info) || !$total)
{
$p->set_var('message',lang('No matches found'));
@ -343,16 +381,11 @@
$can_delete = True;
}
while (list($null,$account) = each($account_info))
foreach($account_info as $account)
{
$this->nextmatchs->template_alternate_row_color($p);
$p->set_var('class',$this->nextmatchs->alternate_row_color('',True));
$var = array(
'row_loginid' => $account['account_lid'],
'row_firstname' => (!$account['account_firstname']?'&nbsp':$account['account_firstname']),
'row_lastname' => (!$account['account_lastname']?'&nbsp':$account['account_lastname'])
);
$p->set_var($var);
$p->set_var($account);
if ($can_edit)
{
@ -1049,6 +1082,7 @@
'lang_action' => ($_account_id?lang('Edit user account'):lang('Add new account')),
'lang_loginid' => lang('LoginID'),
'lang_account_active' => lang('Account active'),
'lang_email' => lang('email'),
'lang_password' => lang('Password'),
'lang_reenter_password' => lang('Re-Enter Password'),
'lang_lastname' => lang('Last Name'),
@ -1130,6 +1164,7 @@
'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_email' => '<input name="account_email" size="32" value="' . $userData['email'] . '">',
'account_passwd' => $account_passwd,
'account_passwd_2' => $account_passwd_2,
'account_file_space' => $account_file_space

View File

@ -11,11 +11,11 @@
<td valign="top">
<table border=0 width=100%>
<tr bgcolor="{th_bg}">
<tr class="th">
<td colspan="4"><b>{lang_action}</b></td>
</tr>
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td width="25%">{lang_loginid}</td>
<td width="25%">{account_lid}&nbsp;</td>
@ -23,7 +23,7 @@
<td width="25%">{account_status}</td>
</tr>
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_firstname}</td>
<td>{account_firstname}&nbsp;</td>
<td>{lang_lastname}</td>
@ -32,19 +32,21 @@
{password_fields}
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_changepassword}</td>
<td>{changepassword}</td>
<td>{lang_anonymous}</td>
<td>{anonymous}</td>
</tr>
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_expires}</td>
<td colspan="3">{input_expires}&nbsp;&nbsp;{lang_never}&nbsp;{never_expires}</td>
<td>{input_expires}&nbsp;&nbsp;{lang_never}&nbsp;{never_expires}</td>
<td>{lang_email}</td>
<td>{account_email}</td>
</tr>
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_groups}</td>
<td>{groups_select}&nbsp;</td>
<td>{lang_primary_group}</td>
@ -64,7 +66,7 @@
<!-- END form -->
<!-- BEGIN form_passwordinfo -->
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_password}</td>
<td><input type="password" name="account_passwd" value="{account_passwd}"></td>
<td>{lang_reenter_password}</td>
@ -73,13 +75,13 @@
<!-- END form_passwordinfo -->
<!-- BEGIN form_buttons_ -->
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
</tr>
<!-- END form_buttons_ -->
<!-- BEGIN form_logininfo -->
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_lastlogin}</td>
<td>{account_lastlogin}</td>

View File

@ -11,11 +11,11 @@
<td valign="top">
<table border=0 width=100%>
<tr bgcolor="{th_bg}">
<tr class="th">
<td colspan="4"><b>{lang_action}</b></td>
</tr>
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td width="25%">{lang_loginid}</td>
<td width="25%">{account_lid}&nbsp;</td>
@ -23,7 +23,7 @@
<td width="25%">{account_status}</td>
</tr>
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_firstname}</td>
<td>{account_firstname}&nbsp;</td>
<td>{lang_lastname}</td>
@ -32,26 +32,28 @@
{password_fields}
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_homedir}</td>
<td>{homedirectory}&nbsp;</td>
<td>{lang_shell}</td>
<td>{loginshell}&nbsp;</td>
</tr>
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_expires}</td>
<td colspan="3">{input_expires}&nbsp;&nbsp;{lang_never}&nbsp;{never_expires}</td>
<td>{input_expires}&nbsp;&nbsp;{lang_never}&nbsp;{never_expires}</td>
<td>{lang_email}</td>
<td>{account_email}</td>
</tr>
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_changepassword}</td>
<td>{changepassword}</td>
<td>{lang_anonymous}</td>
<td>{anonymous}</td>
</tr>
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td>{lang_groups}</td>
<td>{groups_select}&nbsp;</td>
<td>{lang_primary_group}</td>
@ -71,7 +73,7 @@
<!-- END form -->
<!-- BEGIN form_passwordinfo -->
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_password}</td>
<td><input type="password" name="account_passwd" value="{account_passwd}"></td>
<td>{lang_reenter_password}</td>
@ -80,13 +82,13 @@
<!-- END form_passwordinfo -->
<!-- BEGIN form_buttons_ -->
<tr bgcolor="{tr_color2}">
<tr class="row_off">
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
</tr>
<!-- END form_buttons_ -->
<!-- BEGIN form_logininfo -->
<tr bgcolor="{tr_color1}">
<tr class="row_on">
<td>{lang_lastlogin}</td>
<td>{account_lastlogin}</td>

View File

@ -1,59 +1,94 @@
<!-- BEGIN list -->
<p>
<div align="center">
<table border="0" width="70%">
<tr>
{left_next_matchs}
<td align="center">{lang_user_accounts}</td>
{right_next_matchs}
</tr>
</table>
</div>
<!-- $Id$ -->
<style type="text/css">
.letter_box,.letter_box_active {
background-color: #D3DCE3;
width: 25px;
border: 1px solid #D3DCE3;
text-align: center;
cursor: pointer;
cusror: hand;
}
.letter_box_active {
font-weight: bold;
background-color: #E8F0F0;
}
.letter_box_active,.letter_box:hover {
border: 1px solid black;
background-color: #E8F0F0;
}
</style>
<div align="center">
<table border="0" width="80%">
<tr>
<td align="right" colspan="5">
<form method="POST" action="{accounts_url}">
<table width="100%"><tr>
<td>{lang_group} {group}</td>
<td align="right">
{query_type}
<input type="text" name="query">
<input type="submit" name="search" value="{lang_search}">
</td>
</tr></table>
</form>
</td>
</tr>
<tr>
<td colspan="5">
<table width="100%"><tr>
<!-- BEGIN letter_search -->
<td class="{class}" onclick="location.href='{link}';">{letter}</td>
<!-- END letter_search -->
</tr></table>
</td>
</tr>
<tr>
{left_next_matchs}
<td align="center">{lang_showing}</td>
{right_next_matchs}
</tr>
</table>
</div>
<div align="center">
<table border="0" width="70%">
<tr bgcolor="{th_bg}">
<td>{lang_loginid}</td>
<td>{lang_lastname}</td>
<td>{lang_firstname}</td>
<td>{lang_edit}</td>
<td>{lang_delete}</td>
<td>{lang_view}</td>
<table border="0" width="80%">
<tr class="th">
<td width="20%">{lang_loginid}</td>
<td width="20%">{lang_lastname}</td>
<td width="20%">{lang_firstname}</td>
<td>{lang_email}</td>
<td width="5%">{lang_edit}</td>
<td width="5%">{lang_delete}</td>
<td width="5%">{lang_view}</td>
</tr>
{rows}
<!-- BEGIN row -->
<tr class="{class}">
<td>{account_lid}</td>
<td>{account_lastname}</td>
<td>{account_firstname}</td>
<td>{account_email}</td>
<td>{row_edit}</td>
<td>{row_delete}</td>
<td>{row_view}</td>
</tr>
<!-- END row -->
</table>
</div>
<div align="center">
<table border="0" width="70%">
<table border="0" width="80%">
<tr>
<td align="left">
<form method="POST" action="{new_action}">
{input_add}
</form>
</td>
<td align="right">
<form method="POST" action="{accounts_url}">
{input_search}
</form>
</td>
</tr>
</table>
</div>
<!-- END list -->
<!-- BEGIN row -->
<tr bgcolor="{tr_color}">
<td>{row_loginid}</td>
<td>{row_lastname}</td>
<td>{row_firstname}</td>
<td width="5%">{row_edit}</td>
<td width="5%">{row_delete}</td>
<td width="5%">{row_view}</td>
</tr>
<!-- END row -->
<!-- BEGIN row_empty -->
<tr>