/[smecontribs]/rpms/smeserver-qmHandle/contribs10/smeserver-qmHandle-1.4-manager2.patch
ViewVC logotype

Contents of /rpms/smeserver-qmHandle/contribs10/smeserver-qmHandle-1.4-manager2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun May 30 14:55:37 2021 UTC (3 years, 5 months ago) by michel
Branch: MAIN
CVS Tags: smeserver-qmHandle-1_4-22_el7_sme, smeserver-qmHandle-1_4-21_el7_sme, smeserver-qmHandle-1_4-24_el7_sme, smeserver-qmHandle-1_4-23_el7_sme, smeserver-qmHandle-1_4-25_el7_sme, smeserver-qmHandle-1_4-20_el7_sme, smeserver-qmHandle-1_4-16_el7_sme, smeserver-qmHandle-1_4-18_el7_sme, smeserver-qmHandle-1_4-15_el7_sme, smeserver-qmHandle-1_4-17_el7_sme, smeserver-qmHandle-1_4-19_el7_sme, HEAD
make: « clog » est à jour.

1 diff -urN smeserver-qmHandle-1.4.old/createlinks smeserver-qmHandle-1.4/createlinks
2 --- smeserver-qmHandle-1.4.old/createlinks 2012-08-23 01:51:59.000000000 +0400
3 +++ smeserver-qmHandle-1.4/createlinks 2021-05-25 23:03:12.824000000 +0400
4 @@ -16,6 +16,17 @@
5 # actions for console-save event:
6 #--------------------------------------------------
7
8 +#--------------------------------------------------
9 +# actions for smeserver-qmHandle-update event:
10 +#--------------------------------------------------
11 +
12 +my $event = 'smeserver-qmHandle-update';
13 +
14 +safe_symlink('restart', "root/etc/e-smith/events/$event/services2adjust/smanager");
15 +
16 +event_link('navigation2-conf', "$event", '80');
17 +event_link('routes2-conf', "$event", '80');
18 +event_link('locales2-conf', "$event", '80');
19
20 #--------------------------------------------------
21 # The End
22 diff -urN smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Qmh.pm smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Qmh.pm
23 --- smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/Controller/Qmh.pm 1970-01-01 04:00:00.000000000 +0400
24 +++ smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/Controller/Qmh.pm 2021-05-29 23:22:56.000000000 +0400
25 @@ -0,0 +1,321 @@
26 +package SrvMngr::Controller::Qmh;
27 +
28 +#----------------------------------------------------------------------
29 +# heading : Administration
30 +# description : E-Mail queue management
31 +# navigation : 5000 5100
32 +# menu : A
33 +#
34 +# name : qmhandle, method : get, url : /qmh, ctlact : qmh#main
35 +# name : qmhandle2, method : post, url : /qmh, ctlact : qmh#do_update
36 +# name : qmhandled, method : get, url : /qmh2, ctlact : qmh#do_update
37 +
38 +# routes : end
39 +# Copyright (C) 2005/2008 Peter Schubert, SACO Software and Consulting GmbH
40 +#----------------------------------------------------------------------
41 +use strict;
42 +use warnings;
43 +use Mojo::Base 'Mojolicious::Controller';
44 +
45 +use esmith::FormMagick qw(gen_locale_date_string);
46 +use esmith::ConfigDB;
47 +
48 +use Locale::gettext;
49 +use SrvMngr::I18N;
50 +
51 +use SrvMngr qw(theme_list init_session);
52 +
53 +our $cdb = esmith::ConfigDB->open() || die 'Cannot open configuration base';
54 +
55 +sub main {
56 +
57 + my $c = shift;
58 + $c->app->log->info($c->log_req);
59 +
60 + my %qmh_datas = ();
61 + my $title = $c->l('qmh_QMH_TITLE');
62 +
63 + $qmh_datas{'trt'} = 'LST';
64 + $qmh_datas{'altq'} = 0;
65 +
66 + $c->stash( title => $title, qmh_datas => \%qmh_datas );
67 + $c->render('qmh');
68 +};
69 +
70 +
71 +sub do_update {
72 +
73 + my $c = shift;
74 + $c->app->log->info($c->log_req);
75 +
76 + my %qmh_datas = ();
77 + my $result = "";
78 +
79 + my $report_type = $c->param('Report_type');
80 +
81 + my $trt = $c->param('trt');
82 + $qmh_datas{'trt'} = $trt;
83 +
84 + my $altq = $c->param('altq');
85 + $qmh_datas{'altq'} = $altq;
86 +
87 + if ($trt eq 'LST') {
88 + if ($report_type =~ /^(\S+)$/) {
89 + $report_type = $1;
90 + } else {
91 + $result = $c->l('INVALID_REPORT_TYPE') . " : $report_type";
92 + $report_type = undef;
93 + }
94 +
95 + $altq = 0;
96 + my $function = $report_type || '';
97 + if ($function =~ s/^alt-//) {
98 + $altq = 1;
99 + }
100 + $qmh_datas{'altq'} = $altq;
101 +
102 + if ($function eq 'list-queues') {
103 + $result = showListQueues ($c, $altq);
104 + } elsif ($function eq 'list-local-queue') {
105 + $result = showListLocalQueue ($c, $altq);
106 + } elsif ($function eq 'list-remote-queue') {
107 + $result = showListRemoteQueue ($c, $altq);
108 + } elsif ($function eq 'resend') {
109 + $result = resend($c, $altq);
110 + }
111 +
112 + $qmh_datas{'trt'} = 'REP';
113 + }
114 +
115 +
116 + if ($trt eq 'REP') {
117 + $c->redirect_to('/qmh');
118 + }
119 +
120 +
121 + if ($trt eq 'MSG') {
122 + my $msgid = $c->param('msgid');
123 + $result = $c->render_to_string(inline => showDeleteMessageNumber($c, $msgid)) if $msgid;
124 + $qmh_datas{'msgid'} = $msgid;
125 + }
126 +
127 +
128 + if ($trt eq 'DEL') {
129 + my $msgid = $c->param('msgid');
130 + $result = $c->render_to_string(inline => deleteMessageNumber($c, $msgid)) if $msgid;
131 + my $message = $c->l('qmh_DELETE') . ' <br> ' . $msgid;
132 + #$c->app->log->info($message.' '.$result);
133 + $c->flash( success => $message );
134 + $c->redirect_to('/qmh');
135 + }
136 +
137 +
138 + my $title = $c->l('qmh_QMH_TITLE');
139 + $c->stash( title => $title, qmh_datas => \%qmh_datas, modul => $result );
140 + $c->render('qmh');
141 +
142 +};
143 +
144 +
145 +sub reportType_list {
146 +
147 + my $c = shift;
148 +
149 + my $rec = $cdb->get('altqmail');
150 + my $altqmail = ($cdb->get('altqmail')->value || 0) if $rec;
151 +
152 + return [[ $c->l('qmh_LIST_QUEUE') => 'list-queues' ],
153 + [ $c->l('qmh_LIST_LOCAL_QUEUE') => 'list-local-queue' ],
154 + [ $c->l('qmh_LIST_REMOTE_QUEUE') => 'list-remote-queue' ],
155 + [ $c->l('qmh_RESEND_QUEUE') => 'resend' ]]
156 + unless $altqmail;
157 +
158 + return [[ $c->l('qmh_LIST_QUEUE') => 'list-queues' ],
159 + [ $c->l('qmh_LIST_LOCAL_QUEUE') => 'list-local-queue' ],
160 + [ $c->l('qmh_LIST_REMOTE_QUEUE') => 'list-remote-queue' ],
161 + [ $c->l('qmh_RESEND_QUEUE') => 'resend' ],
162 + [ "altqmail: ". $c->l('qmh_LIST_QUEUE') => 'alt-list-queues' ],
163 + [ "altqmail: ". $c->l('qmh_LIST_LOCAL_QUEUE') => 'alt-list-local-queue' ],
164 + [ "altqmail: ". $c->l('qmh_LIST_REMOTE_QUEUE') => 'alt-list-remote-queue' ],
165 + [ "altqmail: ". $c->l('qmh_RESEND_QUEUE') => 'alt-resend' ]];
166 +}
167 +
168 +
169 +#------------------------------------------------------------
170 +# subroutine to showListQueues
171 +#------------------------------------------------------------
172 +sub showListQueues {
173 +
174 + my ($c, $altq) = @_;
175 +
176 + my $out = '';
177 +
178 + my $opt = ($altq ? 'altqmail: ' : '');
179 + $out .= sprintf("<h2>%s</h2><br>", $opt . $c->l('qmh_SHOWLISTQUEUES'));
180 + $out .= sprintf("%s<br>%s", $c->l('qmh_VIEW_TIME'), scalar localtime(time));
181 +
182 + $opt = ($altq ? '-X -l' : '-l');
183 + my $MailQueues = `/usr/bin/qmHandle $opt`;
184 + $MailQueues =~ s/</'/g;
185 + $MailQueues =~ s/>/'/g;
186 +
187 + $MailQueues = AddLinks($MailQueues, $c, $altq);
188 +
189 + $out .= sprintf "<pre>";
190 + $out .= "$MailQueues";
191 + $out .= sprintf "</pre>";
192 + return $out;
193 +}
194 +
195 +
196 +#------------------------------------------------------------
197 +# subroutine to showListLocalQueue
198 +#------------------------------------------------------------
199 +sub showListLocalQueue {
200 +
201 + my ($c, $altq) = @_;
202 +
203 + my $out = '';
204 +
205 + my $opt = ($altq ? 'altqmail: ' : '');
206 + $out .= sprintf("<h2>%s</h2><br>", $opt . $c->l('qmh_LIST_LOCAL_QUEUE'));
207 + $out .= sprintf("%s<br>%s", $c->l('qmh_VIEW_TIME'), scalar localtime(time));
208 +
209 + $opt = ($altq ? '-X -L' : '-L');
210 + my $LocalQueue = `/usr/bin/qmHandle $opt`;
211 + $LocalQueue =~ s/</'/g;
212 + $LocalQueue =~ s/>/'/g;
213 +
214 + $LocalQueue = AddLinks($LocalQueue, $c, $altq);
215 +
216 + $out .= sprintf "<pre>";
217 + $out .= "$LocalQueue";
218 + $out .= sprintf "</pre>";
219 + return $out;
220 +}
221 +
222 +
223 +#------------------------------------------------------------
224 +# subroutine to showListRemoteQueue
225 +#------------------------------------------------------------
226 +sub showListRemoteQueue {
227 +
228 + my ($c, $altq) = @_;
229 +
230 + my $out = '';
231 +
232 + my $opt = ($altq ? 'altqmail: ' : '');
233 + $out .= sprintf("<h2>%s</h2><br>", $opt . $c->l('qmh_LIST_REMOTE_QUEUE'));
234 + $out .= sprintf("%s<br>%s", $c->l('qmh_VIEW_TIME'), scalar localtime(time));
235 +
236 + $opt = ($altq ? '-X -R' : '-R');
237 + my $RemoteQueue = `/usr/bin/qmHandle $opt`;
238 + $RemoteQueue =~ s/</'/g;
239 + $RemoteQueue =~ s/>/'/g;
240 +
241 + $RemoteQueue = AddLinks($RemoteQueue, $c, $altq);
242 +
243 + $out .= sprintf "<pre>";
244 + $out .= "$RemoteQueue";
245 + $out .= sprintf "</pre>";
246 + return $out;
247 +}
248 +
249 +
250 +#------------------------------------------------------------
251 +# subroutine to send ALARM to qmail
252 +#------------------------------------------------------------
253 +sub resend {
254 +
255 + my ($c, $altq) = @_;
256 +
257 + my $out = '';
258 +
259 + my $opt = ($altq ? 'altqmail: ' : '');
260 + $out .= sprintf("<h2>%s</h2><br>", $opt . $c->l('qmh_TRY_SEND_QUEUE'));
261 + $out .= sprintf("%s<br>%s", $c->l('qmh_SEND_QUEUE_AT'), scalar localtime(time));
262 +
263 + $opt = ($altq ? '-X -a' : '-a');
264 + my $Res = `/usr/bin/qmHandle $opt`;
265 + $Res =~ s/</'/g;
266 + $Res =~ s/>/'/g;
267 +
268 + $Res = AddLinks($Res, $c, $altq);
269 +
270 + $out .= sprintf "<pre>";
271 + $out .= "$Res";
272 + $out .= sprintf "</pre>";
273 + $out .= sprintf "<h3>Done</h3>";
274 + return $out;
275 +}
276 +
277 +
278 +sub AddLinks {
279 +
280 + my ($queues, $altq) = @_;
281 +
282 + my @splitq = split(/\n/, $queues);
283 +
284 + for (my $i = 0; $i < $#splitq; $i++) {
285 + if ($splitq[$i] =~ /^(\d+)\s+(\(\d+\,\s+\d+\/+\d+\)\s*)$/ ) {
286 + $splitq[$i] = "<a href=\"qmh2?trt=MSG&msgid=$1\">$1</a> $2";
287 + }
288 + }
289 + $queues = join("\n", @splitq);
290 +
291 + return $queues;
292 +}
293 +
294 +
295 +#------------------------------------------------------------
296 +# subroutine to showDeleteMessageNumber
297 +#------------------------------------------------------------
298 +sub showDeleteMessageNumber {
299 +
300 + my ($c, $msgid, $altq) = @_;
301 +
302 + if ($msgid =~ /^(\d+)$/) {
303 + $msgid = $1;
304 + } else {
305 + $msgid = undef;
306 + }
307 +
308 + my $out = '';
309 +
310 + my $opt = ($altq ? 'altqmail: ' : '');
311 + $out .= sprintf("<h2>%s</h2><br>", $opt . $c->l('qmh_DELETE_MSG_TITLEB'));
312 + $out .= sprintf("%s", $c->l('qmh_DELETE_MESSAGE'));
313 +
314 + $opt = ($altq ? "-X -m$msgid|head -100" : "-m$msgid|head -100");
315 + my $Message = `/usr/bin/qmHandle $opt`;
316 +
317 + $out .= sprintf "<pre>";
318 + $out .= "$Message";
319 + $out .= sprintf "</pre>";
320 + return $out;
321 +}
322 +
323 +
324 +sub deleteMessageNumber {
325 +
326 + my ($c, $msgid, $altq) = @_;
327 +
328 + if ($msgid =~ /^(\d+)$/) {
329 + $msgid = $1;
330 + } else {
331 + $msgid = undef;
332 + }
333 +
334 + my $out = '';
335 + my $opt = ($altq ? "-X -d$msgid" : "-d$msgid");
336 + my $Output = `/usr/bin/qmHandle $opt`;
337 +
338 + $out .= sprintf "<pre>";
339 + $out .= "$Output";
340 + $out .= sprintf "</pre>";
341 + return $out;
342 +
343 +}
344 +
345 +
346 +1;
347 diff -urN smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_en.lex smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_en.lex
348 --- smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_en.lex 1970-01-01 04:00:00.000000000 +0400
349 +++ smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_en.lex 2021-05-29 23:33:51.431000000 +0400
350 @@ -0,0 +1,20 @@
351 +'qmh_QMH_TITLE' => 'Qmail queue management',
352 +'qmh_OPERATION_STATUS_REPORT' => 'Operation status report',
353 +'qmh_QMH_DESC' => 'This panel uses <b>qmHandle</b> to manage the qmail message queues. Key features are the ability to view and delete messages in the queues.',
354 +'qmh_TRY_SEND_QUEUE' => 'Force resending of the Qmail queue',
355 +'qmh_SEND_QUEUE_AT' => 'Resend Qmail queue at: ',
356 +'qmh_LIST_QUEUE' => 'List message queues',
357 +'qmh_LIST_LOCAL_QUEUE' => 'List local message queue',
358 +'qmh_SHOWLISTQUEUES' => 'List Qmail local and remote queues',
359 +'qmh_LIST_REMOTE_QUEUE' => 'List remote message queue',
360 +'qmh_VIEW_TIME' => 'Qmail message queue, viewed at: ',
361 +'qmh_LIST_LOCAL_QUEUE' => 'List Qmail local queue',
362 +'qmh_LIST_REMOTE_QUEUE' => 'List Qmail remote queue',
363 +'qmh_RESEND_QUEUE' => 'Try to send queued messages now (qmail must be running)',
364 +'qmh_DELETE_MSG_TITLEB' => 'Queue management: delete Message',
365 +'qmh_DELETE_MESSAGE' => 'Delete this message from the queue ? (Only the first 100 lines are listed)',
366 +'qmh_DELETE' => 'Delete',
367 +'qmh_SELECT_AN_ACTION' => 'Select an action',
368 +'qmh_iFROM_QUEUE' => 'from message queue',
369 +'qmh_Administration' => 'Administration',
370 +'E-mail Warteschlange' => 'E-Mail queue management',
371 diff -urN smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_fr.lex smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_fr.lex
372 --- smeserver-qmHandle-1.4.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_fr.lex 1970-01-01 04:00:00.000000000 +0400
373 +++ smeserver-qmHandle-1.4/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Qmh/qmh_fr.lex 2021-05-29 23:35:14.502000000 +0400
374 @@ -0,0 +1,20 @@
375 +'qmh_QMH_TITLE' => 'Administration de file d\'attente',
376 +'qmh_OPERATION_STATUS_REPORT' => 'Rapport d\'état de l\'opération',
377 +'qmh_QMH_DESC' => 'Ce panel utilise <b>qmHandle</b> pour administrer la file d\'attente de Qmail. Les fonctionnalités principales sont de voir et d\'effacer des messages dans la file d\'attente. ',
378 +'qmh_TRY_SEND_QUEUE' => 'Forcer le renvoi de la file d\'attente de qmail',
379 +'qmh_SEND_QUEUE_AT' => 'Renvoi la file d\'attente Qmail le : ',
380 +'qmh_LIST_QUEUE' => 'Message de la file d\'attente',
381 +'qmh_LIST_LOCAL_QUEUE' => 'File d\'attente locale',
382 +'qmh_SHOWLISTQUEUES' => 'Files d\'attente locale et distante',
383 +'qmh_LIST_REMOTE_QUEUE' => 'File d\'attente distante de QMAIL',
384 +'qmh_VIEW_TIME' => 'La file d\'attente des messages de Qmail le : ',
385 +'qmh_LIST_LOCAL_QUEUE' => 'File d\'attente locale de QMAIL',
386 +'qmh_LIST_REMOTE_QUEUE' => 'File d\'attente distante de QMAIL',
387 +'qmh_RESEND_QUEUE' => 'Renvoyer les messages de la file d\'attente maintenant (Qmail doit être en fonction)',
388 +'qmh_DELETE_MSG_TITLEB' => 'Administration de file d\'attente : effacer le Message',
389 +'qmh_DELETE_MESSAGE' => 'Effacez ce message de la file d\'attente? (Seulement les 100 premières lignes sont affichées)',
390 +'qmh_DELETE' => 'Supprimer',
391 +'qmh_SELECT_AN_ACTION' => 'Sélectionnez une action :',
392 +'qmh_iFROM_QUEUE' => 'de la file d\'attente des messages',
393 +'qmh_Administration' => 'Administration',
394 +'E-mail Warteschlange' => 'Administration de file d\'attente des courriels',
395 diff -urN smeserver-qmHandle-1.4.old/root/usr/share/smanager/themes/default/templates/qmh.html.ep smeserver-qmHandle-1.4/root/usr/share/smanager/themes/default/templates/qmh.html.ep
396 --- smeserver-qmHandle-1.4.old/root/usr/share/smanager/themes/default/templates/qmh.html.ep 1970-01-01 04:00:00.000000000 +0400
397 +++ smeserver-qmHandle-1.4/root/usr/share/smanager/themes/default/templates/qmh.html.ep 2021-05-29 23:37:47.093000000 +0400
398 @@ -0,0 +1,50 @@
399 +% layout 'default', title => "Sme server 2 - qmh";
400 +
401 +% content_for 'module' => begin
402 +<div id="module">
403 + % if ($config->{debug} == 1) {
404 + <p>
405 + %= dumper $c->current_route
406 + %= dumper $qmh_datas
407 + </p>
408 + %}
409 + % if ( stash 'error' ) {
410 + <br><div class=sme-error>
411 + %= $c->render_to_string(inline => stash 'error')
412 + </div>
413 + %}
414 + <h1><%= $title %></h1>
415 +
416 + % my $btn = l('PERFORM');
417 + % my $url = '/qmh';
418 +
419 + %= form_for "$url" => (method => 'POST') => begin
420 + % if ($qmh_datas->{trt} eq 'LST') {
421 + %= $c->render_to_string(inline => $c->l('qmh_QMH_DESC'));
422 + <p>
423 + <span class=label>
424 + %=l 'qmh_SELECT_AN_ACTION'
425 + </span><span class=data>
426 + <!-- (to be sorted) -->
427 + %= select_field 'Report_type' => $c->reportType_list()
428 + </span>
429 + </p>
430 + %}
431 + % if ($qmh_datas->{trt} eq 'REP') {
432 + % $btn = l('NEXT');
433 + %= $c->render_to_string( inline => stash 'modul' )
434 + %}
435 + % if ($qmh_datas->{trt} eq 'MSG') {
436 + % $btn = l('Delete');
437 + %= $c->render_to_string( inline => stash 'modul' )
438 + %= hidden_field 'msgid' => $qmh_datas->{msgid}
439 + % $qmh_datas->{trt} = 'DEL';
440 + %}
441 + <div class='center'>
442 + %= submit_button "$btn", class => 'action'
443 + </div>
444 + %= hidden_field 'trt' => $qmh_datas->{trt}
445 + %= hidden_field 'altq' => $qmh_datas->{altq}
446 + % end
447 +</div>
448 +%end

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed