fixes for new api layout

This commit is contained in:
skeeter 2001-02-09 02:45:06 +00:00
parent 31ad91769e
commit 5c9323a2c4
3 changed files with 38 additions and 42 deletions

View File

@ -16,25 +16,27 @@
include("../header.inc.php"); include("../header.inc.php");
include(PHPGW_APP_INC . "/accounts_".$phpgw_info["server"]["account_repository"].".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")); "row" => "accounts_row.tpl"));
$total = account_total(); $total = account_total();
$phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_color"]); $p->set_var("bg_color",$phpgw_info["theme"]["bg_color"]);
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]); $p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
$phpgw->template->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total)); $p->set_var("left_next_matchs",$phpgw->nextmatchs->left("accounts.php",$start,$total));
$phpgw->template->set_var("lang_user_accounts",lang("user accounts")); $p->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("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"))); $p->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"))); $p->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_firstname",$phpgw->nextmatchs->show_sort_order($sort,"account_firstname",$order,"accounts.php",lang("first name")));
$phpgw->template->set_var("lang_edit",lang("Edit")); $p->set_var("lang_edit",lang("Edit"));
$phpgw->template->set_var("lang_delete",lang("Delete")); $p->set_var("lang_delete",lang("Delete"));
$phpgw->template->set_var("lang_view",lang("View")); $p->set_var("lang_view",lang("View"));
$account_info = account_read($method,$start,$sort,$order); $account_info = account_read($method,$start,$sort,$order);
@ -51,7 +53,7 @@
$loginid = $account["account_lid"]; $loginid = $account["account_lid"];
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $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"]; // $lastname = $account["account_lastname"];
// $firstname = $account["account_firstname"]; // $firstname = $account["account_firstname"];
@ -59,30 +61,30 @@
if (! $lastname) $lastname = ' '; if (! $lastname) $lastname = ' ';
if (! $firstname) $firstname = ' '; if (! $firstname) $firstname = ' ';
$phpgw->template->set_var("row_loginid",$loginid); $p->set_var("row_loginid",$loginid);
$phpgw->template->set_var("row_firstname",$firstname); $p->set_var("row_firstname",$firstname);
$phpgw->template->set_var("row_lastname",$lastname); $p->set_var("row_lastname",$lastname);
$phpgw->template->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","account_id=" $p->set_var("row_edit",'<a href="'.$phpgw->link("editaccount.php","account_id="
. $account_id) . '"> ' . lang("Edit") . ' </a>'); . $account_id) . '"> ' . lang("Edit") . ' </a>');
if ($phpgw_info["user"]["userid"] != $account["account_lid"]) { if ($phpgw_info["user"]["userid"] != $account["account_lid"]) {
$phpgw->template->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'account_id=' $p->set_var("row_delete",'<a href="' . $phpgw->link("deleteaccount.php",'account_id='
. $account_id) . '"> '.lang("Delete").' </a>'); . $account_id) . '"> '.lang("Delete").' </a>');
} else { } else {
$phpgw->template->set_var("row_delete","&nbsp;"); $p->set_var("row_delete","&nbsp;");
} }
$phpgw->template->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id=" $p->set_var("row_view",'<a href="' . $phpgw->link("viewaccount.php", "account_id="
. $account_id) . '"> ' . lang("View") . ' </a>'); . $account_id) . '"> ' . lang("View") . ' </a>');
$phpgw->template->parse("rows","row",True); $p->parse("rows","row",True);
} }
$phpgw->template->set_var("actionurl",$phpgw->link("newaccount.php")); $p->set_var("actionurl",$phpgw->link("newaccount.php"));
$phpgw->template->set_var("lang_add",lang("add")); $p->set_var("lang_add",lang("add"));
$phpgw->template->set_var("lang_search",lang("search")); $p->set_var("lang_search",lang("search"));
$phpgw->template->pparse("out","list"); $p->pparse("out","list");
account_close(); account_close();
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();

View File

@ -18,8 +18,6 @@
$phpgw_info["flags"]["currentapp"] = "admin"; $phpgw_info["flags"]["currentapp"] = "admin";
include("../header.inc.php"); include("../header.inc.php");
$debugme = "on";
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
function is_odd($n) function is_odd($n)
@ -37,20 +35,19 @@ $debugme = "on";
} }
if ($submit) { if ($submit) {
$phpgw->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=$group_id",__LINE__,__FILE__); $old_group_name = $phpgw->accounts->id2name($group_id);
$phpgw->db->next_record();
$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->query("SELECT count(*) FROM phpgw_accounts WHERE account_lid='" . $n_group . "'",__LINE__,__FILE__);
$phpgw->db->next_record(); $phpgw->db->next_record();
if ($phpgw->db->f(0) != 0 && $n_group != $old_group_name) { if ($phpgw->db->f(0) == 2) {
$error = lang("Sorry, that group name has already been taking."); $error = lang("Sorry, that group name has already been taking.");
} }
}
if (! $error) { 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 = CreateObject('phpgwapi.applications',intval($group_id));
$apps_before = $apps->read_account_specific(); $apps_before = $apps->read_account_specific();
$apps->update_data(Array()); $apps->update_data(Array());
@ -79,12 +76,9 @@ $debugme = "on";
for ($i=0; $i<count($n_users);$i++) { for ($i=0; $i<count($n_users);$i++) {
$acl->add_repository('phpgw_group',$group_id,$n_users[$i],1); $acl->add_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 // 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.. // The following sets any default preferences needed for new applications..
// This is smart enough to know if previous preferences were selected, use them. // This is smart enough to know if previous preferences were selected, use them.

View File

@ -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__); . "app_name != 'admin'",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record()) { while ($phpgw_setup->db->next_record()) {
$apps[$phpgw_setup->db->f("app_name")] = $phpgw_setup->db->f("app_title"); $apps[$phpgw_setup->db->f("app_name")] = $phpgw_setup->db->f("app_title");