mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
start of getting groups maintenance to work
This commit is contained in:
parent
65a1ff5488
commit
5b6ff99f40
@ -18,6 +18,8 @@
|
||||
$phpgw_info["flags"]["currentapp"] = "admin";
|
||||
include("../header.inc.php");
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
||||
|
||||
function is_odd($n)
|
||||
{
|
||||
$ln = substr($n,-1);
|
||||
@ -33,12 +35,12 @@
|
||||
}
|
||||
|
||||
if ($submit) {
|
||||
$phpgw->db->query("select group_name from groups where group_id=$group_id");
|
||||
$phpgw->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=$group_id");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$old_group_name = $phpgw->db->f("group_name");
|
||||
$old_group_name = $phpgw->db->f("account_lid");
|
||||
|
||||
$phpgw->db->query("select count(*) from groups where group_name='" . $n_group . "'");
|
||||
$phpgw->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_lid='" . $n_group . "'");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
if ($phpgw->db->f(0) != 0 && $n_group != $old_group_name) {
|
||||
@ -119,27 +121,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
$phpgw->template->set_file(array("form" => "groups_form.tpl"));
|
||||
$p->set_file(array("form" => "groups_form.tpl"));
|
||||
|
||||
if ($error) {
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
$phpgw->template->set_var("error","<p><center>$error</center>");
|
||||
$p->set_var("error","<p><center>$error</center>");
|
||||
} else {
|
||||
$phpgw->template->set_var("error","");
|
||||
$p->set_var("error","");
|
||||
}
|
||||
|
||||
if ($submit) {
|
||||
$phpgw->template->set_var("group_name_value",$n_group_name);
|
||||
$p->set_var("group_name_value",$n_group_name);
|
||||
|
||||
for ($i=0; $i<count($n_users); $i++) {
|
||||
$selected_users[$n_user[$i]] = " selected";
|
||||
}
|
||||
} else {
|
||||
$phpgw->db->query("select group_name from groups where group_id=$group_id");
|
||||
$phpgw->db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=$group_id");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$phpgw->template->set_var("group_name_value",$phpgw->db->f("group_name"));
|
||||
$p->set_var("group_name_value",$phpgw->db->f("account_id"));
|
||||
|
||||
$group_user = $phpgw->acl->get_ids_for_location($group_id,1,'phpgw_group','u');
|
||||
|
||||
@ -152,27 +154,27 @@
|
||||
$db_perms = $apps->read_account_specific();
|
||||
}
|
||||
|
||||
$phpgw->db->query("select * from groups where group_id=$group_id");
|
||||
$phpgw->db->query("SELECT * FROM phpgw_accounts WHERE account_id=$group_id");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$phpgw->template->set_var("form_action",$phpgw->link("editgroup.php"));
|
||||
$phpgw->template->set_var("hidden_vars","<input type=\"hidden\" name=\"group_id\" value=\"" . $group_id . "\">");
|
||||
$p->set_var("form_action",$phpgw->link("editgroup.php"));
|
||||
$p->set_var("hidden_vars","<input type=\"hidden\" name=\"group_id\" value=\"" . $group_id . "\">");
|
||||
|
||||
$phpgw->template->set_var("lang_group_name",lang("group name"));
|
||||
$phpgw->template->set_var("group_name_value",$phpgw->db->f("group_name"));
|
||||
$p->set_var("lang_group_name",lang("group name"));
|
||||
$p->set_var("group_name_value",$phpgw->db->f("account_lid"));
|
||||
|
||||
$phpgw->db->query("select count(*) from accounts where account_status !='L'");
|
||||
$phpgw->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_status !='L' AND account_type='u'");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
if ($phpgw->db->f(0) < 5) {
|
||||
$phpgw->template->set_var("select_size",$phpgw->db->f(0));
|
||||
$p->set_var("select_size",$phpgw->db->f(0));
|
||||
} else {
|
||||
$phpgw->template->set_var("select_size","5");
|
||||
$p->set_var("select_size","5");
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("lang_include_user",lang("Select users for inclusion"));
|
||||
$phpgw->db->query("SELECT account_id,account_firstname,account_lastname,account_lid FROM accounts where "
|
||||
. "account_status != 'L' ORDER BY account_lastname,account_firstname,account_lid asc");
|
||||
$p->set_var("lang_include_user",lang("Select users for inclusion"));
|
||||
$phpgw->db->query("SELECT account_id,account_firstname,account_lastname,account_lid FROM phpgw_accounts WHERE "
|
||||
. "account_status != 'L' AND account_type='u' ORDER BY account_lastname,account_firstname,account_lid asc");
|
||||
while ($phpgw->db->next_record()) {
|
||||
$user_list .= "<option value=\"" . $phpgw->db->f("account_id") . "\""
|
||||
. $selected_users[$phpgw->db->f("account_id")] . ">"
|
||||
@ -180,11 +182,12 @@
|
||||
$phpgw->db->f("account_firstname"),
|
||||
$phpgw->db->f("account_lastname")) . "</option>";
|
||||
}
|
||||
$phpgw->template->set_var("user_list",$user_list);
|
||||
$p->set_var("user_list",$user_list);
|
||||
|
||||
$phpgw->template->set_var("lang_permissions",lang("Permissions this group has"));
|
||||
$p->set_var("lang_permissions",lang("Permissions this group has"));
|
||||
|
||||
$i = 0;
|
||||
reset($phpgw_info["apps"]);
|
||||
$sorted_apps = $phpgw_info["apps"];
|
||||
@asort($sorted_apps);
|
||||
@reset($sorted_apps);
|
||||
@ -223,11 +226,11 @@
|
||||
$i++;
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("permissions_list",$perm_html);
|
||||
$p->set_var("permissions_list",$perm_html);
|
||||
|
||||
$phpgw->template->set_var("lang_submit_button",lang("submit changes"));
|
||||
$p->set_var("lang_submit_button",lang("submit changes"));
|
||||
|
||||
$phpgw->template->pparse("out","form");
|
||||
$p->pparse("out","form");
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -15,63 +15,64 @@
|
||||
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True);
|
||||
include("../header.inc.php");
|
||||
|
||||
$phpgw->template->set_file(array("list" => "groups.tpl",
|
||||
"row" => "groups_row.tpl"));
|
||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
||||
$p->set_file(array("list" => "groups.tpl",
|
||||
"row" => "groups_row.tpl"));
|
||||
|
||||
if (! $start)
|
||||
$start = 0;
|
||||
|
||||
if ($order)
|
||||
$ordermethod = "order by $order $sort";
|
||||
$ordermethod = "ORDER BY $order $sort";
|
||||
else
|
||||
$ordermethod = "order by group_name asc";
|
||||
$ordermethod = "ORDER BY account_lid asc";
|
||||
|
||||
if (! $sort)
|
||||
$sort = "asc";
|
||||
|
||||
if ($query) {
|
||||
$querymethod = " where group_name like '%$query%'";
|
||||
$querymethod = "AND account_lid like '%$query%'";
|
||||
}
|
||||
|
||||
$phpgw->db->query("select count(*) from groups $querymethod");
|
||||
$phpgw->db->query("SELECT count(*) FROM phpgw_accounts WHERE account_type='g' $querymethod");
|
||||
$phpgw->db->next_record();
|
||||
|
||||
$total = $phpgw->db->f(0);
|
||||
$limit = $phpgw->db->limit($start,$total);
|
||||
|
||||
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$phpgw->template->set_var("left_nextmatchs",$phpgw->nextmatchs->left("groups.php",$start,$total));
|
||||
$phpgw->template->set_var("right_nextmatchs",$phpgw->nextmatchs->right("groups.php",$start,$total));
|
||||
$phpgw->template->set_var("lang_groups",lang("user groups"));
|
||||
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$p->set_var("left_nextmatchs",$phpgw->nextmatchs->left("groups.php",$start,$total));
|
||||
$p->set_var("right_nextmatchs",$phpgw->nextmatchs->right("groups.php",$start,$total));
|
||||
$p->set_var("lang_groups",lang("user groups"));
|
||||
|
||||
$phpgw->template->set_var("sort_name",$phpgw->nextmatchs->show_sort_order($sort,"group_name",$order,"groups.php",lang("name")));
|
||||
$phpgw->template->set_var("header_edit",lang("Edit"));
|
||||
$phpgw->template->set_var("header_delete",lang("Delete"));
|
||||
$p->set_var("sort_name",$phpgw->nextmatchs->show_sort_order($sort,"account_lid",$order,"groups.php",lang("name")));
|
||||
$p->set_var("header_edit",lang("Edit"));
|
||||
$p->set_var("header_delete",lang("Delete"));
|
||||
|
||||
$phpgw->db->query("select * from groups $querymethod $ordermethod $limit");
|
||||
$phpgw->db->query("SELECT * FROM phpgw_accounts WHERE account_type='g' $querymethod $ordermethod $limit");
|
||||
while ($phpgw->db->next_record()) {
|
||||
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
|
||||
|
||||
$phpgw->template->set_var("tr_color",$tr_color);
|
||||
$p->set_var("tr_color",$tr_color);
|
||||
|
||||
$group_name = $phpgw->db->f("group_name");
|
||||
$group_name = $phpgw->db->f("account_lid");
|
||||
|
||||
if (! $group_name) $group_name = ' ';
|
||||
|
||||
$phpgw->template->set_var("group_name",$group_name);
|
||||
$phpgw->template->set_var("edit_link",'<a href="' . $phpgw->link("editgroup.php","group_id=" . $phpgw->db->f("group_id")) . '"> ' . lang("Edit") . ' </a>');
|
||||
$phpgw->template->set_var("delete_link",'<a href="' . $phpgw->link("deletegroup.php","group_id=" . $phpgw->db->f("group_id")) . '"> ' . lang("Delete") . ' </a>');
|
||||
$p->set_var("group_name",$group_name);
|
||||
$p->set_var("edit_link",'<a href="' . $phpgw->link("editgroup.php","group_id=" . $phpgw->db->f("account_id")) . '"> ' . lang("Edit") . ' </a>');
|
||||
$p->set_var("delete_link",'<a href="' . $phpgw->link("deletegroup.php","group_id=" . $phpgw->db->f("account_id")) . '"> ' . lang("Delete") . ' </a>');
|
||||
|
||||
$phpgw->template->parse("rows","row",True);
|
||||
$p->parse("rows","row",True);
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("new_action",$phpgw->link("newgroup.php"));
|
||||
$phpgw->template->set_var("lang_add",lang("add"));
|
||||
$p->set_var("new_action",$phpgw->link("newgroup.php"));
|
||||
$p->set_var("lang_add",lang("add"));
|
||||
|
||||
$phpgw->template->set_var("search_action",$phpgw->link("groups.php"));
|
||||
$phpgw->template->set_var("lang_search",lang("search"));
|
||||
$p->set_var("search_action",$phpgw->link("groups.php"));
|
||||
$p->set_var("lang_search",lang("search"));
|
||||
|
||||
$phpgw->template->pparse("out","list");
|
||||
$p->pparse("out","list");
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user