[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc class.boaccounts.inc.php class.uiacco...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] admin/inc class.boaccounts.inc.php class.uiacco... |
Date: |
Wed, 22 Mar 2006 13:27:06 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: admin
Branch:
Changes by: Dave Hall <address@hidden> 06/03/22 13:27:05
Modified files:
inc : class.boaccounts.inc.php
class.uiaccounts.inc.php
Log message:
this is still broken, but atleast it looks nicer, fixes coming soon :)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/class.boaccounts.inc.php.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/admin/inc/class.uiaccounts.inc.php.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
Patches:
Index: admin/inc/class.boaccounts.inc.php
diff -u admin/inc/class.boaccounts.inc.php:1.43
admin/inc/class.boaccounts.inc.php:1.44
--- admin/inc/class.boaccounts.inc.php:1.43 Tue Mar 21 12:54:56 2006
+++ admin/inc/class.boaccounts.inc.php Wed Mar 22 13:27:05 2006
@@ -9,8 +9,10 @@
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\**************************************************************************/
- /* $Id: class.boaccounts.inc.php,v 1.43 2006/03/21 12:54:56 sigurdne
Exp $ */
+ /* $Id: class.boaccounts.inc.php,v 1.44 2006/03/22 13:27:05 skwashd Exp
$ */
+ //FIXME define constants for rights so we can fuck all these magic
numbers
+
class boaccounts
{
var $so;
@@ -103,6 +105,24 @@
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups');
}
+ $old_group =& CreateObject('phpgwapi.accounts',
$values['account_id'], 'g');
+ $old_group->read_repository();
+ $old_group->member($old_group->account_id);
+
+ $new_group =& CreateObject('phpgwapi.accounts',
$values['account_id'], 'g');
+ $new_group->read_repository();
+ $new_group->set_lid($values['account_name']);
+
+ $GLOBALS['phpgw']->db->lock(array('phpgw_accounts',
+
'phpgw_preferences',
+
'phpgw_config',
+
'phpgw_applications',
+
'phpgw_hooks',
+
'phpgw_sessions',
+
'phpgw_acl',
+
'phpgw_app_sessions'
+
));
+
$temp_users =
($values['account_user']?$values['account_user']:Array());
$account_user = Array();
@reset($temp_users);
@@ -191,10 +211,17 @@
$cd = 33;
}
- // Set group acl
- $acl =
CreateObject('phpgwapi.acl',$group_info['account_id']);
- $old_group_list =
$acl->get_ids_for_location($group_info['account_id'],1,'phpgw_group');
- if ($old_group_list)
+ // set group applications
+ $this->set_module_permissions($new_group->get_id(),
$values['account_apps']);
+
+ // members handling
+ // Add new members to group
+ $acl =& CreateObject('phpgwapi.acl',
$values['account_id']);
+ $old_group_list = $old_group->get_members();
+
+ die ( '<pre>' . print_r($old_group_list, true) .
'</pre>');
+
+ for($i = 0; $i < count($values['account_user']); $i++)
{
@reset($old_group_list);
while(list($key,$user_id) =
each($old_group_list))
@@ -260,6 +287,12 @@
$GLOBALS['phpgw']->db->unlock();
+ // FIXME Use the VFS class for this - skwashd Mar-2006
+ if($old_group->get_lid() != $new_group->get_lid())
+ {
+ $basedir =
$GLOBALS['phpgw_info']['server']['files_dir'] . SEP . 'groups' . SEP;
+ @rename($basedir . $old_group->get_lid(),
$basedir . $new_group->get_lid());
+ }
ExecMethod('admin.uiaccounts.list_groups');
return False;
}
@@ -615,14 +648,13 @@
$account_apps = array();
if($account_id)
{
- $apps =&
CreateObject('phpgwapi.applications',intval($account_id));
- $app_list = $apps->read_account_specific();
+ $apps =& CreateObject('phpgwapi.applications',
(int) $account_id);
+ $group_apps = $apps->read_account_specific();
- while(list($key,$app) = each($app_list))
+ foreach ( $group_apps as $app )
{
$account_apps[$app['name']] = True;
}
- @reset($account_apps);
}
return $account_apps;
}
Index: admin/inc/class.uiaccounts.inc.php
diff -u admin/inc/class.uiaccounts.inc.php:1.55
admin/inc/class.uiaccounts.inc.php:1.56
--- admin/inc/class.uiaccounts.inc.php:1.55 Tue Mar 21 12:54:56 2006
+++ admin/inc/class.uiaccounts.inc.php Wed Mar 22 13:27:05 2006
@@ -9,7 +9,7 @@
* Free Software Foundation; either version 2 of the License, or (at
your *
* option) any later version.
*
\**************************************************************************/
- /* $Id: class.uiaccounts.inc.php,v 1.55 2006/03/21 12:54:56 sigurdne
Exp $ */
+ /* $Id: class.uiaccounts.inc.php,v 1.56 2006/03/22 13:27:05 skwashd Exp
$ */
class uiaccounts
{
@@ -86,18 +86,8 @@
$GLOBALS['phpgw']->xslttpl->add_file('groups');
-
- /* what should this be for??? this is the same call for
both cases! can this be removed? [ceb] */
- if
($GLOBALS['phpgw']->acl->check('group_access',2,'admin'))
- {
- $account_info =
$GLOBALS['phpgw']->accounts->get_list('groups',$start,$sort, $order, $query,
$total);
- $total = $GLOBALS['phpgw']->accounts->total;
- }
- else
- {
- $account_info =
$GLOBALS['phpgw']->accounts->get_list('groups',$start,$sort, $order, $query,
$total);
- $total = $GLOBALS['phpgw']->accounts->total;
- }
+ $account_info =
$GLOBALS['phpgw']->accounts->get_list('groups',$start,$sort, $order, $query,
$total);
+ $total = $GLOBALS['phpgw']->accounts->total;
$link_data = array
(
@@ -306,12 +296,19 @@
function edit_group()
{
- $account_id =
get_var('account_id',array('POST','GET'));
- $values = get_var('values',array('POST'));
- $account_user = get_var('account_user',array('POST'));
- $account_apps = get_var('account_apps',array('POST'));
+ $account_apps = $_REQUEST['account_apps'];
+ $account_id = (int) $_REQUEST['account_id'];
+ $account_user = $_REQUEST['account_user'];
+ $error_list = '';
+ $group_manager = (int) $_REQUEST['group_manager'];
+ $values = $_REQUEST['values'];
- if ($values['save'])
+ if ( (isset($values['cancel']) && $values['cancel']) ||
(!$account_id && $GLOBALS['phpgw']->acl->check('group_access',4,'admin')) ||
($account_id && $GLOBALS['phpgw']->acl->check('group_access',16,'admin')))
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups');
+ }
+
+ if ( isset($values['save']) && $values['save'] )
{
$error = $this->bo->validate_group($values);
@@ -330,6 +327,11 @@
{
$values['account_apps'] =
$account_apps;
}
+
+ if ( $group_manager )
+ {
+ $values['group_manager'] =
$group_manager;
+ }
if ($values['account_id'])
{
@@ -344,10 +346,12 @@
}
}
- if ($values['cancel'] || (!$account_id &&
$GLOBALS['phpgw']->acl->check('group_access',4,'admin')) || ($account_id &&
$GLOBALS['phpgw']->acl->check('group_access',16,'admin')))
+ if ( !isset($GLOBALS['phpgw']->js) ||
!is_object($GLOBALS['phpgw']->js) )
{
-
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups');
+ $GLOBALS['phpgw']->js =
createObject('phpgwapi.javascript');
}
+ $js =& $GLOBALS['phpgw']->js;
+ $js->validate_file('base', 'groups', 'admin');
$group =& CreateObject('phpgwapi.accounts',
$account_id, 'g');
$group->read_repository();
@@ -355,6 +359,11 @@
$group_members = $group->get_members();
$group_apps = $this->bo->load_group_apps($account_id);
+ if ( !is_array($group_members) )
+ {
+ $group_members = array();
+ }
+
// this information should be provided by the app itself
$apps_with_acl = array
(
@@ -390,55 +399,67 @@
$entry['account_firstname'],
$entry['account_lastname']
),
- 'selected' =>
in_array(intval($entry['account_id']), $group_members) ? ' selected' : ''
+ 'selected' =>
in_array(intval($entry['account_id']), $group_members) ? ' selected' : ''
);
}
- $sorted_apps = $GLOBALS['phpgw_info']['apps'];
- asort($sorted_apps);
- while ($permission = each($sorted_apps))
+ $apps = array_keys($GLOBALS['phpgw_info']['apps']);
+ asort($apps);
+ foreach ( $apps as $app )
{
- if ($permission[1]['enabled'] &&
$permission[1]['status'] != 3)
+ if
($GLOBALS['phpgw_info']['apps'][$app]['enabled'] &&
$GLOBALS['phpgw_info']['apps'][$app]['status'] != 3)
{
$app_list[] = array
(
- 'app_name' =>
$permission[1]['title'],
- 'checkbox_name' =>
'account_apps[' . $permission[0] . ']',
- 'checked' =>
$group_apps[$permission[0]] ? 'checked' : '',
-
- 'acl_url' =>
($apps_with_acl[$permission[0]] && $account_id) ?
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiadmin_acl.list_acl&acl_app='.$permission[0]
. '&granting_group='.$account_id) : '',
- 'acl_img' =>
$GLOBALS['phpgw']->common->image('admin','dot'),
- 'acl_img_name' =>
lang('Permissions'),
- 'grant_url' =>
($apps_with_acl[$permission[0]] && $account_id) ?
$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiadmin_acl.aclprefs&acl_app='.$permission[0]
. '&granting_group='.$account_id) : '',
- 'grant_img_name' =>
lang('Grant Access') );
+ 'acl_url' =>
(isset($apps_with_acl[$app]) && $account_id)
+
? $GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'preferences.uiaclprefs.index',
+
'acl_app' => $app,
+
'owner' =>$account_id)) : '',
+ 'acl_img' =>
$GLOBALS['phpgw']->common->image('admin','dot', '.png', false),
+ 'app_name' => $app,
+ 'app_title' =>
lang($app),
+ 'checkbox_name' =>
"account_apps[{$app}]",
+ 'checked' =>
isset($group_apps[$app]) ? 'checked' : '',
+ 'grant_url' =>
(isset($apps_with_acl[$app]) && $account_id)
+
? $GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'preferences.uiadmin_acl.aclprefs',
+
'acl_app' => $app,
+
'granting_group'=>$account_id)) : '',
+ 'grant_img_name'=> lang('Grant
Access'),
+ 'img_name' => lang('Grant
Access')
+ );
}
}
-
+
+ $GLOBALS['phpgw']->xslttpl->add_file('msgbox',
PHPGW_TEMPLATE_DIR);
$GLOBALS['phpgw']->xslttpl->add_file('groups');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('administration') . ': ' . ((intval($account_id) > 0)?lang('edit
group'):lang('add group'));
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
$account_id > 0 ? lang('edit group') : lang('add group');
$data = array
(
- 'account_id' => $account_id,
- 'msgbox_data' => $error_list,
- 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiaccounts.edit_group','account_id' => $account_id)),
- 'lang_account_name' => lang('group name'),
- 'value_account_name' =>
$GLOBALS['phpgw']->accounts->id2name($account_id),//$group->get_lid(),
- 'lang_include_user' => lang('select users for
inclusion'),
- 'select_size' => ( $account_num < 5 ) ?
$account_num : 5,
- 'lang_permissions' => lang('permissions this
group has'),
- 'lang_application' => lang('application'),
- 'lang_acl' => lang('acl'),
+ 'account_id' => $account_id,
+ 'app_list' => $app_list,
+ 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiaccounts.edit_group',
+
'account_id' => $account_id
+
)),
+ 'group_manager' => $group_members,
+ 'guser_list' => $user_list,
+ 'img_close' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_close', '.png', false),
+ 'img_save' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_save', '.png', false),
+ 'lang_account_name' => lang('group name'),
+ 'lang_acl' => lang('acl'),
+ 'lang_application' => lang('application'),
+ 'lang_cancel' => lang('cancel'),
+ 'lang_close' => lang('close'),
'lang_grant' => lang('grant'),
- 'lang_cancel' => lang('cancel'),
- 'lang_save' => lang('save'),
- 'app_list' => $app_list,
- 'guser_list' => $user_list,
+ 'lang_group_manager'=> lang('group manager'),
+ 'lang_include_user' => lang('members'),
+ 'lang_permissions' =>
lang('applications'),
+ 'lang_save' => lang('save'),
+ 'msgbox_data' => $error_list,
+ 'select_size' => 5,
+ 'value_account_name'=> $group->lid,
);
- /* create the menu on the left, if needed
-
$p->set_var('rows',ExecMethod('admin.uimenuclass.createHTMLCode','group_manager'));
*/
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('group_edit' => $data));
}
- [Phpgroupware-cvs] admin/inc class.boaccounts.inc.php class.uiacco...,
Dave Hall <=