From 0a1494dde1056c8478e28bdd3cf985777ab46c2d Mon Sep 17 00:00:00 2001 From: skeeter Date: Fri, 9 Feb 2001 17:57:43 +0000 Subject: [PATCH] All group activities are working --- admin/deletegroup.php | 76 +++++++++++----------- admin/templates/default/delete_common.tpl | 6 +- admin/templates/default/message_row.tpl | 5 ++ admin/templates/verdilak/delete_common.tpl | 5 -- admin/templates/verdilak/message_row.tpl | 5 ++ 5 files changed, 52 insertions(+), 45 deletions(-) create mode 100755 admin/templates/default/message_row.tpl create mode 100755 admin/templates/verdilak/message_row.tpl diff --git a/admin/deletegroup.php b/admin/deletegroup.php index b763b0d322..e3d5020d84 100755 --- a/admin/deletegroup.php +++ b/admin/deletegroup.php @@ -12,68 +12,70 @@ /* $Id$ */ $phpgw_info = array(); - $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "admin"); + $phpgw_info['flags'] = array('noheader' => True, 'nonavbar' => True, 'currentapp' => 'admin'); if (! $group_id) { - Header("Location: " . $phpgw->link("groups.php")); + Header('Location: ' . $phpgw->link('groups.php')); } - include("../header.inc.php"); + include('../header.inc.php'); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin')); - $p->set_file(array("body" => "delete_common.tpl")); + $p->set_file(array('body' => 'delete_common.tpl', + 'message_row' => 'message_row.tpl')); if ((($group_id) && ($confirm)) || $removeusers) { if ($removeusers) { - $old_group_list = $phpgw->acl->get_ids_for_location("$group_id",1,"phpgw_group","u"); + $old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group'); @reset($old_group_list); while($old_group_list && $id = each($old_group_list)) { - $phpgw->acl->delete("phpgw_group","$group_id",intval($id[1]),"u"); + $phpgw->acl->delete_repository('phpgw_group',$group_id,intval($id[1])); } } - $phpgw->db->query("select group_name from groups where group_id=$group_id",__LINE__,__FILE__); - $phpgw->db->next_record(); + $group_name = $phpgw->accounts->id2name($group_id); - $group_name = $phpgw->db->f("group_name"); - - $old_group_list = $phpgw->acl->get_ids_for_location("$group_id",1,"phpgw_group","u"); + $old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group'); if ($old_group_list) { $phpgw->common->phpgw_header(); echo parse_navbar(); - echo '

'; - echo lang("Sorry, the follow users are still a member of the group x",$group_name) - . '
' . lang("They must be removed before you can continue") - . ''; - - echo ''); + $p->parse('messages','message_row',True); + + $p->set_var('message_display','
'; + $p->set_var('message_display','
' + . lang('Sorry, the follow users are still a member of the group x',$group_name) + . '
' . lang('They must be removed before you can continue') . '
'); + $p->parse('messages','message_row',True); while (list(,$id) = each($old_group_list)) { - echo ''; + $p->set_var('message_display',''); + $p->parse('messages','message_row',True); } - echo "
' . $phpgw->common->grab_owner_name($id) . '
' . $phpgw->common->grab_owner_name($id) . '
"; - echo "link("deletegroup.php","group_id=" . $group_id . "&removeusers=True") - . "\">" . lang("Remove all users from this group") . ""; + $p->set_var('message_display','
' + . '' . lang('Remove all users from this group') . ''); + $p->parse('messages','message_row',True); + $p->set_var('yes',''); + $p->set_var('no',''); + $p->pparse('out','body'); $phpgw->common->phpgw_exit(); } if ($confirm) { - $phpgw->db->query("select group_name from groups where group_id=$group_id",__LINE__,__FILE__); - $phpgw->db->next_record(); - $group_name = $phpgw->db->f("group_name"); - - $phpgw->db->query("delete from groups where group_id=$group_id",__LINE__,__FILE__); - - $sep = $phpgw->common->filesystem_separator(); - - $basedir = $phpgw_info["server"]["files_dir"] . $sep . "groups" . $sep; + $phpgw->db->lock(array('phpgw_accounts','phpgw_acl')); + $phpgw->db->query('DELETE FROM phpgw_accounts WHERE account_id='.$group_id,__LINE__,__FILE__); + $phpgw->acl->delete_repository('%%','run',intval($group_id)); + + $basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP; if (! @rmdir($basedir . $group_name)) { - $cd = 38; + $cd = 38; } else { $cd = 32; } - Header("Location: " . $phpgw->link("groups.php","cd=$cd")); + $phpgw->db->unlock(); + + Header('Location: ' . $phpgw->link('groups.php','cd='.$cd)); $phpgw->common->phpgw_exit(); } } else { @@ -81,12 +83,12 @@ $phpgw->common->phpgw_header(); echo parse_navbar(); - $p->set_var("message_display",lang("Are you sure you want to delete this group ?")); - $p->parse("messages","message_row"); - $p->set_var("yes",'' . lang("Yes") . ''); - $p->set_var("no",'' . lang("No") . ''); + $p->set_var('message_display',lang('Are you sure you want to delete this group ?')); + $p->parse('messages','message_row'); + $p->set_var('yes','' . lang('Yes') . ''); + $p->set_var('no','' . lang('No') . ''); - $p->pparse("out","body"); + $p->pparse('out','body'); $phpgw->common->phpgw_footer(); } diff --git a/admin/templates/default/delete_common.tpl b/admin/templates/default/delete_common.tpl index 56843dc83a..ff6b9bce89 100644 --- a/admin/templates/default/delete_common.tpl +++ b/admin/templates/default/delete_common.tpl @@ -1,12 +1,12 @@ +
- - - + {messages}
{message}
{no} {yes}
+ diff --git a/admin/templates/default/message_row.tpl b/admin/templates/default/message_row.tpl new file mode 100755 index 0000000000..5d249d1502 --- /dev/null +++ b/admin/templates/default/message_row.tpl @@ -0,0 +1,5 @@ + + + {message_display} + + diff --git a/admin/templates/verdilak/delete_common.tpl b/admin/templates/verdilak/delete_common.tpl index c69608440e..ff6b9bce89 100644 --- a/admin/templates/verdilak/delete_common.tpl +++ b/admin/templates/verdilak/delete_common.tpl @@ -10,8 +10,3 @@ - - - {message_display} - - diff --git a/admin/templates/verdilak/message_row.tpl b/admin/templates/verdilak/message_row.tpl new file mode 100755 index 0000000000..5d249d1502 --- /dev/null +++ b/admin/templates/verdilak/message_row.tpl @@ -0,0 +1,5 @@ + + + {message_display} + +