From 5c9323a2c4f14b564f53c5c86bbc535f36e1d391 Mon Sep 17 00:00:00 2001 From: skeeter Date: Fri, 9 Feb 2001 02:45:06 +0000 Subject: [PATCH] fixes for new api layout --- admin/accounts.php | 52 +++++++++++++++++++++++---------------------- admin/editgroup.php | 26 +++++++++-------------- setup/ldap.php | 2 +- 3 files changed, 38 insertions(+), 42 deletions(-) diff --git a/admin/accounts.php b/admin/accounts.php index 898f4c7710..945fdde668 100755 --- a/admin/accounts.php +++ b/admin/accounts.php @@ -16,25 +16,27 @@ include("../header.inc.php"); include(PHPGW_APP_INC . "/accounts_".$phpgw_info["server"]["account_repository"].".inc.php"); - $phpgw->template->set_file(array("list" => "accounts.tpl", + $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); + + $p->set_file(array("list" => "accounts.tpl", "row" => "accounts_row.tpl")); $total = account_total(); - $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); - $phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); + $p->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); + $p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); - $phpgw->template->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total)); - $phpgw->template->set_var("lang_user_accounts",lang("user accounts")); - $phpgw->template->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total)); + $p->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total)); + $p->set_var("lang_user_accounts",lang("user accounts")); + $p->set_var("right_next_matchs",$phpgw->nextmatchs->right("accounts.php",$start,$total)); - $phpgw->template->set_var("lang_loginid",$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"accounts.php",lang("LoginID"))); - $phpgw->template->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name"))); - $phpgw->template->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name"))); + $p->set_var("lang_loginid",$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"accounts.php",lang("LoginID"))); + $p->set_var("lang_lastname",$phpgw->nextmatchs->show_sort_order($sort,"account_lastname",$order,"accounts.php",lang("last name"))); + $p->set_var("lang_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name"))); - $phpgw->template->set_var("lang_edit",lang("Edit")); - $phpgw->template->set_var("lang_delete",lang("Delete")); - $phpgw->template->set_var("lang_view",lang("View")); + $p->set_var("lang_edit",lang("Edit")); + $p->set_var("lang_delete",lang("Delete")); + $p->set_var("lang_view",lang("View")); $account_info = account_read($method,$start,$sort,$order); @@ -51,7 +53,7 @@ $loginid = $account["account_lid"]; $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); - $phpgw->template->set_var("tr_color",$tr_color); + $p->set_var("tr_color",$tr_color); // $lastname = $account["account_lastname"]; // $firstname = $account["account_firstname"]; @@ -59,30 +61,30 @@ if (! $lastname) $lastname = ' '; if (! $firstname) $firstname = ' '; - $phpgw->template->set_var("row_loginid",$loginid); - $phpgw->template->set_var("row_firstname",$firstname); - $phpgw->template->set_var("row_lastname",$lastname); - $phpgw->template->set_var("row_edit",'set_var("row_firstname",$firstname); + $p->set_var("row_lastname",$lastname); + $p->set_var("row_edit",' ' . lang("Edit") . ' '); if ($phpgw_info["user"]["userid"] != $account["account_lid"]) { - $phpgw->template->set_var("row_delete",' '.lang("Delete").' '); } else { - $phpgw->template->set_var("row_delete"," "); + $p->set_var("row_delete"," "); } - $phpgw->template->set_var("row_view",' ' . lang("View") . ' '); - $phpgw->template->parse("rows","row",True); + $p->parse("rows","row",True); } - $phpgw->template->set_var("actionurl",$phpgw->link("newaccount.php")); - $phpgw->template->set_var("lang_add",lang("add")); - $phpgw->template->set_var("lang_search",lang("search")); + $p->set_var("actionurl",$phpgw->link("newaccount.php")); + $p->set_var("lang_add",lang("add")); + $p->set_var("lang_search",lang("search")); - $phpgw->template->pparse("out","list"); + $p->pparse("out","list"); account_close(); $phpgw->common->phpgw_footer(); diff --git a/admin/editgroup.php b/admin/editgroup.php index da509ca6bd..2c7fb0e0ed 100755 --- a/admin/editgroup.php +++ b/admin/editgroup.php @@ -18,8 +18,6 @@ $phpgw_info["flags"]["currentapp"] = "admin"; include("../header.inc.php"); -$debugme = "on"; - $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); function is_odd($n) @@ -37,20 +35,19 @@ $debugme = "on"; } if ($submit) { - $phpgw->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=$group_id",__LINE__,__FILE__); - $phpgw->db->next_record(); + $old_group_name = $phpgw->accounts->id2name($group_id); - $old_group_name = $phpgw->db->f("account_lid"); + if($n_group != $old_group_name) { + $phpgw->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_lid='" . $n_group . "'",__LINE__,__FILE__); + $phpgw->db->next_record(); - $phpgw->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_lid='" . $n_group . "'",__LINE__,__FILE__); - $phpgw->db->next_record(); - - if ($phpgw->db->f(0) != 0 && $n_group != $old_group_name) { - $error = lang("Sorry, that group name has already been taking."); + if ($phpgw->db->f(0) == 2) { + $error = lang("Sorry, that group name has already been taking."); + } } if (! $error) { - $phpgw->db->lock(array('phpgw_accounts','preferences','config','applications','phpgw_hooks','phpgw_sessions','phpgw_acl')); + $phpgw->db->lock(array('phpgw_accounts','preferences','phpgw_config','phpgw_applications','phpgw_hooks','phpgw_sessions','phpgw_acl')); $apps = CreateObject('phpgwapi.applications',intval($group_id)); $apps_before = $apps->read_account_specific(); $apps->update_data(Array()); @@ -79,12 +76,9 @@ $debugme = "on"; for ($i=0; $iadd_repository('phpgw_group',$group_id,$n_users[$i],1); - $phpgw->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=".$n_users[$i],__LINE__,__FILE__); - $phpgw->db->next_record(); - $acccount_lid = $phpgw->db->f('account_lid'); - // If the user is logged in, it will force a refresh of the session_info - $phpgw->db->query("update phpgw_sessions set session_info='' where session_lid='$account_lid@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); + $phpgw->db->query("update phpgw_sessions set session_info='' " + ."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); // The following sets any default preferences needed for new applications.. // This is smart enough to know if previous preferences were selected, use them. diff --git a/setup/ldap.php b/setup/ldap.php index 293dbf2bf6..6dc646e81c 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -62,7 +62,7 @@ } } - $phpgw_setup->db->query("select app_name,app_title from applications where app_enabled != '0' and " + $phpgw_setup->db->query("select app_name,app_title from phpgw_applications where app_enabled != '0' and " . "app_name != 'admin'",__LINE__,__FILE__); while ($phpgw_setup->db->next_record()) { $apps[$phpgw_setup->db->f("app_name")] = $phpgw_setup->db->f("app_title");