More group updates and quots done

This commit is contained in:
John Crisp 2025-05-16 11:57:27 +02:00
parent f90583b285
commit 613f17bb4f
8 changed files with 236 additions and 231 deletions

View File

@ -11,6 +11,8 @@
</div>
% }
<!-- reetp error here -->
% if ( stash 'error' ) {
<div class="text-danger">
<%= $c->render_to_string(inline => stash 'error') %>

View File

@ -3,19 +3,13 @@
% my $btn = l('GROUP_ADD');
<form action="/smanager/groups2" method="POST">
%#= form_for '/groups' => (method => 'POST') => begin
%= hidden_field 'trt' => 'ADD'
<%= hidden_field 'trt' => 'ADD' %>
<br>
<div>
<button type="submit" class="btn btn-primary"><%= $btn %> </button>
</div>
</form>
%# end
<br>
<h2><%=l 'grp_CURRENT_LIST' %></h2>
<br><br>

View File

@ -21,7 +21,7 @@
<br><br>
<%=l 'grp_GROUP_DESC_EXPL'%>
<%= l 'grp_GROUP_DESC_EXPL'%>
<br><br>
@ -44,7 +44,7 @@
<br><br>
<div>
<%=l 'GROUP_MEMBERS' %>
<%= l 'GROUP_MEMBERS' %>
</div>
<br>
@ -68,8 +68,8 @@
%= check_box 'groupMembers' => $key
&nbsp
% }
%= $users->{$key}
%= " (" . $key . ")"
<%= $users->{$key} %>
<%= " (" . $key . ")" %>
<br>
% }
@ -82,8 +82,8 @@
</div>
%= hidden_field 'trt' => $grp_datas->{trt}
%= hidden_field 'groupName' => $grp_datas->{group}
<%= hidden_field 'trt' => $grp_datas->{trt} %>
<%= hidden_field 'groupName' => $grp_datas->{group} %>
</form>

View File

@ -5,17 +5,11 @@
<form action="/smanager/pseudonyms2" method="POST">
<h2><%= l 'pse_REMOVE_PSEUDONYM' %></h2>
<%#= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); %>
Thisis the old test that needs fixing in the language files
<%= l('pse_ABOUT_TO_REMOVE') %>
<!--This is the old test that needs fixing in the language files-->
<br>
You are about to remove the pseudonym: <%= $pse_datas->{pseudonym} %>
<h6>Are you sure you wish to continue?</h6>
<%= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); %>
<br><br>
<div class="row g-3 align-items-center">

View File

@ -2,55 +2,70 @@
% my $btn = l('SAVE');
%= form_for '/pseudonyms2' => (method => 'POST') => begin
<p>
<h2>
%=l 'pse_MODIFY_PSEUDONYM'
</h2>
<form action="/smanager/pseudonyms2" method="POST">
<h2><%=l 'pse_MODIFY_PSEUDONYM' %></h2>
<br>
%=l 'pse_DESC_PSEUDONYM_NAME'
</p>
<p>
<span class="">
%=l 'pse_PSEUDONYM_NAME', class => ""
</span>
<span class="">
%= $pse_datas->{pseudonym}, class => ""
</span>
</p>
<div>
<%=l 'pse_DESC_PSEUDONYM_NAME' %>
</div>
<p>
<span class="">
%=l 'pse_SELECT_ACCOUNT', class => ""
</span>
<span class="">
<br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<%=l 'pse_PSEUDONYM_NAME' %>
</div>
<div class="col-auto">
<%= $pse_datas->{pseudonym} %>
</div>
</div>
<br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<%=l 'pse_SELECT_ACCOUNT' %>
</div>
<div class="col-auto">
% param 'Account' => $pse_datas->{account} unless param 'Account';
%= select_field 'Account' => $c->existing_accounts_list(), class => ""
</span>
</p>
<%= select_field 'Account' => $c->existing_accounts_list(); %>
</div>
%if ( $c->is_pseudonym_not_removable( $pse_datas->{pseudonym} ) ) {
</div>
<p>
<span class="">
%=l 'pse_SELECT_INTERNAL', class => ""
</span>
<span class="">
% if ( $c->is_pseudonym_not_removable( $pse_datas->{pseudonym} ) ) {
<br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<%= l 'pse_SELECT_INTERNAL' %>
</div>
<div class="col-auto">
% param 'Internal' => $pse_datas->{internal} unless param 'Internal';
%= select_field 'Internal' => [ [(l 'YES') => 'YES'], [(l 'NO') => 'NO'] ], class => ""
</span>
</p>
<%= select_field 'Internal' => [ [(l 'YES') => 'YES'], [(l 'NO') => 'NO'] ] %>
</div>
</div>
%}
% }
<p>
%= submit_button "$btn", class => ""
</p>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
%= hidden_field 'trt' => $pse_datas->{trt}
%= hidden_field 'Pseudonym' => $pse_datas->{pseudonym}
%end
</form>
</div>

View File

