diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php
index b6ba188af7..8b7438d71f 100755
--- a/admin/inc/class.boaccounts.inc.php
+++ b/admin/inc/class.boaccounts.inc.php
@@ -20,7 +20,8 @@
'delete_group' => True,
'delete_user' => True,
'edit_group' => True,
- 'edit_user' => True
+ 'edit_user' => True,
+ 'set_group_managers' => True
);
var $xml_functions = array();
@@ -550,7 +551,7 @@
}
else
{
- ExecMethod('admin.uiaccountsiedit_user',$GLOBALS['HTTP_GET_VARS']['account_id']);
+ ExecMethod('admin.uiaccounts.edit_user',$GLOBALS['HTTP_GET_VARS']['account_id']);
return False;
}
}
@@ -562,6 +563,34 @@
}
}
+ function set_group_managers()
+ {
+ if($GLOBALS['phpgw']->acl->check('group_access',16,'admin') || $GLOBALS['HTTP_POST_VARS']['cancel'])
+ {
+ $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ elseif($GLOBALS['HTTP_POST_VARS']['submit'])
+ {
+ $acl = CreateObject('phpgwapi.acl',intval($GLOBALS['HTTP_POST_VARS']['account_id']));
+
+ $users = $GLOBALS['phpgw']->accounts->member($GLOBALS['HTTP_POST_VARS']['account_id']);
+ @reset($users);
+ while($managers && list($key,$user) = each($users))
+ {
+ $acl->add_repository('phpgw_group',intval($GLOBALS['HTTP_POST_VARS']['account_id']),$user['account_id'],1);
+ }
+ $managers = $GLOBALS['HTTP_POST_VARS']['managers'];
+ @reset($managers);
+ while($managers && list($key,$manager) = each($managers))
+ {
+ $acl->add_repository('phpgw_group',intval($GLOBALS['HTTP_POST_VARS']['account_id']),$manager,(1 + PHPGW_ACL_GROUP_MANAGERS));
+ }
+ }
+ $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'));
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
function validate_group($group_info)
{
$errors = Array();
@@ -770,6 +799,26 @@
return $account_user;
}
+ function load_group_managers($account_id)
+ {
+ $temp_user = $GLOBALS['phpgw']->acl->get_ids_for_location($account_id,PHPGW_ACL_GROUP_MANAGERS,'phpgw_group');
+ if(!$temp_user)
+ {
+ return Array();
+ }
+ else
+ {
+ $group_user = $temp_user;
+ }
+ $account_user = Array();
+ while (list($key,$user) = each($group_user))
+ {
+ $account_user[$user] = ' selected';
+ }
+ @reset($account_user);
+ return $account_user;
+ }
+
function load_group_apps($account_id)
{
$apps = CreateObject('phpgwapi.applications',intval($account_id));
diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php
index c4f94a2dc1..dada96fb2a 100755
--- a/admin/inc/class.uiaccounts.inc.php
+++ b/admin/inc/class.uiaccounts.inc.php
@@ -22,7 +22,8 @@
'delete_user' => True,
'edit_user' => True,
'edit_group' => True,
- 'view_user' => True
+ 'view_user' => True,
+ 'group_manager' => True
);
var $bo;
@@ -670,6 +671,41 @@
$t->pfp('out','form');
}
+ function group_manager($cd='',$account_id='')
+ {
+ if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
+ {
+ $this->list_groups();
+ return False;
+ }
+
+ $cdid = $cd;
+ settype($cd,'integer');
+ $cd = ($GLOBALS['HTTP_GET_VARS']['cd']?$GLOBALS['HTTP_GET_VARS']['cd']:intval($cdid));
+
+ $accountid = $account_id;
+ settype($account_id,'integer');
+ $account_id = ($GLOBALS['HTTP_GET_VARS']['account_id']?$GLOBALS['HTTP_GET_VARS']['account_id']:intval($accountid));
+
+ // todo
+ // not needed if i use the same file for new groups too
+ if (! $account_id)
+ {
+ $this->list_groups();
+ }
+ else
+ {
+ $group_info = Array(
+ 'account_id' => intval($GLOBALS['HTTP_GET_VARS']['account_id']),
+ 'account_name' => $GLOBALS['phpgw']->accounts->id2name($GLOBALS['HTTP_GET_VARS']['account_id']),
+ 'account_user' => $GLOBALS['phpgw']->accounts->member($GLOBALS['HTTP_GET_VARS']['account_id']),
+ 'account_managers' => $this->bo->load_group_managers($GLOBALS['HTTP_GET_VARS']['account_id'])
+ );
+
+ $this->edit_group_managers($group_info);
+ }
+ }
+
function create_edit_group($group_info,$_errors='')
{
$apps_with_acl = Array(
@@ -771,7 +807,7 @@
. '
'
.($apps_with_acl[$app] && $group_info['account_id']?' ':' ').' '.($i & 1?'':'')."\n";
}
if($i & 1)
@@ -784,6 +820,10 @@
'lang_submit_button' => lang('submit changes')
);
$p->set_var($var);
+
+ // create the menu on the left, if needed
+ $p->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','group_manager'));
+
$p->pfp('out','form');
}
@@ -1045,5 +1085,59 @@
echo $t->fp('out','form');
}
+
+ function edit_group_managers($group_info,$_errors='')
+ {
+ if ($GLOBALS['phpgw']->acl->check('group_access',16,'admin'))
+ {
+ $this->list_groups();
+ return False;
+ }
+
+ $accounts = CreateObject('phpgwapi.accounts',$group_info['account_id'],'u');
+ $account_list = $accounts->member($group_info['account_id']);
+ $user_list = '';
+ while (list($key,$entry) = each($account_list))
+ {
+ $user_list .= ''
+ . $GLOBALS['phpgw']->common->grab_owner_name($entry['account_id'])
+ . ' '."\n";
+ }
+
+ unset($GLOBALS['phpgw_info']['flags']['noheader']);
+ unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+ $GLOBALS['phpgw']->common->phpgw_header();
+
+ $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+ $t->set_unknowns('remove');
+
+ $t->set_file(
+ Array(
+ 'manager' =>'group_manager.tpl'
+ )
+ );
+
+ $t->set_block('manager','form','form');
+ $t->set_block('manager','link_row','link_row');
+
+ $var['th_bg'] = $GLOBALS['phpgw_info']['user']['theme']['th_bg'];
+ $var['lang_group'] = lang('Group');
+ $var['group_name'] = $group_info['account_name'];
+ $var['tr_color1'] = $GLOBALS['phpgw_info']['user']['theme']['row_on'];
+ $var['form_action'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.boaccounts.set_group_managers');
+ $var['hidden'] = ' ';
+ $var['lang_select_managers'] = lang('Select Group Managers');
+ $var['group_members'] = ''.$user_list.' ';
+ $var['form_buttons'] = ' '
+ . ' ';
+ $t->set_var($var);
+
+ // create the menu on the left, if needed
+ $t->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','edit_group'));
+
+ $t->pfp('out','form');
+ }
+
}
?>
diff --git a/admin/inc/class.uimenuclass.inc.php b/admin/inc/class.uimenuclass.inc.php
index 9ce6547983..4b5584b71c 100644
--- a/admin/inc/class.uimenuclass.inc.php
+++ b/admin/inc/class.uimenuclass.inc.php
@@ -61,7 +61,15 @@
$this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
- $this->t->set_var('link_done',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'));
+ if(strpos($_userdata[0]['description'],'User'))
+ {
+ $destination = 'users';
+ }
+ else
+ {
+ $destination = 'groups';
+ }
+ $this->t->set_var('link_done',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_'.$destination));
$this->t->set_var('lang_done',lang('Back'));
$this->t->set_var('row_on',$this->rowColor[0]);
@@ -90,11 +98,25 @@
'extradata' => 'menuaction=admin.uiaccounts.view_user'
);
break;
+ case 'edit_group':
+ $GLOBALS['menuData'][] = array(
+ 'description' => 'Edit Group',
+ 'url' => '/index.php',
+ 'extradata' => 'menuaction=admin.uiaccounts.edit_group'
+ );
+ break;
+ case 'group_manager':
+ $GLOBALS['menuData'][] = array(
+ 'description' => 'Group Manager',
+ 'url' => '/index.php',
+ 'extradata' => 'menuaction=admin.uiaccounts.group_manager'
+ );
+ break;
}
$GLOBALS['phpgw']->hooks->process($_hookname);
- if (count($GLOBALS['menuData']) > 1)
+ if (count($GLOBALS['menuData']) >= 1)
{
$result = $this->display_section($GLOBALS['menuData']);
//clear $menuData
diff --git a/admin/templates/default/group_form.tpl b/admin/templates/default/group_form.tpl
index 8a4534a2b5..d58bcb4048 100644
--- a/admin/templates/default/group_form.tpl
+++ b/admin/templates/default/group_form.tpl
@@ -1,38 +1,47 @@
{error}
diff --git a/admin/templates/default/group_manager.tpl b/admin/templates/default/group_manager.tpl
new file mode 100755
index 0000000000..7554e2abc2
--- /dev/null
+++ b/admin/templates/default/group_manager.tpl
@@ -0,0 +1,37 @@
+
+{error_messages}
+
+
+
+
+
+ {rows}
+
+
+
+
+
+ {lang_group}:
+ {group_name}
+
+
+
+ {hidden}
+
+ {lang_select_managers}
+ {group_members}
+
+ {form_buttons}
+
+
+
+
+
+
+
+
+
+
+ {row_text}
+
+
diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php
index b6d8aef6ea..4b74c8cded 100644
--- a/phpgwapi/inc/functions.inc.php
+++ b/phpgwapi/inc/functions.inc.php
@@ -708,6 +708,7 @@
define('PHPGW_ACL_EDIT',4);
define('PHPGW_ACL_DELETE',8);
define('PHPGW_ACL_PRIVATE',16);
+ define('PHPGW_ACL_GROUP_MANAGERS',32);
/****************************************************************************\
* Stuff to use if logging in or logging out *