forked from extern/egroupware
Account -> view is working again. I made it use the same template as new/edit account.
This commit is contained in:
parent
2509cf0e65
commit
269d28222a
@ -26,13 +26,17 @@
|
||||
|
||||
$t = new Template($phpgw->common->get_tpl_dir('admin'));
|
||||
$t->set_unknowns('remove');
|
||||
$t->set_file(array('form' => 'account_form.tpl'));
|
||||
$t->set_file(array(
|
||||
'form' => 'account_form.tpl',
|
||||
'form_passwordinfo' => 'account_form_password.tpl',
|
||||
'form_buttons_' => 'account_form_buttons.tpl',
|
||||
));
|
||||
|
||||
if ($_userData)
|
||||
{
|
||||
$userData=$_userData;
|
||||
reset($userData['account_groups']);
|
||||
while (list($key, $value) = each($userData['account_groups']))
|
||||
@reset($userData['account_groups']);
|
||||
while (list($key, $value) = @each($userData['account_groups']))
|
||||
{
|
||||
$userGroups[$key]['account_id'] = $value;
|
||||
}
|
||||
@ -69,18 +73,25 @@
|
||||
$t->set_var('lang_groups',lang('Groups'));
|
||||
$t->set_var('lang_firstname',lang('First Name'));
|
||||
$t->set_var('lang_button',lang('Save'));
|
||||
$t->parse('form_buttons','form_buttons_',True);
|
||||
|
||||
$t->set_var('account_lid','<input name="account_lid" value="' . $userData['account_lid'] . '">');
|
||||
|
||||
$t->set_var('account_lid',$userData['account_lid']);
|
||||
$t->set_var('account_passwd',$account_passwd);
|
||||
$t->set_var('account_passwd_2',$account_passwd_2);
|
||||
$t->parse('password_fields','form_passwordinfo',True);
|
||||
|
||||
if ($userData['status'])
|
||||
{
|
||||
$t->set_var('account_status',' checked');
|
||||
}
|
||||
$t->set_var('account_status','<input type="checkbox" name="account_status" value="A" checked>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('account_status','<input type="checkbox" name="account_status" value="A">');
|
||||
}
|
||||
|
||||
$t->set_var('account_firstname',$userData['firstname']);
|
||||
$t->set_var('account_lastname',$userData['lastname']);
|
||||
$t->set_var('account_firstname','<input name="account_firstname" value="' . $userData['firstname'] . '">');
|
||||
$t->set_var('account_lastname','<input name="account_lastname" value="' . $userData['lastname'] . '">');
|
||||
|
||||
$allAccounts;
|
||||
$userGroups;
|
||||
|
@ -15,7 +15,6 @@
|
||||
$phpgw_info["flags"] = array("currentapp" => "admin", "noheader" => True, "nonavbar" => True,
|
||||
"parent_page" => "accounts.php");
|
||||
include("../header.inc.php");
|
||||
#include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
||||
|
||||
function is_odd($n)
|
||||
{
|
||||
@ -146,50 +145,59 @@
|
||||
$account_status = 'A';
|
||||
}
|
||||
|
||||
$phpgw->template->set_file(array('form' => 'account_form.tpl'));
|
||||
$phpgw->template->set_unknowns('remove');
|
||||
$phpgw->template->set_file(array(
|
||||
'form' => 'account_form.tpl',
|
||||
'form_passwordinfo' => 'account_form_password.tpl',
|
||||
'form_buttons_' => 'account_form_buttons.tpl',
|
||||
));
|
||||
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$phpgw->template->set_var("lang_action",lang("Add new account"));
|
||||
$phpgw->template->set_var('lang_action',lang('Add new account'));
|
||||
|
||||
if ($totalerrors) {
|
||||
$phpgw->template->set_var("error_messages","<center>" . $phpgw->common->error_list($error) . "</center>");
|
||||
} else {
|
||||
$phpgw->template->set_var("error_messages","");
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$phpgw->template->set_var("tr_color1",$phpgw_info["theme"]["row_on"]);
|
||||
$phpgw->template->set_var("tr_color2",$phpgw_info["theme"]["row_off"]);
|
||||
|
||||
$phpgw->template->set_var("form_action",$phpgw->link("newaccount.php"));
|
||||
$phpgw->template->set_var("lang_loginid",lang("LoginID"));
|
||||
|
||||
if ($account_status)
|
||||
if ($totalerrors)
|
||||
{
|
||||
$phpgw->template->set_var('account_status',' checked');
|
||||
$phpgw->template->set_var('error_messages','<center>' . $phpgw->common->error_list($error) . '</center>');
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("account_lid",$account_lid);
|
||||
|
||||
$phpgw->template->set_var("lang_account_active",lang("Account active"));
|
||||
|
||||
$phpgw->template->set_var("lang_password",lang("Password"));
|
||||
$phpgw->template->set_var("account_passwd",$account_passwd);
|
||||
$phpgw->template->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
||||
$phpgw->template->set_var('tr_color1',$phpgw_info['theme']['row_on']);
|
||||
$phpgw->template->set_var('tr_color2',$phpgw_info['theme']['row_off']);
|
||||
|
||||
$phpgw->template->set_var("lang_reenter_password",lang("Re-Enter Password"));
|
||||
$phpgw->template->set_var("account_passwd_2",$account_passwd_2);
|
||||
$phpgw->template->set_var('form_action',$phpgw->link('newaccount.php'));
|
||||
$phpgw->template->set_var('lang_loginid',lang('LoginID'));
|
||||
|
||||
$phpgw->template->set_var("lang_firstname",lang("First Name"));
|
||||
$phpgw->template->set_var("account_firstname",$account_firstname);
|
||||
if ($account_status)
|
||||
{
|
||||
$phpgw->template->set_var('account_status','<input type="checkbox" name="account_status" value="A" checked>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpgw->template->set_var('account_status','<input type="checkbox" name="account_status" value="A">');
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("lang_lastname",lang("Last Name"));
|
||||
$phpgw->template->set_var("account_lastname",$account_lastname);
|
||||
$phpgw->template->set_var('account_lid','<input name="account_lid" value="' . $account_lid . '">');
|
||||
|
||||
$phpgw->template->set_var("lang_groups",lang("Groups"));
|
||||
$phpgw->template->set_var('lang_account_active',lang('Account active'));
|
||||
|
||||
$phpgw->template->set_var('lang_password',lang('Password'));
|
||||
$phpgw->template->set_var('account_passwd',$account_passwd);
|
||||
|
||||
$phpgw->template->set_var('lang_reenter_password',lang('Re-Enter Password'));
|
||||
$phpgw->template->set_var('account_passwd_2',$account_passwd_2);
|
||||
$phpgw->template->parse('password_fields','form_passwordinfo',True);
|
||||
|
||||
$phpgw->template->set_var('lang_firstname',lang('First Name'));
|
||||
$phpgw->template->set_var('account_firstname','<input name="account_firstname" value="' . $account_firstname . '">');
|
||||
|
||||
$phpgw->template->set_var('lang_lastname',lang('Last Name'));
|
||||
$phpgw->template->set_var('account_lastname','<input name="account_lastname" value="' . $account_lastname . '">');
|
||||
|
||||
$phpgw->template->set_var('lang_groups',lang('Groups'));
|
||||
|
||||
$phpgw->template->parse('form_buttons','form_buttons_',True);
|
||||
|
||||
// groups list
|
||||
$groups_select = '<select name="account_groups[]" multiple>';
|
||||
@ -208,57 +216,72 @@
|
||||
}
|
||||
@reset($account_groups);
|
||||
|
||||
$groups_select .= ">" . $group["account_lid"] . "</option>\n";
|
||||
$groups_select .= '>' . $group['account_lid'] . '</option>';
|
||||
$groups_select .= "\n";
|
||||
}
|
||||
$groups_select .= '</select>';
|
||||
$phpgw->template->set_var('groups_select',$groups_select);
|
||||
// end groups list
|
||||
|
||||
$phpgw->template->set_var("","");
|
||||
$i = 0;
|
||||
$sorted_apps = $phpgw_info["apps"];
|
||||
@asort($sorted_apps);
|
||||
@reset($sorted_apps);
|
||||
while ($permission = each($sorted_apps)) {
|
||||
if ($permission[1]["enabled"]) {
|
||||
$perm_display[$i][0] = $permission[0];
|
||||
$perm_display[$i][1] = $permission[1]["title"];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$i = 0;
|
||||
$sorted_apps = $phpgw_info['apps'];
|
||||
@asort($sorted_apps);
|
||||
@reset($sorted_apps);
|
||||
while ($permission = each($sorted_apps))
|
||||
{
|
||||
if ($permission[1]['enabled'])
|
||||
{
|
||||
$perm_display[$i][0] = $permission[0];
|
||||
$perm_display[$i][1] = $permission[1]['title'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
for ($i=0;$i<200;) { // The $i<200 is only used for a brake
|
||||
if (! $perm_display[$i][1]) break;
|
||||
// The $i<200 is only used for a brake
|
||||
for ($i=0;$i<200;)
|
||||
{
|
||||
if (! $perm_display[$i][1])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$perms_html .= '<tr bgcolor="' . $phpgw_info["theme"]["row_on"] . '"><td>' . lang($perm_display[$i][1]) . '</td>'
|
||||
. '<td><input type="checkbox" name="account_permissions['
|
||||
. $perm_display[$i][0] . ']" value="True"';
|
||||
if ($account_permissions[$perm_display[$i][0]]) {
|
||||
$perms_html .= " checked";
|
||||
}
|
||||
$perms_html .= "></td>";
|
||||
$perms_html .= '<tr bgcolor="' . $phpgw_info['theme']['row_on'] . '"><td>' . lang($perm_display[$i][1]) . '</td>'
|
||||
. '<td><input type="checkbox" name="account_permissions['
|
||||
. $perm_display[$i][0] . ']" value="True"';
|
||||
|
||||
$i++;
|
||||
if ($account_permissions[$perm_display[$i][0]])
|
||||
{
|
||||
$perms_html .= ' checked';
|
||||
}
|
||||
$perms_html .= '></td>';
|
||||
|
||||
if ($i == count($perm_display) && is_odd(count($perm_display))) {
|
||||
$perms_html .= '<td colspan="2"> </td></tr>';
|
||||
}
|
||||
$i++;
|
||||
|
||||
if ($i == count($perm_display) && is_odd(count($perm_display)))
|
||||
{
|
||||
$perms_html .= '<td colspan="2"> </td></tr>';
|
||||
}
|
||||
|
||||
if (! $perm_display[$i][1]) break;
|
||||
if (! $perm_display[$i][1])
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
$perms_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
||||
. '<td><input type="checkbox" name="account_permissions['
|
||||
. $perm_display[$i][0] . ']" value="True"';
|
||||
if ($account_permissions[$perm_display[$i][0]]) {
|
||||
$perms_html .= " checked";
|
||||
}
|
||||
$perms_html .= "></td></tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$phpgw->template->set_var("permissions_list",$perms_html);
|
||||
$perms_html .= '<td>' . lang($perm_display[$i][1]) . '</td>'
|
||||
. '<td><input type="checkbox" name="account_permissions['
|
||||
. $perm_display[$i][0] . ']" value="True"';
|
||||
|
||||
$includedSomething = False;
|
||||
if ($account_permissions[$perm_display[$i][0]])
|
||||
{
|
||||
$perms_html .= ' checked';
|
||||
}
|
||||
$perms_html .= '></td></tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
$phpgw->template->set_var('permissions_list',$perms_html);
|
||||
|
||||
$includedSomething = False;
|
||||
// Skeeter: I don't see this as a player, if creating new accounts...
|
||||
|
||||
// start inlcuding other admin tools
|
||||
@ -268,11 +291,9 @@
|
||||
// {gui_hooks} to ""
|
||||
// if ($phpgw->common->hook_single("show_newuser_data", $value)) $includedSomething="true";
|
||||
// }
|
||||
if (!$includedSomething) $phpgw->template->set_var("gui_hooks","");
|
||||
|
||||
$phpgw->template->set_var("lang_button",Lang("Add"));
|
||||
echo $phpgw->template->finish($phpgw->template->parse("out","form"));
|
||||
$phpgw->template->set_var('lang_button',Lang('Add'));
|
||||
$phpgw->template->pfp('out','form');
|
||||
|
||||
#account_close();
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -9,41 +9,33 @@
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<td>{lang_loginid}</td>
|
||||
<td><input name="account_lid" value="{account_lid}"></td>
|
||||
<td colspan="2" align="center">
|
||||
{lang_account_active}: <input type="checkbox" name="account_status" value="A"{account_status}>
|
||||
</td>
|
||||
<td width="25%">{lang_loginid}</td>
|
||||
<td width="25%">{account_lid} </td>
|
||||
|
||||
<td width="25%">{lang_account_active}:</td>
|
||||
<td width="25%">{account_status}</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td>{lang_firstname}</td>
|
||||
<td><input name="account_firstname" value="{account_firstname}"></td>
|
||||
<td>{account_firstname} </td>
|
||||
<td>{lang_lastname}</td>
|
||||
<td><input name="account_lastname" value="{account_lastname}"></td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<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>
|
||||
<td>{account_lastname} </td>
|
||||
</tr>
|
||||
|
||||
{password_fields}
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td>{lang_groups}</td>
|
||||
<td>{groups_select} </td>
|
||||
<td colspan=2> </td>
|
||||
<td colspan=3>{groups_select} </td>
|
||||
</tr>
|
||||
|
||||
{permissions_list}
|
||||
|
||||
{gui_hooks}
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
|
||||
</tr>
|
||||
{form_buttons}
|
||||
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
4
admin/templates/default/account_form_buttons.tpl
Normal file
4
admin/templates/default/account_form_buttons.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
|
||||
</tr>
|
8
admin/templates/default/account_form_logininfo.tpl
Normal file
8
admin/templates/default/account_form_logininfo.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<td>{lang_lastlogin}</td>
|
||||
<td>{account_lastlogin}</td>
|
||||
|
||||
<td>{lang_lastloginfrom}</td>
|
||||
<td>{account_lastloginfrom}</td>
|
||||
</tr>
|
7
admin/templates/default/account_form_password.tpl
Normal file
7
admin/templates/default/account_form_password.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<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>
|
@ -1,14 +0,0 @@
|
||||
<!-- BEGIN display -->
|
||||
|
||||
<center>
|
||||
<p>
|
||||
<table border="0" width="50%">
|
||||
|
||||
<tr bgcolor="{th_bg}">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
{rows}
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- END display -->
|
@ -1,8 +0,0 @@
|
||||
<!-- BEGIN row -->
|
||||
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td width="40%" valign="top">{lable} </td>
|
||||
<td width="60%" valign="top">{value} </td>
|
||||
</tr>
|
||||
|
||||
<!-- END row -->
|
@ -9,41 +9,33 @@
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<td>{lang_loginid}</td>
|
||||
<td><input name="account_lid" value="{account_lid}"></td>
|
||||
<td colspan="2" align="center">
|
||||
{lang_account_active}: <input type="checkbox" name="account_status" value="A"{account_status}>
|
||||
</td>
|
||||
<td width="25%">{lang_loginid}</td>
|
||||
<td width="25%">{account_lid} </td>
|
||||
|
||||
<td width="25%">{lang_account_active}:</td>
|
||||
<td width="25%">{account_status}</td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td>{lang_firstname}</td>
|
||||
<td><input name="account_firstname" value="{account_firstname}"></td>
|
||||
<td>{account_firstname} </td>
|
||||
<td>{lang_lastname}</td>
|
||||
<td><input name="account_lastname" value="{account_lastname}"></td>
|
||||
</tr>
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<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>
|
||||
<td>{account_lastname} </td>
|
||||
</tr>
|
||||
|
||||
{password_fields}
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td>{lang_groups}</td>
|
||||
<td>{groups_select} </td>
|
||||
<td colspan=2> </td>
|
||||
<td colspan=3>{groups_select} </td>
|
||||
</tr>
|
||||
|
||||
{permissions_list}
|
||||
|
||||
{gui_hooks}
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
|
||||
</tr>
|
||||
{form_buttons}
|
||||
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
4
admin/templates/verdilak/account_form_buttons.tpl
Normal file
4
admin/templates/verdilak/account_form_buttons.tpl
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
<tr bgcolor="{tr_color2}">
|
||||
<td colspan="4" align="right"><input type="submit" name="submit" value="{lang_button}"></td>
|
||||
</tr>
|
8
admin/templates/verdilak/account_form_logininfo.tpl
Normal file
8
admin/templates/verdilak/account_form_logininfo.tpl
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<td>{lang_lastlogin}</td>
|
||||
<td>{account_lastlogin}</td>
|
||||
|
||||
<td>{lang_lastloginfrom}</td>
|
||||
<td>{account_lastloginfrom}</td>
|
||||
</tr>
|
7
admin/templates/verdilak/account_form_password.tpl
Normal file
7
admin/templates/verdilak/account_form_password.tpl
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<tr bgcolor="{tr_color1}">
|
||||
<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>
|
@ -1,14 +0,0 @@
|
||||
<!-- BEGIN display -->
|
||||
|
||||
<center>
|
||||
<p>
|
||||
<table border="0" width="50%">
|
||||
|
||||
<tr bgcolor="{th_bg}">
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
{rows}
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<!-- END display -->
|
@ -1,8 +0,0 @@
|
||||
<!-- BEGIN row -->
|
||||
|
||||
<tr bgcolor="{tr_color}">
|
||||
<td width="40%" valign="top">{lable} </td>
|
||||
<td width="60%" valign="top">{value} </td>
|
||||
</tr>
|
||||
|
||||
<!-- END row -->
|
@ -1,108 +1,183 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
/**************************************************************************\
|
||||
* phpGroupWare - administration *
|
||||
* http://www.phpgroupware.org *
|
||||
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
|
||||
$phpgw_info = array();
|
||||
if (! $account_id) {
|
||||
$phpgw_info["flags"] = array("nonavbar" => True, "noheader" => True);
|
||||
}
|
||||
if (! $account_id)
|
||||
{
|
||||
$phpgw_info['flags'] = array(
|
||||
'nonavbar' => True,
|
||||
'noheader' => True
|
||||
);
|
||||
}
|
||||
|
||||
$phpgw_info["flags"]["enable_nextmatchs_class"] = True;
|
||||
$phpgw_info["flags"]["currentapp"] = "admin";
|
||||
$phpgw_info["flags"]["parent_page"] = "accounts.php";
|
||||
$phpgw_info['flags']['enable_nextmatchs_class'] = True;
|
||||
$phpgw_info['flags']['currentapp'] = 'admin';
|
||||
$phpgw_info['flags']['parent_page'] = 'accounts.php';
|
||||
|
||||
include("../header.inc.php");
|
||||
include($phpgw_info["server"]["app_inc"]."/accounts_".$phpgw_info["server"]["account_repository"].".inc.php");
|
||||
include('../header.inc.php');
|
||||
|
||||
if (! $account_id) {
|
||||
Header("Location: " . $phpgw->link("accounts.php"));
|
||||
}
|
||||
if (! $account_id)
|
||||
{
|
||||
Header('Location: ' . $phpgw->link('accounts.php'));
|
||||
}
|
||||
|
||||
function display_row($lable,$value)
|
||||
{
|
||||
global $phpgw, $tr_color;
|
||||
$t = new Template($phpgw->common->get_tpl_dir('admin'));
|
||||
$t->set_unknowns('remove');
|
||||
$t->set_file(array(
|
||||
'form' => 'account_form.tpl',
|
||||
'form_logininfo' => 'account_form_logininfo.tpl'
|
||||
));
|
||||
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
$t->set_var('th_bg',$phpgw_info['theme']['th_bg']);
|
||||
$t->set_var('tr_color1',$phpgw_info['theme']['row_on']);
|
||||
$t->set_var('tr_color2',$phpgw_info['theme']['row_off']);
|
||||
$t->set_var('lang_action',lang('View user account'));
|
||||
$t->set_var('lang_loginid',lang('LoginID'));
|
||||
$t->set_var('lang_account_active',lang('Account active'));
|
||||
$t->set_var('lang_password',lang('Password'));
|
||||
$t->set_var('lang_reenter_password',lang('Re-Enter Password'));
|
||||
$t->set_var('lang_lastname',lang('Last Name'));
|
||||
$t->set_var('lang_groups',lang('Groups'));
|
||||
$t->set_var('lang_firstname',lang('First Name'));
|
||||
$t->set_var('lang_lastlogin',lang('Last login'));
|
||||
$t->set_var('lang_lastloginfrom',lang('Last login from'));
|
||||
|
||||
$phpgw->template->set_var("tr_color",$tr_color);
|
||||
$phpgw->template->set_var("lable",$lable);
|
||||
$phpgw->template->set_var("value",$value);
|
||||
|
||||
$phpgw->template->parse("rows","row",True);
|
||||
}
|
||||
$account = CreateObject('phpgwapi.accounts',$account_id);
|
||||
$userData = $account->read_repository();
|
||||
|
||||
$phpgw->template->set_file(array("display" => "account_view.tpl",
|
||||
"row" => "account_view_row.tpl"));
|
||||
$t->set_var('account_lid',$userData['account_lid']);
|
||||
$t->set_var('account_firstname',$userData['firstname']);
|
||||
$t->set_var('account_lastname',$userData['lastname']);
|
||||
|
||||
$userData = $phpgw->accounts->read_userData($account_id);
|
||||
// Account status
|
||||
if ($userData['status'])
|
||||
{
|
||||
$t->set_var('account_status',lang('Enabled'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('account_status','<b>' . lang('Disabled') . '</b>');
|
||||
}
|
||||
|
||||
$loginid = $userData["account_lid"];
|
||||
$account_lastlogin = $userData["account_lastlogin"];
|
||||
$account_lastloginfrom = $userData["account_lastloginfrom"];
|
||||
$account_status = $userData["account_status"];
|
||||
// Last login time
|
||||
if ($userData['account_lastlogin'])
|
||||
{
|
||||
$t->set_var('account_lastlogin',$phpgw->common->show_date($userData['lastlogin']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('account_lastlogin',lang('Never'));
|
||||
}
|
||||
|
||||
$db_perms = $phpgw->accounts->read_apps($loginid);
|
||||
// Last login IP
|
||||
if ($userData['account_lastloginfrom'])
|
||||
{
|
||||
$t->set_var('account_lastloginfrom',$userData['lastloginfrom']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$t->set_var('account_lastloginfrom',lang('Never'));
|
||||
}
|
||||
$t->parse('password_fields','form_logininfo',True);
|
||||
|
||||
|
||||
#$phpgw->db->query("select account_lid from accounts where account_id='$account_id'");
|
||||
#$phpgw->db->next_record();
|
||||
#$loginid = $phpgw->db->f("account_lid");
|
||||
|
||||
#$account_info = account_view($loginid);
|
||||
// Find out which groups they are members of
|
||||
$usergroups = $account->memberships(intval($account_id));
|
||||
if (gettype($usergroups) != 'array')
|
||||
{
|
||||
$t->set_var('groups_select',lang('None'));
|
||||
}
|
||||
else
|
||||
{
|
||||
while (list(,$group) = each($usergroups))
|
||||
{
|
||||
$group_names[] = $group['account_name'];
|
||||
}
|
||||
$t->set_var('groups_select',implode(',',$group_names));
|
||||
}
|
||||
|
||||
#$phpgw->db->query("select account_lastlogin,account_lastloginfrom,account_status from accounts "
|
||||
# . "where account_id='$account_id'");
|
||||
#$phpgw->db->next_record();
|
||||
|
||||
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$loginid = $userData["account_lid"];
|
||||
$account_lastlogin = $userData["account_lastlogin"];
|
||||
$account_lastloginfrom = $userData["account_lastloginfrom"];
|
||||
$account_status = $userData["account_status"];
|
||||
|
||||
display_row(lang("LoginID"),$loginid);
|
||||
display_row(lang("First Name"),$userData["firstname"]);
|
||||
display_row(lang("Last Name"),$userData["lastname"]);
|
||||
|
||||
$i = 0;
|
||||
while ($permission = each($db_perms)) {
|
||||
if ($phpgw_info["apps"][$permission[0]]["enabled"]) {
|
||||
$perm_display[$i] = lang($phpgw_info["apps"][$permission[0]]["title"]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
display_row(lang("account permissions"),implode(", ", $perm_display));
|
||||
// create list of available app
|
||||
$i = 0;
|
||||
|
||||
$availableApps = $phpgw_info['apps'];
|
||||
@asort($availableApps);
|
||||
@reset($availableApps);
|
||||
while ($application = each($availableApps))
|
||||
{
|
||||
if ($application[1]['enabled'])
|
||||
{
|
||||
$perm_display[$i]['appName'] = $application[0];
|
||||
$perm_display[$i]['translatedName'] = $application[1]['title'];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($userData["status"] == "A") {
|
||||
$account_status = lang("yes");
|
||||
} else {
|
||||
$account_status = "<b>" . lang("no") . "</b>";
|
||||
}
|
||||
display_row(lang("account active"),$account_status);
|
||||
// create apps output
|
||||
$apps = CreateObject('phpgwapi.applications',intval($account_id));
|
||||
$db_perms = $apps->read_account_specific();
|
||||
|
||||
$user_groups = $phpgw->accounts->read_group_names($userData["account_lid"]);
|
||||
for ($i=0;$i<count($user_groups); $i++) {
|
||||
$group_html .= $user_groups[$i][1];
|
||||
if (count($user_groups) !=0 && $i != count($user_groups)-1) {
|
||||
$group_html .= ", ";
|
||||
}
|
||||
}
|
||||
display_row(lang("Groups"),$group_html);
|
||||
@reset($db_perms);
|
||||
|
||||
if (! $userData["lastlogin"]) {
|
||||
$lastlogin = lang("Never");
|
||||
} else {
|
||||
$lastlogin = $phpgw->common->show_date($userData["lastlogin"]);
|
||||
}
|
||||
display_row(lang("Last login"),$lastlogin);
|
||||
display_row(lang("Last login from"),$userData["lastloginfrom"]);
|
||||
for ($i=0;$i<=count($perm_display);$i++)
|
||||
{
|
||||
$checked = '';
|
||||
if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
|
||||
{
|
||||
$checked = ' X';
|
||||
}
|
||||
else
|
||||
{
|
||||
$checked = ' ';
|
||||
}
|
||||
|
||||
if ($perm_display[$i]['translatedName'])
|
||||
{
|
||||
$part1 = sprintf("<td>%s</td><td>%s</td>",lang($perm_display[$i]['translatedName']),$checked);
|
||||
}
|
||||
|
||||
$phpgw->template->pparse("out","display");
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
$i++;
|
||||
|
||||
if ($_userData['account_permissions'][$perm_display[$i]['appName']] || $db_perms[$perm_display[$i]['appName']])
|
||||
{
|
||||
$checked = ' X';
|
||||
}
|
||||
else
|
||||
{
|
||||
$checked = ' ';
|
||||
}
|
||||
|
||||
if ($perm_display[$i]['translatedName'])
|
||||
{
|
||||
$part2 = sprintf("<td>%s</td><td>%s</td>",lang($perm_display[$i]['translatedName']),$checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
$part2 = '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
$appRightsOutput .= sprintf("<tr bgcolor=\"%s\">$part1$part2</tr>\n",$phpgw_info["theme"]["row_on"]);
|
||||
}
|
||||
|
||||
$t->set_var('permissions_list',$appRightsOutput);
|
||||
|
||||
|
||||
$t->pfp('out','form');
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user