Edit template for controller - Refine params copy and bring DB opens up to spec with UTF8

This commit is contained in:
2025-10-06 10:57:00 +01:00
parent 29f8de63fd
commit ecb846fc6c
119 changed files with 10059 additions and 36 deletions

View File

@@ -0,0 +1,97 @@
<div>
% my $btn = l("SAVE");
<form action="/smanager/quota2" method="POST">
<h2><%= l "quo_MODIFY_USER_TITLE" %></h2>
% my $userid = $quo_datas->{user};
% my $user = $quo_datas->{userRec};
<!--
for my $user @$userAccounts
{
unless ( $user->key eq $userid) {
warn(l("USER_DIFFERENT"),$user->key);
next;
}
}
-->
% my $uid = getpwnam($user->key);
% unless ($uid) {
% warn(l("COULD_NOT_GET_UID"),$user->key);
% next;
% }
% my $name = $user->prop("FirstName") . " " . $user->prop("LastName");
% my $dev = Quota::getqcarg("/home/e-smith/files");
% my ($bc, $bs, $bh, $bt, $ic, $is, $ih, $it) = Quota::query($dev, $uid);
<div>
<%= l "quo_USER" %>&nbsp<%= "$name (\"$userid\")" %>
&nbsp
<%= l "quo_CURRENTLY_HAS" %>&nbsp<%= $ic %>
<%= l "files" %>
&nbsp
<%= l "quo_OCCUPYING" %>&nbsp<%= $c->toMB($bc) %>&nbsp<%= l "megabytes" %>
</div>
<br>
<div>
<%= l "quo_INSTRUCTIONS" %>
</div>
<br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<%= l "quo_USER" %>
</div>
<div class="col-auto">
<%= $name %>
</div>
</div>
<br>
% param "Soft" => $quo_datas->{softlim} unless param "Soft";
<div class="row g-3 align-items-center">
<div class="col-md-2">
<label for="inputQuotaDesc" class="col-form-label"><%=l "quo_LIMIT_WITH_GRACE" %></label>
</div>
<div class="col-auto">
<!-- text_field "Soft" -->
<input type="text" name="Soft" id="inputQuotaDesc" class="form-control" aria-describedby="QuotaDesc" value="<%= $quo_datas->{softlim} %>">
</div>
</div>
<br>
% param "Hard" => $quo_datas->{hardlim} unless param "Hard";
<div class="row g-3 align-items-center">
<div class="col-md-2">
<label for="inputQuotaABS" class="col-form-label"><%= l "quo_ABS_LIMIT" %></label>
</div>
<div class="col-auto">
<!-- text_field "Hard" -->
<input type="text" name="Hard" id="inputQuotaABS" class="form-control" aria-describedby="QuotaABS" value="<%= $quo_datas->{hardlim} %>">
</div>
</div>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary btn-sm"><%= $btn %></button>
</div>
</div>
<%= hidden_field "trt" => $quo_datas->{trt} %>
<%= hidden_field "user" => $quo_datas->{user} %>
</form>
</div>

View File

@@ -0,0 +1,84 @@
<div id="quo_upd">
% my $btn = l("SAVE");
%= form_for "/quota2" => (method => "POST") => begin
<p>
<h2>
%=l "quo_MODIFY_USER_TITLE"
</h2>
</p>
% my $userid = $quo_datas->{user};
% my $user = $quo_datas->{userRec};
<!--
for my $user @$userAccounts
{
unless ( $user->key eq $userid) {
warn(l("USER_DIFFERENT"),$user->key);
next;
}
}
-->
% my $uid = getpwnam($user->key);
% unless ($uid) {
% warn(l("COULD_NOT_GET_UID"),$user->key);
% next;
% }
% my $name = $user->prop("FirstName") . " " . $user->prop("LastName");
% my $dev = Quota::getqcarg("/home/e-smith/files");
% my ($bc, $bs, $bh, $bt, $ic, $is, $ih, $it) = Quota::query($dev, $uid);
<p>
%=l "quo_USER"
%= "$name (\"$userid\")"
%=l "quo_CURRENTLY_HAS"
%= $ic
%=l "files"
%=l "quo_OCCUPYING"
%= $c->toMB($bc)
%=l "megabytes"
</p>
<p>
%=l "quo_INSTRUCTIONS"
</p>
<p>
<span class=label>
%=l "quo_USER", class => "label"
</span><span class=data>
%= $name, class => "input"
</span>
</p>
<p>
<span class=label>
%=l "quo_LIMIT_WITH_GRACE", class => "label"
</span><span class=data>
% param "Soft" => $quo_datas->{softlim} unless param "Soft";
%= text_field "Soft", class => "input"
</span>
</p>
<p>
<span class=label>
%=l "quo_ABS_LIMIT", class => "label"
</span><span class=data>
% param "Hard" => $quo_datas->{hardlim} unless param "Hard";
%= text_field "Hard", class => "input"
</span>
</p>
<p>
<br><br>
%= submit_button "$btn", class => "action"
</p>
%= hidden_field "trt" => $quo_datas->{trt}
%= hidden_field "user" => $quo_datas->{user}
% end
</div>

