From 8336f154692810ae449081c0acb1d8cdb6936c03 Mon Sep 17 00:00:00 2001 From: zone Date: Sun, 1 Jul 2001 22:26:56 +0000 Subject: [PATCH] Added file space option --- admin/editaccount.php | 40 +++++++++++++++++-- admin/editgroup.php | 39 +++++++++++++++++- admin/newaccount.php | 32 ++++++++++++++- admin/newgroup.php | 34 +++++++++++++++- admin/templates/default/account_form.tpl | 4 +- admin/templates/default/account_form_ldap.tpl | 6 ++- admin/templates/default/group_form.tpl | 7 ++++ 7 files changed, 152 insertions(+), 10 deletions(-) diff --git a/admin/editaccount.php b/admin/editaccount.php index d2f82cec84..5d1d96e46b 100755 --- a/admin/editaccount.php +++ b/admin/editaccount.php @@ -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 = ' + '; + $account_file_space_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' => '', @@ -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); diff --git a/admin/editgroup.php b/admin/editgroup.php index a817fc4be0..99b0ffcba5 100755 --- a/admin/editgroup.php +++ b/admin/editgroup.php @@ -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 @@ . ''."\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 = ' + '; + $account_file_space_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; diff --git a/admin/newaccount.php b/admin/newaccount.php index 08504b568b..1054be0cdd 100755 --- a/admin/newaccount.php +++ b/admin/newaccount.php @@ -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 = ' + '; + $account_file_space_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']; diff --git a/admin/newgroup.php b/admin/newgroup.php index 31b5fd0965..f6c49cd54b 100755 --- a/admin/newgroup.php +++ b/admin/newgroup.php @@ -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 = ' + '; + $account_file_space_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; diff --git a/admin/templates/default/account_form.tpl b/admin/templates/default/account_form.tpl index 727b32d69b..a91d15e2ee 100644 --- a/admin/templates/default/account_form.tpl +++ b/admin/templates/default/account_form.tpl @@ -38,7 +38,9 @@ {lang_groups} - {groups_select}  + {groups_select}  + {lang_file_space} + {account_file_space}{account_file_space_select} diff --git a/admin/templates/default/account_form_ldap.tpl b/admin/templates/default/account_form_ldap.tpl index 04cf54018e..6a820798ef 100644 --- a/admin/templates/default/account_form_ldap.tpl +++ b/admin/templates/default/account_form_ldap.tpl @@ -44,7 +44,11 @@ {lang_groups} - {groups_select}  + {groups_select}  + {lang_file_space} + {account_file_space}{account_file_space_select} + + {permissions_list} diff --git a/admin/templates/default/group_form.tpl b/admin/templates/default/group_form.tpl index 5e019a0478..1c15e6f84f 100644 --- a/admin/templates/default/group_form.tpl +++ b/admin/templates/default/group_form.tpl @@ -15,6 +15,13 @@ + + {lang_file_space} + + {account_file_space}{account_file_space_select} + + + {lang_permissions}