From d85efa7bd4682c175638ef7158d826d96f5d0c27 Mon Sep 17 00:00:00 2001 From: jengo Date: Mon, 21 Aug 2000 05:15:45 +0000 Subject: [PATCH] Converted accounts.php to templates and fix a few directory errors --- admin/accounts.php | 75 ++++++++++++++++++++++++++----------------- admin/editaccount.php | 2 +- admin/newaccount.php | 2 +- admin/newgroup.php | 2 +- 4 files changed, 49 insertions(+), 32 deletions(-) diff --git a/admin/accounts.php b/admin/accounts.php index c41007be0b..c41712ed86 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -14,6 +14,13 @@ $phpgw_flags["currentapp"] = "admin"; include("../header.inc.php"); + $t = new Template($phpgw_info["server"]["template_dir"]); + $t->set_file(array( "header" => "accounts.tpl", + "row" => "accounts.tpl", + "footer" => "accounts.tpl" )); + + $t->set_block("header","row","footer"); + if (! $start) $start = 0; @@ -36,25 +43,28 @@ $total = $phpgw->db->f(0); $limit = $phpgw->nextmatchs->sql_limit($start); - echo '

' - . '' - . '' - . '' - . '
' . $phpgw->nextmatchs->left("accounts.php",$start,$total) . '' . lang_admin("user accounts") . '' . $phpgw->nextmatchs->right("accounts.php",$start,$total) . '
'; + $t->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); + $t->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - echo "

" - . "\n"; + $t->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total)); + $t->set_var("lang_user_accounts",lang_admin("user accounts")); + $t->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total)); + + $t->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"lastname",$order,"accounts.php",lang_common("last name"))); + $t->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"firstname",$order,"accounts.php",lang_common("first name"))); + + $t->set_var("lang_edit",lang_common("Edit")); + $t->set_var("lang_delete",lang_common("Delete")); + $t->set_var("lang_view",lang_common("View")); + + $t->parse("out","header"); $phpgw->db->query("select con,firstname,lastname,loginid from accounts $querymethod " - . "$ordermethod limit $limit"); + . "$ordermethod limit $limit"); while ($phpgw->db->next_record()) { $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $t->set_var("tr_color",$tr_color); $lastname = $phpgw->db->f("lastname"); $firstname = $phpgw->db->f("firstname"); @@ -62,24 +72,31 @@ if (! $lastname) $lastname = ' '; if (! $firstname) $firstname = ' '; - echo "" - . ""; + $t->set_var("row_firstname",$firstname); + $t->set_var("row_lastname",$lastname); + $t->set_var("row_edit",' ' . lang_common("Edit") . ' '); + + if ($phpgw->session->loginid != $phpgw->db->f("loginid")) { + $t->set_var("row_delete",' '.lang_common("Delete").' '); + } else { + $t->set_var("row_delete"," "); + } + + $t->set_var("row_view",' ' . lang_common("View") . ' '); + + if ($phpgw->db->num_rows() != ++$i) { + $t->parse("output","row",True); + } - if ($phpgw->session->loginid != $phpgw->db->f("loginid")) - echo ""; - else - echo ""; - echo "\n"; } - echo "\n" - . $phpgw->session->hidden_var() . "
" - . $phpgw->nextmatchs->show_sort_order($sort,"lastname",$order,"accounts.php",lang_common("last name")) . "" - . $phpgw->nextmatchs->show_sort_order($sort,"firstname",$order,"accounts.php",lang_common("first name")) . "" - . lang_common("Edit") . " " . lang_common("Delete") . " " - . lang_common("View") . "
$lastname$firstnamelink("editaccount.php", - "con=" . $phpgw->db->f("con")) . "\"> " . lang_common("Edit") . " link("deleteaccount.php", - "con=" . $phpgw->db->f("con")) . "\"> " . lang_common("Delete") . "  link("viewaccount.php", - "con=" . $phpgw->db->f("con")) . "\"> " . lang_common("View") . "
" - . "" - . $phpgw->session->hidden_var() . "
" . lang_common("search") . " " - . "
"; + $t->set_var("hidden_vars",$phpgw->session->hidden_var()); + $t->set_var("lang_add",lang_common("add")); + $t->set_var("lang_search",lang_common("search")); + + $t->pparse("out","footer"); include($phpgw_info["server"]["api_dir"] . "/footer.inc.php"); diff --git a/admin/editaccount.php b/admin/editaccount.php index fda679a736..854dde23fa 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -90,7 +90,7 @@ $basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep . "users" . $sep; - if (! rename($basedir . $lid, $basedir . $n_loginid)) { + if (! @rename($basedir . $lid, $basedir . $n_loginid)) { $cd = 35; } } diff --git a/admin/newaccount.php b/admin/newaccount.php index ca0bba1d82..a6a3d1c17b 100755 --- a/admin/newaccount.php +++ b/admin/newaccount.php @@ -74,7 +74,7 @@ $basedir = $phpgw_info["server"]["server_root"] . $sep . "filemanager" . $sep . "users" . $sep; - if (!mkdir($basedir . $n_loginid, 0707)) { + if (! @mkdir($basedir . $n_loginid, 0707)) { $cd = 36; } else { $cd = 28; diff --git a/admin/newgroup.php b/admin/newgroup.php index 189cf92eba..2aed951b89 100755 --- a/admin/newgroup.php +++ b/admin/newgroup.php @@ -56,7 +56,7 @@ $cd = 31; - if (! mkdir ($basedir . $n_group, 0707)) $cd = 37; + if (! @mkdir ($basedir . $n_group, 0707)) $cd = 37; $phpgw->db->unlock();