@ -1,17 +1,16 @@
<div>
<p>
% my $modul = $c->render_to_string(inline => $c->l('quo_QUOTA_DESC'));
%= $modul
<h3>
%=l 'quo_CURRENT_USAGE_AND_SETTINGS'
</h3>
<%= $modul %>
<h2><%= l 'quo_CURRENT_USAGE_AND_SETTINGS' %></h2>
<br>
% my $numUsers = @$userAccounts;
% if ($numUsers == 0){
%=l 'ACCOUNT_USER_NONE'
<%= l 'ACCOUNT_USER_NONE' %>
% } else {
% my $limit = l('quo_LIMIT_WITH_GRACE_MB'); $limit =~ s#(graceX)#<br>$1#;
@ -21,30 +20,18 @@
<table class="table table-bordered">
<thead>
<tr>
<th class="">
%=l 'ACCOUNT'
</th>
<th class="">
%=l 'USER_NAME'
</th>
<th class="">
%= $limit
</th>
<th class="">
%= $absolute
</th>
<th class="">
%= $current
</th>
<th class="">
%=l 'ACTION'
</th>
<th class="col-sm"><%= l 'ACCOUNT' %></th>
<th class="col-sm"><%= l 'USER_NAME' %></th>
<th class="col-sm"><%= $limit %></th>
<th class="col-sm"><%= $absolute %></th>
<th class="col-sm"><%= $current %></th>
<th class="col-sm user-valign-center"><%= l 'ACTION' %></th>
</tr>
</thead>
<tbody>
% foreach my $user (@$userAccounts)
% {
% foreach my $user (@$userAccounts) {
% my $uid = getpwnam($user->key);
% unless ($uid) {
% warn($self->localise('COULD_NOT_GET_UID'),$user->key);
@ -53,32 +40,33 @@
% 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);
<tr>
%= t td => (class => "") => $user->key
%= t td => (class => "") => $name
%= t td => (class => "") => sprintf("%.2f", $bs / 1024 )
%= t td => (class => "") => sprintf("%.2f", $bh / 1024 )
%= t td => (class => "") => sprintf("%.2f", $bc / 1024 )
<td class="">
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $quota_user_name = $user->key; # quotas_entry name extracted from the data structure
%my $actionModify = qq{
<td><%= $user->key %></td>
<td><%= $name %></td>
<td><%= sprintf("%.2f", $bs / 1024 ) %></td>
<td><%= sprintf("%.2f", $bh / 1024 ) %></td>
<td><%= sprintf("%.2f", $bc / 1024 ) %></td>
% my $modify_text = l('MODIFY'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $quota_user_name = $user->key; # quotas_entry name extracted from the data structure
% my $actionModify = qq{
% <a href="quotad?CsrfDef=$csrf_token&trt=UPD&user=$quota_user_name">
% <button type='button' class="" title='$modify_text' >
% <button type='button' class="btn btn-primary" title='$modify_text' >
% $modify_text
% </button>
% </a>
%};
<%= $c->render_to_string(inline => $actionModify) %>
</td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
</tr>
% }
</tbody>
</table>
<%} %>
</p>
%= hidden_field 'trt' => $quo_datas->{trt}
% }
<%= hidden_field 'trt' => $quo_datas->{trt} %>
</div>

View File

@ -2,12 +2,9 @@
% my $btn = l('SAVE');
%= form_for '/quota2' => (method => 'POST') => begin
<p>
<h2>
%=l 'quo_MODIFY_USER_TITLE'
</h2>
</p>
<form action="/smanager/quota2" method="POST">
<h2><%= l 'quo_MODIFY_USER_TITLE' %></h2>
% my $userid = $quo_datas->{user};
% my $user = $quo_datas->{userRec};
@ -30,58 +27,71 @@
% 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 'quo_FILES'
%=l 'quo_OCCUPYING'
%= $c->toMB($bc)
%=l 'quo_MEGABYTES'
</p>
<div>
<%= l 'quo_USER' %>&nbsp<%= "$name (\"$userid\")" %>
&nbsp
<%= l 'quo_CURRENTLY_HAS' %>&nbsp<%= $ic %>
<%= l 'quo_FILES' %>
&nbsp
<%= l 'quo_OCCUPYING' %>&nbsp<%= $c->toMB($bc) %>&nbsp<%= l 'quo_MEGABYTES' %>
</div>
<br>
<p>
%=l 'quo_INSTRUCTIONS'
</p>
<div>
<%= l 'quo_INSTRUCTIONS' %>
</div>
<br>
<p>
<span class="">
%=l 'quo_USER', class => ""
</span>
<span class="">
%= $name, class => ""
</span>
</p>
<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>
<p>
<span class="">
%=l 'quo_LIMIT_WITH_GRACE', class => ""
</span>
<span class="">
% param 'Soft' => $quo_datas->{softlim} unless param 'Soft';
%= text_field 'Soft', class => ""
</span>
</p>
<p>
<span class="">
%=l 'quo_ABS_LIMIT', class => ""
</span>
<span class="">
<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';
%= text_field 'Hard', class => ""
</span>
</p>
<p>
<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>
%= submit_button "$btn", class => ""
</p>
%= hidden_field 'trt' => $quo_datas->{trt}
%= hidden_field 'user' => $quo_datas->{user}
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
% end
<%= hidden_field 'trt' => $quo_datas->{trt} %>
<%= hidden_field 'user' => $quo_datas->{user} %>
</form>
</div>

View File

@ -5,26 +5,28 @@
<div class="card-body">
% if (config->{debug} == 1) {
<p>
<div>
%= dumper $c->current_route
%= dumper $quo_datas
</p>
</div>
% }
% if ( stash 'error' ) {
<br><div class="">
%= $c->render_to_string(inline => stash 'error')
<br>
<div class="text-danger">
<%= $c->render_to_string(inline => stash 'error') %>
</div>
%}
% }
<h1><%= $title%></h1>
% if ($quo_datas->{trt} eq 'UPD') {
%= include 'partials/_quo_upd'
%} else {
%= include 'partials/_quo_list'
%}
<%= include 'partials/_quo_upd' %>
% } else {
<%= include 'partials/_quo_list' %>
% }
</div>
%end