From 613f17bb4fa584e1783ca4e91748bae4e33d1be4 Mon Sep 17 00:00:00 2001 From: John Crisp Date: Fri, 16 May 2025 11:57:27 +0200 Subject: [PATCH] More group updates and quots done --- .../themes/AdminLTE/templates/groups.html.ep | 2 + .../templates/partials/_grp_list.html.ep | 8 +- .../templates/partials/_grp_upd.html.ep | 52 +++---- .../templates/partials/_pse_del.html.ep | 10 +- .../templates/partials/_pse_upd.html.ep | 101 +++++++------ .../templates/partials/_quo_list.html.ep | 134 ++++++++---------- .../templates/partials/_quo_upd.html.ep | 134 ++++++++++-------- .../themes/AdminLTE/templates/quota.html.ep | 26 ++-- 8 files changed, 236 insertions(+), 231 deletions(-) diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/groups.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/groups.html.ep index 0598474..eaf61f7 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/groups.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/groups.html.ep @@ -11,6 +11,8 @@ % } + + % if ( stash 'error' ) {
<%= $c->render_to_string(inline => stash 'error') %> diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_list.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_list.html.ep index 230ba4d..cd72aaa 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_list.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_list.html.ep @@ -3,19 +3,13 @@ % my $btn = l('GROUP_ADD');
- %#= form_for '/groups' => (method => 'POST') => begin - - %= hidden_field 'trt' => 'ADD' - + <%= hidden_field 'trt' => 'ADD' %>
-
- %# end -

<%=l 'grp_CURRENT_LIST' %>



diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_upd.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_upd.html.ep index aa29e11..d7f39e4 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_upd.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_grp_upd.html.ep @@ -3,13 +3,13 @@ % my $btn = l('SAVE');
- +

- +

<%= l 'MODIFY_USER_GROUP' %>

- +

- +
@@ -18,15 +18,15 @@
- +

- - <%=l 'grp_GROUP_DESC_EXPL'%> - + + <%= l 'grp_GROUP_DESC_EXPL'%> +

- + % param 'groupDesc' => $grp_datas->{description} unless param 'groupDesc'; - +
@@ -40,15 +40,15 @@
- +

- +
- <%=l 'GROUP_MEMBERS' %> + <%= l 'GROUP_MEMBERS' %>
- +
- +
% if ( $members->{'admin'} ) { %= check_box 'groupMembers', value => 'admin', checked => undef @@ -57,9 +57,9 @@ % }  Administrator (admin)
- +
- + % my $users = $c->gen_users_list(); % foreach my $key ( sort keys %$users ) { % if ( $members->{ $key } ) { @@ -68,23 +68,23 @@ %= check_box 'groupMembers' => $key   % } - %= $users->{$key} - %= " (" . $key . ")" + <%= $users->{$key} %> + <%= " (" . $key . ")" %>
% } - +

- +
- - - %= hidden_field 'trt' => $grp_datas->{trt} - %= hidden_field 'groupName' => $grp_datas->{group} - + + + <%= hidden_field 'trt' => $grp_datas->{trt} %> + <%= hidden_field 'groupName' => $grp_datas->{group} %> +
diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_del.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_del.html.ep index f3e9304..974b3bc 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_del.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_del.html.ep @@ -5,17 +5,11 @@

<%= l 'pse_REMOVE_PSEUDONYM' %>

- <%#= $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') %> +
- You are about to remove the pseudonym: <%= $pse_datas->{pseudonym} %> - -
Are you sure you wish to continue?
- + <%= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); %>

diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_upd.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_upd.html.ep index 1fce7c8..07b5a77 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_upd.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_pse_upd.html.ep @@ -2,55 +2,70 @@ % my $btn = l('SAVE'); - %= form_for '/pseudonyms2' => (method => 'POST') => begin -

-

- %=l 'pse_MODIFY_PSEUDONYM' -

-
- %=l 'pse_DESC_PSEUDONYM_NAME' -

+ -

- - %=l 'pse_PSEUDONYM_NAME', class => "" - - - %= $pse_datas->{pseudonym}, class => "" - -

+

<%=l 'pse_MODIFY_PSEUDONYM' %>

+
-

