1 |
diff -urN smeserver-durep-1.5.0.old/createlinks smeserver-durep-1.5.0/createlinks |
2 |
--- smeserver-durep-1.5.0.old/createlinks 2021-04-27 18:56:17.000000000 +0400 |
3 |
+++ smeserver-durep-1.5.0/createlinks 2021-06-02 23:21:34.742000000 +0400 |
4 |
@@ -13,10 +13,15 @@ |
5 |
event_link("durep-init", $event, "90"); |
6 |
|
7 |
#-------------------------------------------------- |
8 |
-# actions for smeserver-durep-update: |
9 |
+# actions for smeserver-durep-update event: |
10 |
#-------------------------------------------------- |
11 |
$event = "smeserver-durep-update"; |
12 |
|
13 |
event_link("navigation-conf", $event, "50"); |
14 |
event_link("durep-init", $event, "90"); |
15 |
templates2events("/etc/crontab", $event ); |
16 |
+ |
17 |
+safe_symlink('restart', "root/etc/e-smith/events/$event/services2adjust/smanager"); |
18 |
+event_link('navigation2-conf', "$event", '80'); |
19 |
+event_link('routes2-conf', "$event", '80'); |
20 |
+event_link('locales2-conf', "$event", '80'); |
21 |
diff -urN smeserver-durep-1.5.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Durep.pm smeserver-durep-1.5.0/root/usr/share/smanager/lib/SrvMngr/Controller/Durep.pm |
22 |
--- smeserver-durep-1.5.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Durep.pm 1970-01-01 04:00:00.000000000 +0400 |
23 |
+++ smeserver-durep-1.5.0/root/usr/share/smanager/lib/SrvMngr/Controller/Durep.pm 2021-05-31 23:18:14.000000000 +0400 |
24 |
@@ -0,0 +1,66 @@ |
25 |
+package SrvMngr::Controller::Durep; |
26 |
+ |
27 |
+#---------------------------------------------------------------------- |
28 |
+# heading : Administration |
29 |
+# description : Disk usage report |
30 |
+# navigation : 4000 4390 |
31 |
+# menu : A |
32 |
+# |
33 |
+# name : durep, method : get, url : /durep, ctlact : durep#main |
34 |
+# |
35 |
+# routes : end |
36 |
+#---------------------------------------------------------------------- |
37 |
+use strict; |
38 |
+use warnings; |
39 |
+ |
40 |
+use Mojo::Base 'Mojolicious::Controller'; |
41 |
+ |
42 |
+use Locale::gettext; |
43 |
+use SrvMngr::I18N; |
44 |
+use SrvMngr qw(theme_list init_session); |
45 |
+ |
46 |
+ |
47 |
+sub main { |
48 |
+ |
49 |
+ my $c = shift; |
50 |
+ $c->app->log->info($c->log_req); |
51 |
+ |
52 |
+ my $modul = get_du( $c ); |
53 |
+ |
54 |
+ $c->stash( modul => $modul ); |
55 |
+ $c->render(template => 'durep'); |
56 |
+ |
57 |
+} |
58 |
+ |
59 |
+ |
60 |
+sub get_du { |
61 |
+ |
62 |
+ my ($c) = @_; |
63 |
+ |
64 |
+ my $tx = $c->tx; |
65 |
+ my $req = $tx->req; |
66 |
+ |
67 |
+# 3 env variables for durep.cgi |
68 |
+ $ENV{'SCRIPT_NAME'} = 'durep'; |
69 |
+ $ENV{'REQUEST_METHOD'} = $req->method; |
70 |
+ $ENV{'QUERY_STRING'} = $req->url->query->to_string; |
71 |
+ |
72 |
+ my $res = `/etc/e-smith/web/panels/manager/html/durep/durep.cgi`; |
73 |
+ |
74 |
+ my $step = 0; my $out; |
75 |
+ my @lines = split /\n/, $res; |
76 |
+# remove except 'body' |
77 |
+ foreach my $line (@lines) { |
78 |
+ if ( $line =~ m|<body>| ) { |
79 |
+ $step = 1; |
80 |
+ } elsif ( $line =~ m|</body>| ) { |
81 |
+ $step = 2; |
82 |
+ } elsif ( $step == 1 ) { |
83 |
+ $out .= $line; |
84 |
+ } |
85 |
+ } |
86 |
+ return $out; |
87 |
+} |
88 |
+ |
89 |
+ |
90 |
+1; |
91 |
diff -urN smeserver-durep-1.5.0.old/root/usr/share/smanager/lib/SrvMngr/I18N/Module/Durep/durep_en.lex smeserver-durep-1.5.0/root/usr/share/smanager/lib/SrvMngr/I18N/Module/Durep/durep_en.lex |
92 |
--- smeserver-durep-1.5.0.old/root/usr/share/smanager/lib/SrvMngr/I18N/Module/Durep/durep_en.lex 1970-01-01 04:00:00.000000000 +0400 |
93 |
+++ smeserver-durep-1.5.0/root/usr/share/smanager/lib/SrvMngr/I18N/Module/Durep/durep_en.lex 2021-05-31 18:01:36.000000000 +0400 |
94 |
@@ -0,0 +1 @@ |
95 |
+'dur_FORM_TITLE' => 'Disk usage report', |
96 |
\ Pas de fin de ligne à la fin du fichier |
97 |
diff -urN smeserver-durep-1.5.0.old/root/usr/share/smanager/themes/default/public/css/durep.css smeserver-durep-1.5.0/root/usr/share/smanager/themes/default/public/css/durep.css |
98 |
--- smeserver-durep-1.5.0.old/root/usr/share/smanager/themes/default/public/css/durep.css 1970-01-01 04:00:00.000000000 +0400 |
99 |
+++ smeserver-durep-1.5.0/root/usr/share/smanager/themes/default/public/css/durep.css 2021-05-31 19:04:00.000000000 +0400 |
100 |
@@ -0,0 +1,127 @@ |
101 |
+/* |
102 |
+a:hover { |
103 |
+ background-color: #DDDDDD; |
104 |
+} |
105 |
+ |
106 |
+body { |
107 |
+ text-align: center; |
108 |
+ background-color: #ffffff; |
109 |
+} |
110 |
+*/ |
111 |
+ |
112 |
+div.tbar { |
113 |
+ text-align: left; |
114 |
+ width: 100%; |
115 |
+ background-color: #EEEEEE; |
116 |
+ border-top: solid 1px #DDDDDD; |
117 |
+ border-bottom: solid 1px #DDDDDD; |
118 |
+} |
119 |
+ |
120 |
+div.bbar { |
121 |
+ text-align: left; |
122 |
+ width: 100%; |
123 |
+ background-color: #EEEEEE; |
124 |
+ border-top: solid 1px #DDDDDD; |
125 |
+ border-bottom: solid 1px #DDDDDD; |
126 |
+} |
127 |
+ |
128 |
+div.bbar * { |
129 |
+ font-size: 90%; |
130 |
+} |
131 |
+ |
132 |
+div.options { |
133 |
+ text-align: left; |
134 |
+ margin: 2em; |
135 |
+ background-color: #EEEEEE; |
136 |
+ border: solid 1px #DDDDDD; |
137 |
+} |
138 |
+ |
139 |
+.light { |
140 |
+ background-color: #ffffff; |
141 |
+ } |
142 |
+ |
143 |
+.mid { |
144 |
+ background-color: #f6f6f6; |
145 |
+} |
146 |
+ |
147 |
+.dark { |
148 |
+ background-color: #f0f0f0; |
149 |
+} |
150 |
+ |
151 |
+.tbar table { |
152 |
+ width: 100%; |
153 |
+ padding-left: 2pt; |
154 |
+ font-weight: bold; |
155 |
+} |
156 |
+ |
157 |
+.bbar table { |
158 |
+ width: 100%; |
159 |
+ padding-left: 2pt; |
160 |
+} |
161 |
+ |
162 |
+table.list { |
163 |
+ margin: 2em 0px; |
164 |
+ border: solid 1px #CCCCCC; |
165 |
+ margin-left: auto; |
166 |
+ margin-right: auto; |
167 |
+} |
168 |
+ |
169 |
+table.list td { |
170 |
+ text-align: left; |
171 |
+ padding: 2px 5px; |
172 |
+} |
173 |
+ |
174 |
+table.list th { |
175 |
+ text-align: left; |
176 |
+ padding: 2px 5px; |
177 |
+ text-align: left; |
178 |
+ background-color: #DDDDDD; |
179 |
+} |
180 |
+ |
181 |
+table.report { |
182 |
+ margin: 2em 0px; |
183 |
+ border: solid 1px #CCCCCC; |
184 |
+ text-align: left; |
185 |
+ margin-left: auto; |
186 |
+ margin-right: auto; |
187 |
+} |
188 |
+ |
189 |
+table.report td { |
190 |
+ padding: 2px 5px; |
191 |
+} |
192 |
+ |
193 |
+table.report th { |
194 |
+ padding: 2px 5px; |
195 |
+ text-align: left; |
196 |
+ background-color: #DDDDDD; |
197 |
+} |
198 |
+ |
199 |
+.graph { |
200 |
+ padding: 0px; |
201 |
+ background-color: #eeeeee; |
202 |
+ width: 200px; |
203 |
+ height: 15px; |
204 |
+} |
205 |
+ |
206 |
+th.right { |
207 |
+ text-align: right; |
208 |
+} |
209 |
+ |
210 |
+td.right { |
211 |
+ text-align: right; |
212 |
+} |
213 |
+ |
214 |
+span.dir { |
215 |
+ font-weight: bold; |
216 |
+} |
217 |
+ |
218 |
+span.empty { |
219 |
+ color: #006600; |
220 |
+ font-weight: bold; |
221 |
+} |
222 |
+ |
223 |
+span.coalesced { |
224 |
+ color: #880000; |
225 |
+ font-weight: bold; |
226 |
+} |
227 |
+ |
228 |
diff -urN smeserver-durep-1.5.0.old/root/usr/share/smanager/themes/default/templates/durep.html.ep smeserver-durep-1.5.0/root/usr/share/smanager/themes/default/templates/durep.html.ep |
229 |
--- smeserver-durep-1.5.0.old/root/usr/share/smanager/themes/default/templates/durep.html.ep 1970-01-01 04:00:00.000000000 +0400 |
230 |
+++ smeserver-durep-1.5.0/root/usr/share/smanager/themes/default/templates/durep.html.ep 2021-06-02 22:57:46.064000000 +0400 |
231 |
@@ -0,0 +1,24 @@ |
232 |
+% layout 'default', title => 'Sme server 2 - Durep'; |
233 |
+ |
234 |
+% content_for 'head_contrib' => begin |
235 |
+ %= stylesheet '/css/durep.css' |
236 |
+%end |
237 |
+ |
238 |
+% content_for 'module' => begin |
239 |
+ % if ($config->{debug} == 1) { |
240 |
+ <p> |
241 |
+ %= dumper $c->current_route |
242 |
+ </p> |
243 |
+ % } |
244 |
+ |
245 |
+<div id="central"> |
246 |
+ % if ( stash 'error' ) { |
247 |
+ <br><div class=sme-error> |
248 |
+ %= $c->render_to_string(inline => stash 'error') |
249 |
+ </div> |
250 |
+ %} |
251 |
+ |
252 |
+ %= $c->render_to_string(inline => $modul) |
253 |
+ |
254 |
+</div> |
255 |
+% end |