2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - administration *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2000-11-21 01:41:31 +01:00
|
|
|
$phpgw_info = array();
|
2001-02-09 18:57:43 +01:00
|
|
|
$phpgw_info['flags'] = array('noheader' => True, 'nonavbar' => True, 'currentapp' => 'admin');
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-01-21 03:05:45 +01:00
|
|
|
if (! $group_id) {
|
2001-03-09 00:32:22 +01:00
|
|
|
Header('Location: ' . $phpgw->link('/admin/groups.php'));
|
2001-01-21 03:05:45 +01:00
|
|
|
}
|
2001-02-09 18:57:43 +01:00
|
|
|
include('../header.inc.php');
|
2001-02-01 05:02:01 +01:00
|
|
|
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->set_file(array('body' => 'delete_common.tpl',
|
|
|
|
'message_row' => 'message_row.tpl'));
|
2000-08-19 05:38:35 +02:00
|
|
|
|
|
|
|
if ((($group_id) && ($confirm)) || $removeusers) {
|
|
|
|
if ($removeusers) {
|
2001-02-09 18:57:43 +01:00
|
|
|
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
|
2001-02-01 05:02:01 +01:00
|
|
|
@reset($old_group_list);
|
|
|
|
while($old_group_list && $id = each($old_group_list)) {
|
2001-02-09 18:57:43 +01:00
|
|
|
$phpgw->acl->delete_repository('phpgw_group',$group_id,intval($id[1]));
|
2000-08-19 05:38:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$group_name = $phpgw->accounts->id2name($group_id);
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$old_group_list = $phpgw->acl->get_ids_for_location(intval($group_id),1,'phpgw_group');
|
2001-02-01 05:02:01 +01:00
|
|
|
if ($old_group_list) {
|
2000-09-28 17:01:11 +02:00
|
|
|
$phpgw->common->phpgw_header();
|
2001-01-06 05:11:13 +01:00
|
|
|
echo parse_navbar();
|
2000-08-19 05:38:35 +02:00
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->set_var('message_display','<tr><td>'
|
|
|
|
. lang('Sorry, the follow users are still a member of the group x',$group_name)
|
|
|
|
. '<br>' . lang('They must be removed before you can continue') . '</td></td>');
|
|
|
|
$p->parse('messages','message_row',True);
|
|
|
|
|
|
|
|
$p->set_var('message_display','<tr><td><table border="0">');
|
|
|
|
$p->parse('messages','message_row',True);
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2001-02-01 05:02:01 +01:00
|
|
|
while (list(,$id) = each($old_group_list)) {
|
2001-03-09 00:32:22 +01:00
|
|
|
$p->set_var('message_display','<tr><td><a href="' . $phpgw->link('/admin/editaccount.php','account_=' . $id) . '">' . $phpgw->common->grab_owner_name($id) . '</a></tr></td>');
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->parse('messages','message_row',True);
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->set_var('message_display','</table></center></td></tr><tr><td>'
|
2001-03-09 00:32:22 +01:00
|
|
|
. '<a href="' . $phpgw->link('/admin/deletegroup.php','group_id=' . $group_id . '&removeusers=True')
|
2001-02-09 18:57:43 +01:00
|
|
|
. '">' . lang('Remove all users from this group') . '</a></td></tr>');
|
|
|
|
$p->parse('messages','message_row',True);
|
|
|
|
$p->set_var('yes','');
|
|
|
|
$p->set_var('no','');
|
|
|
|
$p->pparse('out','body');
|
2000-12-23 23:50:32 +01:00
|
|
|
$phpgw->common->phpgw_exit();
|
2000-08-18 05:24:22 +02:00
|
|
|
}
|
|
|
|
|
2000-08-19 05:38:35 +02:00
|
|
|
if ($confirm) {
|
2001-02-09 18:57:43 +01:00
|
|
|
$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;
|
2000-08-19 05:38:35 +02:00
|
|
|
|
|
|
|
if (! @rmdir($basedir . $group_name)) {
|
2001-02-09 18:57:43 +01:00
|
|
|
$cd = 38;
|
2000-08-19 05:38:35 +02:00
|
|
|
} else {
|
|
|
|
$cd = 32;
|
|
|
|
}
|
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$phpgw->db->unlock();
|
|
|
|
|
2001-03-09 00:32:22 +01:00
|
|
|
Header('Location: ' . $phpgw->link('/admin/groups.php','cd='.$cd));
|
2001-02-01 05:02:01 +01:00
|
|
|
$phpgw->common->phpgw_exit();
|
2000-08-19 05:38:35 +02:00
|
|
|
}
|
2001-02-01 05:02:01 +01:00
|
|
|
} else {
|
2000-08-19 05:38:35 +02:00
|
|
|
|
2001-02-01 05:02:01 +01:00
|
|
|
$phpgw->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
2001-01-21 03:05:45 +01:00
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->set_var('message_display',lang('Are you sure you want to delete this group ?'));
|
|
|
|
$p->parse('messages','message_row');
|
2001-03-09 00:32:22 +01:00
|
|
|
$p->set_var('yes','<a href="' . $phpgw->link('/admin/deletegroup.php',"group_id=$group_id&confirm=true") . '">' . lang('Yes') . '</a>');
|
|
|
|
$p->set_var('no','<a href="' . $phpgw->link('/admin/groups.php') . '">' . lang('No') . '</a>');
|
2001-01-21 03:05:45 +01:00
|
|
|
|
2001-02-09 18:57:43 +01:00
|
|
|
$p->pparse('out','body');
|
2001-01-21 03:05:45 +01:00
|
|
|
|
2001-02-01 05:02:01 +01:00
|
|
|
$phpgw->common->phpgw_footer();
|
|
|
|
}
|
2000-09-28 01:17:36 +02:00
|
|
|
?>
|