phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: admin/inc class.uiaccounts.inc.php,1.21,1.22 cla


From: Mark A Peters <address@hidden>
Subject: [Phpgroupware-cvs] CVS: admin/inc class.uiaccounts.inc.php,1.21,1.22 class.boaccounts.inc.php,1.20,1.21 class.uimenuclass.inc.php,1.7,1.8
Date: Thu, 10 Jan 2002 13:18:46 -0500

Update of /cvsroot/phpgroupware/admin/inc
In directory subversions:/tmp/cvs-serv30854/admin/inc

Modified Files:
        class.uiaccounts.inc.php class.boaccounts.inc.php 
        class.uimenuclass.inc.php 
Log Message:
This will allow admin members to grant group managers to user(s) of a group.

Index: class.uiaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uiaccounts.inc.php,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** class.uiaccounts.inc.php    27 Dec 2001 15:14:01 -0000      1.21
--- class.uiaccounts.inc.php    10 Jan 2002 18:18:44 -0000      1.22
***************
*** 23,27 ****
                        'edit_user'   => True,
                        'edit_group'  => True,
!                       'view_user'   => True
                );
  
--- 23,28 ----
                        'edit_user'   => True,
                        'edit_group'  => True,
!                       'view_user'   => True,
!                       'group_manager' => True
                );
  
***************
*** 671,674 ****
--- 672,710 ----
                }
  
+               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='')
                {
***************
*** 772,776 ****
                                        . $perm_display[$i][0] . ']" 
value="True"'.($group_info['account_apps'][$app]?' checked':'').'></td><td 
width="5%">'
                                        .($apps_with_acl[$app] && 
$group_info['account_id']?'<a 
href="'.$GLOBALS['phpgw']->link('/preferences/acl_preferences.php','acl_app='.$app.'&owner='.$group_info['account_id'])
!                                       .'" target="_blank"><img 
src="'.$GLOBALS['phpgw']->common->image('admin','dot.gif').'" border="0" 
hspace="3" align="absmiddle" alt="'
                                        .lang('Grant 
Access').'"></a>':'&nbsp;').'</td>'.($i & 1?'</tr>':'')."\n";
                        }
--- 808,812 ----
                                        . $perm_display[$i][0] . ']" 
value="True"'.($group_info['account_apps'][$app]?' checked':'').'></td><td 
width="5%">'
                                        .($apps_with_acl[$app] && 
$group_info['account_id']?'<a 
href="'.$GLOBALS['phpgw']->link('/preferences/acl_preferences.php','acl_app='.$app.'&owner='.$group_info['account_id'])
!                                       .'" target="_blank"><img 
src="'.$GLOBALS['phpgw']->common->image('admin','dot').'" border="0" hspace="3" 
align="absmiddle" alt="'
                                        .lang('Grant 
Access').'"></a>':'&nbsp;').'</td>'.($i & 1?'</tr>':'')."\n";
                        }
***************
*** 785,788 ****
--- 821,828 ----
                        );
                        $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');
                }
***************
*** 1046,1049 ****
--- 1086,1143 ----
                        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 .= '<option value="' . 
$entry['account_id'] . '"'
+                                       . 
$group_info['account_managers'][intval($entry['account_id'])] . '>'
+                                       . 
$GLOBALS['phpgw']->common->grab_owner_name($entry['account_id'])
+                                       . '</option>'."\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'] = '<input type="hidden" 
name="account_id" value="'.$group_info['account_id'].'">';
+                       $var['lang_select_managers'] = lang('Select Group 
Managers');
+                       $var['group_members'] = '<select name="managers[]" 
size="'.(count($account_list)<5?count($account_list):5).'" 
multiple>'.$user_list.'</select>';
+                       $var['form_buttons'] = '<tr align="center"><td 
colspan="2"><input type="submit" name="submit" 
value="'.lang('Submit').'">&nbsp;&nbsp;'
+                               . '<input type="submit" name="cancel" 
value="'.lang('Cancel').'"><td></tr>';
+                       $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');
+               }
+ 
        }
  ?>

Index: class.boaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.boaccounts.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** class.boaccounts.inc.php    2 Jan 2002 14:33:02 -0000       1.20
--- class.boaccounts.inc.php    10 Jan 2002 18:18:44 -0000      1.21
***************
*** 21,25 ****
                        'delete_user'  => True,
                        'edit_group'   => True,
!                       'edit_user'    => True
                );
  
--- 21,26 ----
                        'delete_user'  => True,
                        'edit_group'   => True,
!                       'edit_user'    => True,
!                       'set_group_managers'    => True
                );
  
***************
*** 551,555 ****
                                        else
                                        {
!                                               
ExecMethod('admin.uiaccountsiedit_user',$GLOBALS['HTTP_GET_VARS']['account_id']);
                                                return False;
                                        }
--- 552,556 ----
                                        else
                                        {
!                                               
ExecMethod('admin.uiaccounts.edit_user',$GLOBALS['HTTP_GET_VARS']['account_id']);
                                                return False;
                                        }
***************
*** 563,566 ****
--- 564,595 ----
                }
  
+               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)
                {
***************
*** 754,757 ****
--- 783,806 ----
                {
                        $temp_user = 
$GLOBALS['phpgw']->acl->get_ids_for_location($account_id,1,'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_managers($account_id)
+               {
+                       $temp_user = 
$GLOBALS['phpgw']->acl->get_ids_for_location($account_id,PHPGW_ACL_GROUP_MANAGERS,'phpgw_group');
                        if(!$temp_user)
                        {

Index: class.uimenuclass.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uimenuclass.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** class.uimenuclass.inc.php   2 Jan 2002 14:33:02 -0000       1.7
--- class.uimenuclass.inc.php   10 Jan 2002 18:18:44 -0000      1.8
***************
*** 62,66 ****
                        
$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'));
                        $this->t->set_var('lang_done',lang('Back'));
  
--- 62,74 ----
                        
$this->t->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
  
!                       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'));
  
***************
*** 91,99 ****
                                        );
                                        break;
                        }
  
                        $GLOBALS['phpgw']->hooks->process($_hookname);
  
!                       if (count($GLOBALS['menuData']) > 1) 
                        {
                                $result = 
$this->display_section($GLOBALS['menuData']);
--- 99,121 ----
                                        );
                                        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) 
                        {
                                $result = 
$this->display_section($GLOBALS['menuData']);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]