))
+ {
+ chop ($zone);
+ $zone =~ s/^.\///;
+ push @zones, $zone;
+ }
+ close ZONES;
+ my @zt = sort @zones;
+ return \@zt;
+}
+
+
+sub getMonth_list {
+
+ my $c = shift;
+ return [[ $c->l('dat_JANUARY') => '1'],
+ [ $c->l('dat_FEBRUARY') => '2'],
+ [ $c->l('dat_MARCH') => '3'],
+ [ $c->l('dat_APRIL') => '4'],
+ [ $c->l('dat_MAY') => '5'],
+ [ $c->l('dat_JUNE') => '6'],
+ [ $c->l('dat_JULY') => '7'],
+ [ $c->l('dat_AUGUST') => '8'],
+ [ $c->l('dat_SEPTEMBER') => '9'],
+ [ $c->l('dat_OCTOBER') => '10'],
+ [ $c->l('dat_NOVEMBER') => '11'],
+ [ $c->l('dat_DECEMBER') => '12']];
+}
+
+
1;
diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm
--- smeserver-manager-0.1.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm 2020-06-28 16:50:36.433935049 +0200
+++ smeserver-manager-0.1.0/root/usr/share/smanager/lib/SrvMngr/Controller/Quota.pm 2020-07-05 21:02:49.000000000 +0200
@@ -33,17 +33,15 @@
my %quo_datas = ();
my $title = $c->l('quo_FORM_TITLE');
- my $modul = '';
$quo_datas{'trt'} = 'LIST';
my @userAccounts;
- if ($adb)
- {
+ if ($adb) {
@userAccounts = $adb->users();
}
- $c->stash( title => $title, modul => $modul, quo_datas => \%quo_datas, userAccounts => \@userAccounts );
+ $c->stash( title => $title, quo_datas => \%quo_datas, userAccounts => \@userAccounts );
$c->render(template => 'quota');
};
@@ -61,7 +59,6 @@
my %quo_datas = ();
my $title = $c->l('quo_FORM_TITLE');
- my $modul = '';
$quo_datas{'trt'} = $trt;
@@ -79,7 +76,7 @@
}
- $c->stash( title => $title, modul => $modul, quo_datas => \%quo_datas );
+ $c->stash( title => $title, quo_datas => \%quo_datas );
$c->render( template => 'quota' );
};
@@ -90,30 +87,46 @@
my $c = shift;
$c->app->log->info($c->log_req);
+ my $title = $c->l('quo_FORM_TITLE');
+ my %quo_datas = ();
+
my $rt = $c->current_route;
my $trt = ($c->param('trt') || 'LIST');
+ $quo_datas{trt} = $trt;
my $result = '';
+ my $res;
if ( $trt eq 'UPD' ) {
- my $acct = ($c->param('user') || '');
- my $soft = ($c->param('Soft') || '');
- my $hard = ($c->param('Hard') || '');
+ $quo_datas{user} = ($c->param('user') || '');
+ $quo_datas{softlim} = ($c->param('Soft') || '');
+ $quo_datas{hardlim} = ($c->param('Hard') || '');
# controls
- my $res = validate_quota( $c, $acct, $soft, $hard );
+ $res = validate_quota( $c, $quo_datas{user}, $quo_datas{softlim}, $quo_datas{hardlim} );
$result .= $res unless $res eq 'OK';
if ( ! $result ) {
- $result = $c->l('quo_SUCCESSFULLY_MODIFIED') . ' ' . $acct;
+ $result = $c->l('quo_SUCCESSFULLY_MODIFIED') . ' ' . $quo_datas{user};
+ } else {
+ $quo_datas{userRec} = $adb->get($quo_datas{user}) || undef;
}
}
- my $title = $c->l('quo_FORM_TITLE');
+ # common parts
+
+ if ($res ne 'OK') {
+ $c->stash( error => $result );
+ $c->stash( title => $title, quo_datas => \%quo_datas );
+ return $c->render('quota');
+ }
+
+ my $message = "'Quota' updates ($trt) DONE";
+ $c->app->log->info($message);
+ $c->flash( success => $result );
- $c->stash( title => $title, modul => $result );
- $c->render(template => 'module');
+ $c->redirect_to('/quota');
};
diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/datetime.html.ep smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/datetime.html.ep
--- smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/datetime.html.ep 2020-07-05 22:56:57.000000000 +0200
+++ smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/datetime.html.ep 2020-07-05 19:21:53.000000000 +0200
@@ -22,10 +22,10 @@
%= form_for '/datetime' => (method => 'POST') => begin
- %= hidden_field 'old_ntpstatus' => $dat_datas->{ntpstatus};
+ %= hidden_field 'Old_ntpstatus' => $dat_datas->{ntpstatus};
- % param 'ntpstatus' => $dat_datas->{ntpstatus} unless param 'ntpstatus';
- %= radio_button ntpstatus => 'enabled'
+ % param 'Ntpstatus' => $dat_datas->{ntpstatus} unless param 'Ntpstatus';
+ %= radio_button Ntpstatus => 'enabled'
%=l 'dat_NTP_CONFIGURE_TITLE'
@@ -46,12 +46,12 @@
%=l 'dat_NTP_SERVER'
- %= text_field 'ntpServer' => $dat_datas->{ntpserver}, class => 'input'
+ %= text_field 'Ntpserver' => $dat_datas->{ntpserver}, class => 'input'
% }
- %= radio_button ntpstatus => 'disabled'
+ %= radio_button Ntpstatus => 'disabled'
%=l 'dat_NTP_DISABLE_TITLE'
@@ -66,36 +66,44 @@
%=l 'dat_CURRENT_SETTING'
-
+
%= $dat_datas->{now_string}
%=l 'dat_NEW_M/D/Y'
- %= text_field 'month' => $dat_datas->{month}, size => '2', class => 'input'
+ % param 'Month' => $dat_datas->{month} unless param 'Month';
+ %= select_field 'Month' => $c->getMonth_list(), class => 'input'
- %= text_field 'day' => $dat_datas->{day}, size => '2', class => 'input'
+ % param 'Day' => $dat_datas->{day} unless param 'Day';
+ %= text_field 'Day', size => '2', class => 'input'
- %= text_field 'year' => $dat_datas->{year}, size => '2', class => 'input'
+ % param 'Year' => $dat_datas->{year} unless param 'Year';
+ %= text_field 'Year', size => '4', class => 'input'
%=l 'dat_NEW_H/M/S'
- %= text_field 'hour' => $dat_datas->{hour}, size => '2', class => 'input'
+ % param 'Hour' => $dat_datas->{hour} unless param 'Hour';
+ %= text_field 'Hour', size => '2', class => 'input'
- %= text_field 'minute' => $dat_datas->{minute}, size => '2', class => 'input'
+ % param 'Minute' => $dat_datas->{minute} unless param 'Minute';
+ %= text_field 'Minute', size => '2', class => 'input'
- %= text_field 'second' => $dat_datas->{second}, size => '2', class => 'input'
+ % param 'Second' => $dat_datas->{second} unless param 'Second';
+ %= text_field 'Second', size => '2', class => 'input'
%=l 'dat_AM/PM_AND_TZ'
- %= select_field 'ampm' => [[AM => 'am'],[PM => 'pm']], class => 'input'
+ % param 'Ampm' => $dat_datas->{ampm} unless param 'Ampm';
+ %= select_field 'Ampm' => ['AM', 'PM'], class => 'input'
- %= text_field 'timezone' => $dat_datas->{timezone}, class => 'input'
+ % param 'Timezone' => $c->getTimezone() unless param 'Timezone';
+ %= select_field 'Timezone' => $c->getZone_list(), class => 'input'
% }
diff -urN smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/quota.html.ep smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/quota.html.ep
--- smeserver-manager-0.1.0.old/root/usr/share/smanager/themes/default/templates/quota.html.ep 2020-04-26 11:00:06.000000000 +0200
+++ smeserver-manager-0.1.0/root/usr/share/smanager/themes/default/templates/quota.html.ep 2020-07-05 21:03:24.000000000 +0200
@@ -5,18 +5,18 @@
% if ($config->{debug} == 1) {
- (DBG)route:
%= dumper $c->current_route
-
- (DBG)datas:
%= dumper $quo_datas
- -->
% }
- <%= $title%>
+ % if ( stash 'error' ) {
+
+ %= $c->render_to_string(inline => stash 'error')
+
+ %}
- %= $modul
+ <%= $title%>
% if ($quo_datas->{trt} eq 'UPD') {
%= include 'partials/_quo_upd'