- - %=l 'pse_SELECT_ACCOUNT', class => "" - - - % param 'Account' => $pse_datas->{account} unless param 'Account'; - %= select_field 'Account' => $c->existing_accounts_list(), class => "" - -

+
+ <%=l 'pse_DESC_PSEUDONYM_NAME' %> +
- %if ( $c->is_pseudonym_not_removable( $pse_datas->{pseudonym} ) ) { +
-

- - %=l 'pse_SELECT_INTERNAL', class => "" - - - % param 'Internal' => $pse_datas->{internal} unless param 'Internal'; - %= select_field 'Internal' => [ [(l 'YES') => 'YES'], [(l 'NO') => 'NO'] ], class => "" - -

+
+
+ <%=l 'pse_PSEUDONYM_NAME' %> +
- %} - -

- %= submit_button "$btn", class => "" -

+
+ <%= $pse_datas->{pseudonym} %> +
+
- %= hidden_field 'trt' => $pse_datas->{trt} +
+ +
+ +
+ <%=l 'pse_SELECT_ACCOUNT' %> +
+ +
+ % param 'Account' => $pse_datas->{account} unless param 'Account'; + <%= select_field 'Account' => $c->existing_accounts_list(); %> +
+ +
+ + + % if ( $c->is_pseudonym_not_removable( $pse_datas->{pseudonym} ) ) { + +
+
+
+ <%= l 'pse_SELECT_INTERNAL' %> +
+ +
+ % param 'Internal' => $pse_datas->{internal} unless param 'Internal'; + <%= select_field 'Internal' => [ [(l 'YES') => 'YES'], [(l 'NO') => 'NO'] ] %> +
+
+ + % } + +

+ +
+
+ +
+
+ + %= hidden_field 'trt' => $pse_datas->{trt} %= hidden_field 'Pseudonym' => $pse_datas->{pseudonym} - - %end + +
diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_list.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_list.html.ep index c1cfcf6..6eb7fe6 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_list.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_list.html.ep @@ -1,84 +1,72 @@
-

- % my $modul = $c->render_to_string(inline => $c->l('quo_QUOTA_DESC')); - %= $modul - -

- %=l 'quo_CURRENT_USAGE_AND_SETTINGS' -

+ % my $modul = $c->render_to_string(inline => $c->l('quo_QUOTA_DESC')); + + <%= $modul %> + +

<%= l 'quo_CURRENT_USAGE_AND_SETTINGS' %>


