Added file space option

This commit is contained in:
zone 2001-07-01 22:26:56 +00:00
parent 393a9924dd
commit 8336f15469
7 changed files with 152 additions and 10 deletions

View File

@ -97,7 +97,8 @@
'lang_groups' => lang('Groups'),
'lang_expires' => lang('Expires'),
'lang_firstname' => lang('First Name'),
'lang_button' => lang('Save')
'lang_button' => lang('Save'),
'lang_file_space' => lang('File Space'),
);
$t->set_var($var);
$t->parse('form_buttons','form_buttons_',True);
@ -120,6 +121,29 @@
$_m = $phpgw->sbox->getmonthtext('account_expires_month',$userData['account_expires_month']);
$_d = $phpgw->sbox->getdays('account_expires_day',$userData['account_expires_day']);
if (!$userData['file_space'])
{
$userData['file_space'] = $phpgw_info['server']['vfs_default_account_size_number'] . "-" . $phpgw_info['server']['vfs_default_account_size_type'];
}
$file_space_array = explode ("-", $userData['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . $account_file_space_number . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$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 " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$t->set_var ('lang_file_space', "File space");
$t->set_var ('account_file_space', $account_file_space);
$t->set_var ('account_file_space_select', $account_file_space_select);
$var = Array(
'input_expires' => $phpgw->common->dateformatorder($_y,$_m,$_d,True),
'account_lid' => '<input name="account_lid" value="' . $userData['account_lid'] . '">',
@ -128,7 +152,8 @@
'homedirectory' => $homedirectory,
'loginshell' => $loginshell,
'account_passwd' => $account_passwd,
'account_passwd_2' => $account_passwd_2
'account_passwd_2' => $account_passwd_2,
'account_file_space' => $account_file_space,
);
$t->set_var($var);
$t->parse('password_fields','form_passwordinfo',True);
@ -362,6 +387,12 @@
$_userData['expires'] = -1;
}
$check_account_file_space = explode ("-", $_userData['file_space']);
if (preg_match ("/\D/", $check_account_file_space[0]))
{
$error[$totalerrors++] = lang ('File space must be an integer');
}
if ($totalerrors == 0)
{
return FALSE;
@ -420,9 +451,10 @@
'loginshell' => $loginshell,
'account_expires_month' => $account_expires_month,
'account_expires_day' => $account_expires_day,
'account_expires_year' => $account_expires_year
'account_expires_year' => $account_expires_year,
'file_space' => $account_file_space_number . "-" . $account_file_space_type,
);
if (!$errors = userDataInvalid($userData))
{
saveUserData($userData);

View File

@ -38,7 +38,8 @@
'notes' => True,
'projects' => True,
'phonelog' => True,
'infolog' => True
'infolog' => True,
'phpwebhosting' => True,
);
function is_odd($n)
@ -73,6 +74,11 @@
}
}
if (preg_match ("/\D/", $account_file_space_number))
{
$error = lang ('File space must be an integer');
}
if (!$error)
{
// Lock tables
@ -153,11 +159,17 @@
{
$pref->save_repository();
}
// This is down here so we are sure to catch the acl changes
// for LDAP to update the memberuid attribute
$group->save_repository();
}
// Update any other options here, since the above save_repository () depends
// on a group having users
$group->data['file_space'] = $account_file_space_number . "-" . $account_file_space_type;
$group->save_repository ();
if ($old_group_name <> $n_group)
{
$basedir = $phpgw_info['server']['files_dir'] . SEP . 'groups' . SEP;
@ -251,6 +263,31 @@
. '</option>'."\n";
}
$p->set_var('user_list',$user_list);
$group_repository = $accounts->read_repository ();
if (!$group_repository['file_space'])
{
$group_repository['file_space'] = $phpgw_info['server']['vfs_default_account_size_number'] . "-" . $phpgw_info['server']['vfs_default_account_size_type'];
}
$file_space_array = explode ("-", $group_repository['file_space']);
$account_file_space_number = $file_space_array[0];
$account_file_space_type = $file_space_array[1];
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . $account_file_space_number . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$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 " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$p->set_var ('lang_file_space', "File space");
$p->set_var ('account_file_space', $account_file_space);
$p->set_var ('account_file_space_select', $account_file_space_select);
$p->set_var('lang_permissions',lang('Permissions this group has'));
$i = 0;

