[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc/class.uiaccounts.inc.php, 1.48
From: |
nomail |
Subject: |
[Phpgroupware-cvs] admin/inc/class.uiaccounts.inc.php, 1.48 |
Date: |
Thu, 29 Jul 2004 13:41:51 +0200 |
Update of /admin/inc
Modified Files:
Branch:
class.uiaccounts.inc.php
date: 2004/07/29 11:41:51; author: fipsfuchs; state: Exp; lines: +47 -101
Log Message:
refactoring and bug fixes for view/edit/add group
=====================================================================
Index: admin/inc/class.uiaccounts.inc.php
diff -u admin/inc/class.uiaccounts.inc.php:1.47
admin/inc/class.uiaccounts.inc.php:1.48
--- admin/inc/class.uiaccounts.inc.php:1.47 Tue Jul 27 13:09:38 2004
+++ admin/inc/class.uiaccounts.inc.php Thu Jul 29 11:41:51 2004
@@ -32,7 +32,7 @@
{
$GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->bo =
createobject('admin.boaccounts');
+ $this->bo =
createobject('admin.boaccounts');
$this->nextmatchs =
createobject('phpgwapi.nextmatchs');
@set_time_limit(300);
@@ -306,10 +306,10 @@
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_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'));
if ($values['save'])
{
@@ -338,32 +338,25 @@
}
else
{
- $this->bo->add_group($values);
+ $this->bo->edit_group($values);
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction=admin.uiaccounts.list_groups');
}
}
}
-
+
if ($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');
}
- $cdid = $cd;
- settype($cd,'integer');
- $cd = ($_GET['cd']?$_GET['cd']:intval($cdid));
-
- if ($account_id)
- {
- $group_info = Array
- (
- 'account_name' =>
$GLOBALS['phpgw']->accounts->id2name($account_id),
- 'account_user' =>
$this->bo->load_group_users($account_id),
- 'account_apps' =>
$this->bo->load_group_apps($account_id)
- );
- }
+ $group = CreateObject('phpgwapi.accounts', $account_id,
'g');
+ $group->read_repository();
+ $group->member($account_id);
+ $group_members = $group->get_members();
+ $group_apps = $this->bo->load_group_apps($account_id);
- $apps_with_acl = Array
+ // this information should be provided by the app itself
+ $apps_with_acl = array
(
'addressbook' => True,
'bookmarks' => True,
@@ -381,109 +374,62 @@
'tts' => True
);
- $GLOBALS['phpgw']->xslttpl->add_file('groups');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('administration') . ': ' . ((intval($account_id) > 0)?lang('edit
group'):lang('add group'));
- $accounts =
CreateObject('phpgwapi.accounts',$account_id,'u');
+ $accounts = CreateObject('phpgwapi.accounts');
$account_list = $accounts->get_list('accounts');
$account_num = count($account_list);
-
while (list($key,$entry) = each($account_list))
{
$user_list[] = array
(
- 'account_id' =>
$entry['account_id'],
- 'account_name' =>
$GLOBALS['phpgw']->common->display_fullname($entry['account_lid'],$entry['account_firstname'],
-
$entry['account_lastname']),
- 'selected' =>
$group_info['account_user'][intval($entry['account_id'])]
+ 'account_id' => $entry['account_id'],
+ 'account_name' =>
$GLOBALS['phpgw']->common->display_fullname($entry['account_lid'],
+
$entry['account_firstname'],
+
$entry['account_lastname']
+
),
+ 'selected' =>
in_array(intval($entry['account_id']), $group_members) ? ' selected' : ''
);
}
- $group_repository = $accounts->read_repository();
- if (!$group_repository['file_space'])
- {
- $group_repository['file_space'] =
$GLOBALS['phpgw_info']['server']['vfs_default_account_size_number'] . "-" .
$GLOBALS['phpgw_info']['server']['vfs_default_account_size_type'];
- }
- /*
- $file_space_array = explode ('-',
$group_repository['file_space']);
- $account_file_space_types = array ('gb', 'mb', 'kb',
'b');
- while (list ($num, $type) = each
($account_file_space_types))
- {
- $account_file_space_select .= '<option
value="'.$type.'"'.($type==$file_space_array[1]?' selected':'').'>'.strtoupper
($type).'</option>'."\n";
- }
- $p->set_var ('lang_file_space', lang('File space'));
- $p->set_var ('account_file_space', '<input type=text
name="account_file_space_number" value="'.trim($file_space_array[0]).'"
size="7">');
- $p->set_var ('account_file_space_select','<select
name="account_file_space_type">'."\n".$account_file_space_select.'</select>'."\n");
- */
-
- reset($GLOBALS['phpgw_info']['apps']);
$sorted_apps = $GLOBALS['phpgw_info']['apps'];
- @asort($sorted_apps);
- @reset($sorted_apps);
+ asort($sorted_apps);
while ($permission = each($sorted_apps))
{
if ($permission[1]['enabled'] &&
$permission[1]['status'] != 3)
{
- $perm_display[] = array
+ $app_list[] = array
(
- $permission[0],
- $permission[1]['title']
+ '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.uiaclprefs.index&acl_app='.$permission[0].'&owner='.$account_id)
: '',
+ 'acl_img' =>
$GLOBALS['phpgw']->common->image('admin','dot'),
+ 'img_name' => lang('Grant
Access')
);
}
}
- /*$perm_html =
'<td>'.lang('Application').'</td><td> </td><td>'.lang('ACL').'</td>';
- $perm_html = '<tr
class="th">'.$perm_html.$perm_html."</tr>\n";*/
-
- for ($i=0;$i < count($perm_display);$i++)
- {
- $app = $perm_display[$i][0];
- /*$perm_html .= '<td width="40%">' .
$perm_display[$i][1] . '</td>'
- . '<td width="5%"><input
type="checkbox" name="account_apps['
- . $perm_display[$i][0] . ']"
value="True"'.($group_info['account_apps'][$app]?' checked':'').'></td><td
width="5%" align="center">'
- . ($apps_with_acl[$app] &&
$group_info['account_id']?'<a
href="'.$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&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>':' ').'</td>'.($i & 1?'</tr>':'')."\n";*/
-
- $app_list[] = array
- (
- 'app_name' =>
$perm_display[$i][1],
- 'checkbox_name' => 'account_apps[' .
$perm_display[$i][0] . ']',
- 'checked' =>
($group_info['account_apps'][$app]?'checked':''),
- 'acl_url' =>
($apps_with_acl[$app] &&
$account_id?$GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$app.'&owner='.$account_id):''),
- 'acl_img' =>
$GLOBALS['phpgw']->common->image('admin','dot'),
- 'img_name' => lang('Grant
Access')
- );
- }
-
- /*if($i & 1)
- {
- $perm_html .= '<td
colspan="4"> </td></tr>';
- }*/
-
- $link_data = array
- (
- 'menuaction' =>
'admin.uiaccounts.edit_group',
- 'account_id' => $account_id
- );
+ $GLOBALS['phpgw']->xslttpl->add_file('groups');
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('administration') . ': ' . ((intval($account_id) > 0)?lang('edit
group'):lang('add group'));
$data = array
(
- 'msgbox_data' => $error_list,
- 'edit_url' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'account_id' =>
$group_info['account_id'],
- 'lang_account_name' => lang('group
name'),
- 'value_account_name' =>
$group_info['account_name'],
- 'lang_include_user' => lang('select
users for inclusion'),
- 'select_size' =>
($account_num < 5?$account_num:5),
- 'guser_list' => $user_list,
- 'lang_permissions' =>
lang('permissions this group has'),
- 'lang_application' =>
lang('application'),
- 'lang_acl' =>
lang('acl'),
- 'lang_cancel' =>
lang('cancel'),
- 'lang_save' =>
lang('save'),
- 'app_list' =>
$app_list,
- 'account_id' => $account_id
+ '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' => $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'),
+ 'lang_cancel' => lang('cancel'),
+ 'lang_save' => lang('save'),
+ 'app_list' => $app_list,
+ 'guser_list' => $user_list,
);
/* create the menu on the left, if needed
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin/inc/class.uiaccounts.inc.php, 1.48,
nomail <=