package SrvMngr::Controller::Qmailanalog; #---------------------------------------------------------------------- # heading : Investigation # description : Mail log file analysis # navigation : 7000 200 # # routes : end #---------------------------------------------------------------------- use strict; use warnings; use Mojo::Base 'Mojolicious::Controller'; use esmith::FormMagick qw(gen_locale_date_string); use Locale::gettext; use SrvMngr::I18N; use SrvMngr qw(theme_list init_session); sub main { my $c = shift; $c->app->log->info($c->log_req); my $title = $c->l('qma_FORM_TITLE'); my $modul = $c->render_to_string(inline => $c->l('qma_INITIAL_DESC')); $c->stash( title => $title, modul => $modul ); $c->render(template => 'qmailanalog'); }; sub do_update { my $c = shift; $c->app->log->info($c->log_req); my $result = ""; my $report_type = $c->param('report_type'); if ($report_type =~ /^(\S+)$/) { $report_type = $1; } elsif ($report_type =~ /^\s*$/) { $report_type = "zoverall"; } else { $result = $c->l('INVALID_REPORT_TYPE') . $report_type; $report_type = undef; } my $title = $c->l('qma_FORM_TITLE'); $result = $c->render_to_string(inline => generateReport($c, $report_type)) if $report_type; $c->stash( title => $title, modul => $result ); $c->render(template => 'module'); }; sub generateReport { my $c = shift; my $report_type = shift; my $out = ''; #------------------------------------------------------------ # Looks good; go ahead and generate the report. #------------------------------------------------------------ # $| = 1; my $now_string = $c->gen_locale_date_string(); $out .= sprintf("
"; while ("; $out .= sprintf(") { $out .= sprintf("%s", $_); } close QMAILQUEUEREPORT; $out .= sprintf "
"; while ("; $out .= sprintf(") { # Cook any special HTML characters s/\&/\&/g; s/\"/\"/g; s/\>/\>/g; s/\\</g; $out .= sprintf("%s", $_); } close QMAILANALOG; $out .= sprintf "