View File

@ -92,6 +92,11 @@
$account_expires = -1;
}
if (preg_match ("/\D/", $account_file_space_number))
{
$error[$totalerrors++] = lang ('File space must be an integer');
}
if (! $error)
{
$phpgw->db->lock(array(
@ -110,7 +115,8 @@
'account_firstname' => $account_firstname,
'account_lastname' => $account_lastname,
'account_status' => $account_status,
'account_expires' => $account_expires
'account_expires' => $account_expires,
'account_file_space' => $account_file_space_number . "-" . $account_file_space_type,
);
$phpgw->accounts->create($account_info);
@ -306,6 +312,30 @@
$p->set_var('groups_select',$groups_select);
// end groups list
if (!$account_file_space_number)
{
$account_file_space_number = $phpgw_info['server']['vfs_default_account_size_number'];
}
if (!$account_file_space_type)
{
$account_file_space_type = $phpgw_info['server']['vfs_default_account_size_type'];
}
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . $account_file_space_number . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$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 " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$p->set_var ('lang_file_space', "File space");
$p->set_var ('account_file_space', $account_file_space);
$p->set_var ('account_file_space_select', $account_file_space_select);
$i = 0;
$phpgw->applications->read_installed_apps();
$sorted_apps = $phpgw_info['apps'];

View File

@ -63,6 +63,10 @@
$account_expires = -1;
}
if (preg_match ("/\D/", $account_file_space_number))
{
$error = lang ('File space must be an integer');
}
if (!$error)
{
@ -83,7 +87,8 @@
'account_firstname' => $n_group,
'account_lastname' => 'Group',
'account_status' => 'A',
'account_expires' => $account_expires
'account_expires' => $account_expires,
'account_file_space' => $account_file_space_number . "-" . $account_file_space_type,
);
$group->create($account_info);
$group_id = $phpgw->accounts->name2id($n_group);
@ -173,7 +178,7 @@
$p->set_var("form_action",$phpgw->link("/admin/newgroup.php"));
$p->set_var("hidden_vars","");
$p->set_var("lang_group_name",lang("New group name"));
$p->set_var("group_name_value","");
$p->set_var("group_name_value",$n_group);
$accounts = CreateObject('phpgwapi.accounts',$group_id);
$account_list = $accounts->get_list('accounts');
@ -207,6 +212,31 @@
}
$p->set_var("user_list",$user_list);
if (!$account_file_space_number)
{
$account_file_space_number = $phpgw_info['server']['vfs_default_account_size_number'];
}
if (!$account_file_space_type)
{
$account_file_space_type = $phpgw_info['server']['vfs_default_account_size_type'];
}
$account_file_space_type_selected[$account_file_space_type] = "selected";
$account_file_space = '
<input type=text name="account_file_space_number" value="' . $account_file_space_number . '" size="7">';
$account_file_space_select ='<select name="account_file_space_type">';
$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 " . $account_file_space_type_selected[$type] . ">" . strtoupper ($type) . "</option>";
}
$account_file_space_select .= '</select>';
$p->set_var ('lang_file_space', "File space");
$p->set_var ('account_file_space', $account_file_space);
$p->set_var ('account_file_space_select', $account_file_space_select);
$p->set_var("lang_permissions",lang("Permissions this group has"));
$i = 0;

View File

@ -38,7 +38,9 @@
<tr bgcolor="{tr_color2}">
<td>{lang_groups}</td>
<td colspan=3>{groups_select}&nbsp;</td>
<td>{groups_select}&nbsp;</td>
<td>{lang_file_space}</td>
<td>{account_file_space}{account_file_space_select}</td>
</tr>
<tr bgcolor="{tr_color1}">

View File

@ -44,7 +44,11 @@
<tr bgcolor="{tr_color2}">
<td>{lang_groups}</td>
<td colspan="3">{groups_select}&nbsp;</td>
<td>{groups_select}&nbsp;</td>
<td>{lang_file_space}</td>
<td>{account_file_space}{account_file_space_select}</td>
</tr>
</tr>
{permissions_list}

View File

@ -15,6 +15,13 @@
</td>
</tr>
<tr>
<td>{lang_file_space}</td>
<td>
{account_file_space}{account_file_space_select}
</td>
</td>
<tr>
<td>{lang_permissions}</td>
<td><table width="100%" border="0" cols="6">