diff --git a/admin/editaccount.php b/admin/editaccount.php
index d47dfa8309..3057922776 100755
--- a/admin/editaccount.php
+++ b/admin/editaccount.php
@@ -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',' ');
- $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',' ');
+ }
+ else
+ {
+ $t->set_var('account_status',' ');
+ }
- $t->set_var('account_firstname',$userData['firstname']);
- $t->set_var('account_lastname',$userData['lastname']);
+ $t->set_var('account_firstname',' ');
+ $t->set_var('account_lastname',' ');
$allAccounts;
$userGroups;
diff --git a/admin/newaccount.php b/admin/newaccount.php
index 89a124813a..2543e54a2f 100755
--- a/admin/newaccount.php
+++ b/admin/newaccount.php
@@ -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","
" . $phpgw->common->error_list($error) . " ");
- } 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','' . $phpgw->common->error_list($error) . ' ');
}
- $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',' ');
+ }
+ else
+ {
+ $phpgw->template->set_var('account_status',' ');
+ }
- $phpgw->template->set_var("lang_lastname",lang("Last Name"));
- $phpgw->template->set_var("account_lastname",$account_lastname);
+ $phpgw->template->set_var('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',' ');
+
+ $phpgw->template->set_var('lang_lastname',lang('Last Name'));
+ $phpgw->template->set_var('account_lastname',' ');
+
+ $phpgw->template->set_var('lang_groups',lang('Groups'));
+
+ $phpgw->template->parse('form_buttons','form_buttons_',True);
// groups list
$groups_select = '';
@@ -208,57 +216,72 @@
}
@reset($account_groups);
- $groups_select .= ">" . $group["account_lid"] . "\n";
+ $groups_select .= '>' . $group['account_lid'] . '';
+ $groups_select .= "\n";
}
$groups_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 .= '' . lang($perm_display[$i][1]) . ' '
- . '' . lang($perm_display[$i][1]) . ' '
+ . ' '
- . ' template->set_var("permissions_list",$perms_html);
+ $perms_html .= '' . lang($perm_display[$i][1]) . ' '
+ . ' 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();
?>
diff --git a/admin/templates/default/account_form.tpl b/admin/templates/default/account_form.tpl
index 6c3f3d909e..b98d08c3bb 100644
--- a/admin/templates/default/account_form.tpl
+++ b/admin/templates/default/account_form.tpl
@@ -9,41 +9,33 @@
- {lang_loginid}
-
-
- {lang_account_active}:
-
+ {lang_loginid}
+ {account_lid}
+
+ {lang_account_active}:
+ {account_status}
{lang_firstname}
-
+ {account_firstname}
{lang_lastname}
-
-
-
-
- {lang_password}
-
- {lang_reenter_password}
-
+ {account_lastname}
+ {password_fields}
{lang_groups}
- {groups_select}
-
+ {groups_select}
{permissions_list}
{gui_hooks}
-
-
-
+ {form_buttons}
+
diff --git a/admin/templates/default/account_form_buttons.tpl b/admin/templates/default/account_form_buttons.tpl
new file mode 100644
index 0000000000..9694acd2db
--- /dev/null
+++ b/admin/templates/default/account_form_buttons.tpl
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/admin/templates/default/account_form_logininfo.tpl b/admin/templates/default/account_form_logininfo.tpl
new file mode 100644
index 0000000000..e8bb15107a
--- /dev/null
+++ b/admin/templates/default/account_form_logininfo.tpl
@@ -0,0 +1,8 @@
+
+
+ {lang_lastlogin}
+ {account_lastlogin}
+
+ {lang_lastloginfrom}
+ {account_lastloginfrom}
+
diff --git a/admin/templates/default/account_form_password.tpl b/admin/templates/default/account_form_password.tpl
new file mode 100644
index 0000000000..09b54d2b16
--- /dev/null
+++ b/admin/templates/default/account_form_password.tpl
@@ -0,0 +1,7 @@
+
+
+ {lang_password}
+
+ {lang_reenter_password}
+
+
diff --git a/admin/templates/default/account_view.tpl b/admin/templates/default/account_view.tpl
deleted file mode 100644
index 7d52cb6a01..0000000000
--- a/admin/templates/default/account_view.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/admin/templates/default/account_view_row.tpl b/admin/templates/default/account_view_row.tpl
deleted file mode 100644
index 8ef51a3dac..0000000000
--- a/admin/templates/default/account_view_row.tpl
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- {lable}
- {value}
-
-
-
diff --git a/admin/templates/verdilak/account_form.tpl b/admin/templates/verdilak/account_form.tpl
index 6c3f3d909e..b98d08c3bb 100644
--- a/admin/templates/verdilak/account_form.tpl
+++ b/admin/templates/verdilak/account_form.tpl
@@ -9,41 +9,33 @@
- {lang_loginid}
-
-
- {lang_account_active}:
-
+ {lang_loginid}
+ {account_lid}
+
+ {lang_account_active}:
+ {account_status}
{lang_firstname}
-
+ {account_firstname}
{lang_lastname}
-
-
-
-
- {lang_password}
-
- {lang_reenter_password}
-
+ {account_lastname}
+ {password_fields}
{lang_groups}
- {groups_select}
-
+ {groups_select}
{permissions_list}
{gui_hooks}
-
-
-
+ {form_buttons}
+
diff --git a/admin/templates/verdilak/account_form_buttons.tpl b/admin/templates/verdilak/account_form_buttons.tpl
new file mode 100644
index 0000000000..9694acd2db
--- /dev/null
+++ b/admin/templates/verdilak/account_form_buttons.tpl
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/admin/templates/verdilak/account_form_logininfo.tpl b/admin/templates/verdilak/account_form_logininfo.tpl
new file mode 100644
index 0000000000..e8bb15107a
--- /dev/null
+++ b/admin/templates/verdilak/account_form_logininfo.tpl
@@ -0,0 +1,8 @@
+
+
+ {lang_lastlogin}
+ {account_lastlogin}
+
+ {lang_lastloginfrom}
+ {account_lastloginfrom}
+
diff --git a/admin/templates/verdilak/account_form_password.tpl b/admin/templates/verdilak/account_form_password.tpl
new file mode 100644
index 0000000000..09b54d2b16
--- /dev/null
+++ b/admin/templates/verdilak/account_form_password.tpl
@@ -0,0 +1,7 @@
+
+
+ {lang_password}
+
+ {lang_reenter_password}
+
+
diff --git a/admin/templates/verdilak/account_view.tpl b/admin/templates/verdilak/account_view.tpl
deleted file mode 100644
index 7d52cb6a01..0000000000
--- a/admin/templates/verdilak/account_view.tpl
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/admin/templates/verdilak/account_view_row.tpl b/admin/templates/verdilak/account_view_row.tpl
deleted file mode 100644
index 8ef51a3dac..0000000000
--- a/admin/templates/verdilak/account_view_row.tpl
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- {lable}
- {value}
-
-
-
diff --git a/admin/viewaccount.php b/admin/viewaccount.php
index 83c26d84fb..823068f89d 100755
--- a/admin/viewaccount.php
+++ b/admin/viewaccount.php
@@ -1,108 +1,183 @@
*
- * -------------------------------------------- *
- * 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 *
+ * -------------------------------------------- *
+ * 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','' . lang('Disabled') . ' ');
+ }
- $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 = "" . lang("no") . " ";
- }
- 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;$icommon->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("%s %s ",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("%s %s ",lang($perm_display[$i]['translatedName']),$checked);
+ }
+ else
+ {
+ $part2 = ' ';
+ }
+
+ $appRightsOutput .= sprintf("$part1$part2 \n",$phpgw_info["theme"]["row_on"]);
+ }
+
+ $t->set_var('permissions_list',$appRightsOutput);
+
+
+ $t->pfp('out','form');
+ $phpgw->common->phpgw_footer();
+?>
\ No newline at end of file