- % my $numUsers = @$userAccounts; - % if ($numUsers == 0){ - %=l 'ACCOUNT_USER_NONE' - % } else { - % my $limit = l('quo_LIMIT_WITH_GRACE_MB'); $limit =~ s#(graceX)#
$1#; - % my $absolute = l('quo_ABS_LIMIT_MB'); $absolute =~ s#(limitX)#
$1#; - % my $current = l('quo_CURRENT_USAGE'); $current =~ s#(usageX)#
$1#; + % my $numUsers = @$userAccounts; + % if ($numUsers == 0){ + <%= l 'ACCOUNT_USER_NONE' %> + % } else { - - - - - - - - - - - - + % my $limit = l('quo_LIMIT_WITH_GRACE_MB'); $limit =~ s#(graceX)#
$1#; + % my $absolute = l('quo_ABS_LIMIT_MB'); $absolute =~ s#(limitX)#
$1#; + % my $current = l('quo_CURRENT_USAGE'); $current =~ s#(usageX)#
$1#; - % foreach my $user (@$userAccounts) - % { - % my $uid = getpwnam($user->key); - % unless ($uid) { - % warn($self->localise('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); - - %= 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 ) - - - % } - +
- %=l 'ACCOUNT' - - %=l 'USER_NAME' - - %= $limit - - %= $absolute - - %= $current - - %=l 'ACTION' -
- %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{ - % - % - % - %}; - <%= $c->render_to_string(inline => $actionModify) %> -
+ + + + + + + + + + + + + + % foreach my $user (@$userAccounts) { + % my $uid = getpwnam($user->key); + % unless ($uid) { + % warn($self->localise('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); + + + + + + + + + % 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{ + % + % + % + %}; + + + + % } +
<%= l 'ACCOUNT' %><%= l 'USER_NAME' %><%= $limit %><%= $absolute %><%= $current %><%= l 'ACTION' %>
<%= $user->key %><%= $name %><%= sprintf("%.2f", $bs / 1024 ) %><%= sprintf("%.2f", $bh / 1024 ) %><%= sprintf("%.2f", $bc / 1024 ) %><%= $c->render_to_string(inline => $actionModify) %>
- <%} %> -

- %= hidden_field 'trt' => $quo_datas->{trt} + % } + + <%= hidden_field 'trt' => $quo_datas->{trt} %>
diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_upd.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_upd.html.ep index 40e0293..b58ed92 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_upd.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/partials/_quo_upd.html.ep @@ -1,16 +1,13 @@
- % my $btn = l('SAVE'); + % my $btn = l('SAVE'); - %= form_for '/quota2' => (method => 'POST') => begin -

-

- %=l 'quo_MODIFY_USER_TITLE' -

-

+
- % my $userid = $quo_datas->{user}; - % my $user = $quo_datas->{userRec}; +

<%= l 'quo_MODIFY_USER_TITLE' %>

+ + % my $userid = $quo_datas->{user}; + % my $user = $quo_datas->{userRec}; - % my $uid = getpwnam($user->key); - % unless ($uid) { - % warn(l('COULD_NOT_GET_UID'),$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); + % 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); -

- %=l 'quo_USER' - %= "$name (\"$userid\")" - %=l 'quo_CURRENTLY_HAS' - %= $ic - %=l 'quo_FILES' - %=l 'quo_OCCUPYING' - %= $c->toMB($bc) - %=l 'quo_MEGABYTES' -

- -

- %=l 'quo_INSTRUCTIONS' -

+
+ <%= l 'quo_USER' %> <%= "$name (\"$userid\")" %> +   + <%= l 'quo_CURRENTLY_HAS' %> <%= $ic %> + <%= l 'quo_FILES' %> +   + <%= l 'quo_OCCUPYING' %> <%= $c->toMB($bc) %> <%= l 'quo_MEGABYTES' %> +
+
-

- - %=l 'quo_USER', class => "" - - - %= $name, class => "" - -

+
+ <%= l 'quo_INSTRUCTIONS' %> +
+
+ +
+
+ <%= l 'quo_USER' %> +
+
+ <%= $name %> +
+
+ +
-

- - %=l 'quo_LIMIT_WITH_GRACE', class => "" - - % param 'Soft' => $quo_datas->{softlim} unless param 'Soft'; - %= text_field 'Soft', class => "" - -

-

- - %=l 'quo_ABS_LIMIT', class => "" - - +

+
+ +
+
+ + +
+
+ +
+ % param 'Hard' => $quo_datas->{hardlim} unless param 'Hard'; - %= text_field 'Hard', class => "" - -

-

+

+
+ +
+
+ + + + +
+
+

- %= submit_button "$btn", class => "" -

- %= hidden_field 'trt' => $quo_datas->{trt} - %= hidden_field 'user' => $quo_datas->{user} - - % end +
+
+ +
+
+ + <%= hidden_field 'trt' => $quo_datas->{trt} %> + <%= hidden_field 'user' => $quo_datas->{user} %> + +
\ No newline at end of file diff --git a/root/usr/share/smanager/themes/AdminLTE/templates/quota.html.ep b/root/usr/share/smanager/themes/AdminLTE/templates/quota.html.ep index d875e6b..797ab54 100644 --- a/root/usr/share/smanager/themes/AdminLTE/templates/quota.html.ep +++ b/root/usr/share/smanager/themes/AdminLTE/templates/quota.html.ep @@ -5,26 +5,28 @@
% if (config->{debug} == 1) { -

- %= dumper $c->current_route - %= dumper $quo_datas -

+
+ %= dumper $c->current_route + %= dumper $quo_datas +
% } % if ( stash 'error' ) { -
- %= $c->render_to_string(inline => stash 'error') -
- %} +
+
+ <%= $c->render_to_string(inline => stash 'error') %> +
+ % }

<%= $title%>

% if ($quo_datas->{trt} eq 'UPD') { - %= include 'partials/_quo_upd' - %} else { - %= include 'partials/_quo_list' - %} + <%= include 'partials/_quo_upd' %> + % } else { + <%= include 'partials/_quo_list' %> + % }
+ %end