View File

@@ -0,0 +1,2 @@
'quo_UNABLE_TO_OPEN_ACCOUNTS' => 'Unable to open accounts db',
'Quotas' => 'Quotas',

View File

@@ -0,0 +1,39 @@
#
# Lex file for Quota generated on 2025-07-17 09:52:33
#
'quo_ABS_LIMIT' => 'Absolute limit',
'quo_ABS_LIMIT_MB' => 'Absolute limit (MB)',
'quo_ACCOUNT_IS_TYPE' => 'It is an account of type: ',
'quo_COULD_NOT_GET_UID' => 'Could not determine the uid for user: ',
'quo_CURRENT_USAGE' => 'Current usage (MB)',
'quo_CURRENT_USAGE_AND_SETTINGS' => 'Current Quota Usage and Settings',
'quo_CURRENTLY_HAS' => 'currently has: ',
'quo_ERR_HARD_LT_SOFT' => ' Error: absolute limit must be greater than limit with grace time. ',
'quo_ERR_MODIFYING' => 'Error occurred while modifying user.',
'quo_ERR_NO_SUCH_ACCT' => 'Error: there is no account named: ',
'quo_ERR_NOT_A_USER_ACCT' => 'Error: the account is not a user account: ',
'quo_FORM_TITLE' => 'Create, modify, or remove user account quotas',
'quo_HARD_VAL_MUST_BE_NUMBER' => 'Error: absolute limit must be a number, optionally followed by one of the unit suffixes K, M, G, or T.',
'quo_INSTRUCTIONS' => 'Enter the quota with optional unit suffix of "K" for kilobytes, "M" for megabytes,
"G" for gigabytes or "T" for terabytes.
Entries with no suffix are assumed to be in megabytes. A setting of "0"
for either limit disables that limit for the corresponding user.',
'quo_LIMIT_WITH_GRACE' => 'Limit with grace period',
'quo_LIMIT_WITH_GRACE_MB' => 'Limit with grace period (MB)',
'quo_MODIFY_USER_TITLE' => 'Modify user quota limits',
'quo_OCCUPYING' => 'occupying: ',
'quo_QUOTA_DESC' => '<p>You can set filesystem quotas for users on your system by clicking
the "Modify" button next to the user you wish to update.
<p>If the user exceeds the "Limit with grace period", warnings will be
generated. If this limit is exceeded for longer than a week or if the
"Absolute limit" is reached, the user will be unable to store any more
files or receive any more e-mail.
<p>A setting of "0" for either limit disables that limit for the
corresponding user.
<p>The disk space for each user includes the user"s home directory,
e-mail, and any files owned by the user in information bays.',
'quo_SOFT_VAL_MUST_BE_NUMBER' => 'Error: limit with grace period must be a number, optionally followed by one of the unit suffixes K, M, G, or T.',
'quo_SUCCESSFULLY_MODIFIED' => 'Successfully modified quota for user account: ',
'quo_UNABLE_TO_OPEN_ACCOUNTS' => 'Unable to open accounts db',
'quo_USER' => 'User: ',
'Quotas' => 'Quotas',