initial commit of file from CVS for smeserver-awstats on Sat Sep 7 20:09:28 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:09:28 +10:00
parent 2ac31e7de4
commit 4e37dd65ac
29 changed files with 3907 additions and 2 deletions

View File

@@ -0,0 +1,355 @@
package SrvMngr::Controller::Awstats;
#----------------------------------------------------------------------
# heading : Investigation
# description : Web statistics
# navigation : 6000 350
#
# menu : A
#
# name : awstats, method : get, url : /awstats, ctlact : awstats#main
# name : awstats2, method : get, url : /awstats2, ctlact : awstats#do_display
# name : awstatsc, method : post, url : /awstats, ctlact : awstats#do_display
# name : awstatsu, method : post, url : /awstats2, ctlact : awstats#do_update
# name : awstats3, method : get, url : /awstats3, ctlact : awstats#do_update
#
# routes : end
#----------------------------------------------------------------------
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
use POSIX qw(strftime);
use esmith::DomainsDB;
use esmith::ConfigDB;
our $ddb = esmith::DomainsDB->open || die "Couldn't open domains db";
our $cdb = esmith::ConfigDB->open || die "Couldn't open configuration db";
our $awsdirdata="/home/e-smith/files/users/admin/home/awstats";
our $REGEXP_DOMAIN = qq([a-zA-Z0-9\-\.]+);
sub main {
my $c = shift;
$c->app->log->info($c->log_req);
my %aws_datas = ();
my $title = $c->l('aws_FORM_TITLE');
$aws_datas{trt} = 'LST';
my $rec = $cdb->get('AWStats');
$aws_datas{status} = $rec->prop('status')|| 'disabled';
$aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
$aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
$aws_datas{username} = $c->session->{username} || 'unknown';
my @domains;
# if ( $aws_datas->{status} ne 'enabled' ) {
for ($ddb->domains()) {
my $domain = $_->key;
next unless ( -d "$awsdirdata/$domain" );
my $ns = $_->prop('Nameservers') || 'internet';
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
my $awstats = 'Empty';
if (system("/bin/ls $awsdirdata/$domain/ | /bin/grep '.txt' > /dev/null 2>&1") == 0 ) {
$awstats = 'Show';
}
my $status = 'active';
#if ( ????system == 0 ) { // T O D O inactive domains//
# $status = 'inactive';
#}
push @domains,
{ Domain => $_->key, $_->props,
Nameservers => $ns,
AWStats => $awstats,
Status => $status
}
}
if (open (ST, "/var/log/httpd/awstats_lr")) {
$aws_datas{logres} = <ST>;
close (ST);
}
# }
$c->stash( title => $title, aws_datas => \%aws_datas, domains => \@domains );
$c->render(template => 'awstats');
}
sub do_display {
my $c = shift;
$c->app->log->info($c->log_req);
my %aws_datas = ();
my $title = $c->l('aws_FORM_TITLE');
my $result;
my $trt = $c->param('trt') || 'LST';
my $domain = $c->param('Domain');
if ( $trt eq 'SHW' ) {
$aws_datas{periodrep} = 'month';
$aws_datas{monthrep} = strftime( "%m", localtime );
$aws_datas{yearrep} = strftime( "%Y", localtime );
$aws_datas{domain} = $domain;
$result = _get_awst( $c, \%aws_datas );
}
if ( $trt eq 'CNF' ) {
my $rec = $cdb->get('AWStats');
if ($rec) {
$aws_datas{status} = $rec->prop('status')|| 'disabled';
$aws_datas{mailstatus} = ( $rec->prop('mailstatus') || 'disabled' );
$aws_datas{ftpstatus} = ( $rec->prop('ftpstatus') || 'disabled' );
$aws_datas{freq} = $rec->prop('Freq')|| '5m';
$aws_datas{barSize} = $rec->prop('BarSize')|| 'medium';
$aws_datas{language} = $rec->prop('Language')|| 'auto';
$aws_datas{maxNbOfDomain} = $rec->prop('MaxNbOfDomain')|| '50';
$aws_datas{maxNbOfHosts} = $rec->prop('MaxNbOfHostsShown')|| '100';
$aws_datas{maxNbOfKeywords} = $rec->prop('MaxNbOfKeywordsShown')|| '50';
$aws_datas{maxNbOfPage} = $rec->prop('MaxNbOfPageShown')|| '200';
$aws_datas{maxNbOfReferer} = $rec->prop('MaxNbOfRefererShown')|| '50';
$aws_datas{maxNbOfRobot} = $rec->prop('MaxNbOfRobotShown')|| '25';
$aws_datas{minHitPage} = $rec->prop('MinHitFile')|| '1';
$aws_datas{minHitHost} = $rec->prop('MinHitHost')|| '1';
$aws_datas{minHitKeyword} = $rec->prop('MinHitKeyword')|| '1';
$aws_datas{minHitRefer} = $rec->prop('MinHitRefer')|| '1';
$aws_datas{minHitRobot} = $rec->prop('MinHitRobot')|| '1';
$aws_datas{rawlog} = $rec->prop('Rawlog')|| 'no';
$aws_datas{skipExternalIP} = $rec->prop('SkipExternalIP')|| 'yes';
$aws_datas{skipLocalIP} = $rec->prop('SkipLocalIP')|| 'yes';
$aws_datas{skipLocalNetworks} = $rec->prop('SkipLocalNetworks')|| 'no';
$aws_datas{userFramesWhenCGI} = $rec->prop('UserFramesWhenCGI')|| 'no';
$aws_datas{username} = $c->session->{username} || 'unknown';
}
}
$aws_datas{trt} = $trt;
$aws_datas{domain} = $domain;
$c->stash( title => $title .' '. $domain, aws_datas => \%aws_datas, modul => $result );
$c->render(template => 'awstats');
}
sub do_update {
my $c = shift;
$c->app->log->info($c->log_req);
my $rt = $c->current_route;
my $trt = $c->param('trt') || 'SHWP';
my $title = $c->l('aws_FORM_TITLE');
my %aws_datas = ();
$aws_datas{trt} = $trt;
my ($res, $result) = '';
if ( $trt eq 'UPD' ) {
my $status = $c->param('Status');
my $mailstatus = $c->param('Mailstatus');
my $ftpstatus = $c->param('Ftpstatus');
my $freq = $c->param('Freq');
my $skipLocalIP = $c->param('SkipLocalIP');
my $skipExternalIP = $c->param('SkipExternalIP');
my $skipLocalNetworks = $c->param('SkipLocalNetworks');
my $userFramesWhenCGI = $c->param('UserFramesWhenCGI');
my $language = $c->param('Language');
my $rawlog = $c->param('Rawlog');
my $barSize = $c->param('BarSize');
my $maxNbOfDomain = $c->param('MaxNbOfDomain');
my $maxNbOfHosts = $c->param('MaxNbOfHosts');
my $minHitHost = $c->param('MinHitHost');
my $maxNbOfPages = $c->param('MaxNbOfPages');
my $minHitPage = $c->param('MinHitPage');
my $maxNbOfRobot = $c->param('MaxNbOfRobot');
my $minHitRobot = $c->param('MinHitRobot');
my $maxNbOfReferer = $c->param('MaxNbOfReferer');
my $minHitRefer = $c->param('MinHitRefer');
my $maxNbOfKeywords = $c->param('MaxNbOfKeywords');
my $minHitKeyword = $c->param('MinHitKeyword');
#$result = 'blocked';
if ($maxNbOfDomain =~ /^([0-9]+)$/) {
$maxNbOfDomain = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfDomain .'<br>';
}
if ($maxNbOfHosts =~ /^([0-9]+)$/) {
$maxNbOfHosts = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $maxNbOfHosts .'<br>';
}
if ($minHitHost =~ /^([0-9]+)$/) {
$minHitHost = $1;
} else {
$result .= $c->l('FIELD_INVALID_CHARS') .' : '. $minHitHost .'<br>';
}
$maxNbOfDomain = 1 if $maxNbOfDomain < 1;
$maxNbOfHosts = 1 if $maxNbOfHosts < 1;
$minHitHost = 1 if $minHitHost < 1;
$maxNbOfPages = 1 if $maxNbOfPages < 1;
$minHitPage = 1 if $minHitPage < 1;
$maxNbOfRobot = 1 if $maxNbOfRobot < 1;
$minHitRobot = 1 if $minHitRobot < 1;
$maxNbOfReferer = 1 if $maxNbOfReferer < 1;
$minHitRefer = 1 if $minHitRefer < 1;
$maxNbOfKeywords = 1 if $maxNbOfKeywords < 1;
$minHitKeyword = 1 if $minHitKeyword < 1;
# controls
$res ='';
if ( ! $result ) {
my $rec = $cdb->get('AWStats');
if ($rec) {
$rec->set_prop('status', $status); ;
$rec->set_prop('mailstatus', $mailstatus); ;
$rec->set_prop('ftpstatus', $ftpstatus); ;
$rec->set_prop('Freq', $freq);
$rec->set_prop('BarSize',$barSize );
$rec->set_prop('Language', $language);
$rec->set_prop('MaxNbOfDomain', $maxNbOfDomain);
$rec->set_prop('MaxNbOfHostsShown', $maxNbOfHosts);
$rec->set_prop('MaxNbOfKeywordsShown', $maxNbOfKeywords);
$rec->set_prop('MaxNbOfPageShown', $maxNbOfPages);
$rec->set_prop('MaxNbOfRefererShown', $maxNbOfReferer);
$rec->set_prop('MaxNbOfRobotShown', $maxNbOfRobot);
$rec->set_prop('MinHitFile', $minHitPage);
$rec->set_prop('MinHitHost', $minHitHost);
$rec->set_prop('MinHitKeyword', $minHitKeyword);
$rec->set_prop('MinHitRefer', $minHitRefer);
$rec->set_prop('MinHitRobot', $minHitRobot);
$rec->set_prop('Rawlog', $rawlog);
$rec->set_prop('SkipExternalIP', $skipExternalIP);
$rec->set_prop('SkipLocalIP', $skipLocalIP);
$rec->set_prop('SkipLocalNetworks', $skipLocalNetworks);
$rec->set_prop('UserFramesWhenCGI', $userFramesWhenCGI);
}
if ( system( '/sbin/e-smith/signal-event awstats-update &' ) != 0 ) {
$result = ($c->l('aws_ERROR_CONFIG_UPDATE') . " $trt");
} else {
# sleep (2);
$res = 'OK';
$result = $c->l('aws_CONFIG_SUCCESSFULLY_MODIFIED');
}
}
}
if ( $trt eq 'SHWP' ) {
$aws_datas{periodrep} = $c->param('databasebreak');
$aws_datas{monthrep} = $c->param('month');
$aws_datas{yearrep} = $c->param('year');
$aws_datas{dayrep} = $c->param('day') || '';
$aws_datas{hourrep} = $c->param('hour') || ''; # does not exist (bug in awstats 7.8-3)
$aws_datas{domain} = $c->param('config') || 'None';
$result = _get_awst( $c, \%aws_datas );
$c->stash( title => $title .' '. $aws_datas{domain}, aws_datas => \%aws_datas, modul => $result );
return $c->render( 'awstats' );
}
# common parts
if ($res ne 'OK') {
$c->stash( error => $result );
$c->stash( title => $title, aws_datas => \%aws_datas );
return $c->render( 'awstats' );
}
# $cdb = esmith::ConfigDB->open();
my $message = "'AWStats configuration' update ($trt) DONE";
$c->app->log->info($message);
$c->flash( success => $result );
$c->redirect_to('/awstats');
}
sub _get_awst {
my ($c, $aws_datas) = @_;
my $periodrep = $aws_datas->{periodrep};
my $yearrep = $aws_datas->{yearrep};
my $monthrep = $aws_datas->{monthrep};
my $dayrep = $aws_datas->{dayrep};
my $hourrep = $aws_datas->{hourrep};
my $domain = $aws_datas->{domain};
my $res;
$domain = $1 if ($domain =~ /^($REGEXP_DOMAIN)$/);
$periodrep = $1 if ($periodrep =~ /^([A-Za-z]+)$/);
$monthrep = $1 if ($monthrep =~ /^([A-Za-z\-]+)$/);
$yearrep = $1 if ($yearrep =~ /^([0-9]+)$/);
$dayrep = $1 if ($dayrep and $dayrep =~ /^([0-9]+)$/);
$hourrep = $1 if ($hourrep and $hourrep =~ /^([0-9]+)$/);
# cli awstats.pl call
$res = `/etc/e-smith/web/panels/manager/cgi-bin/.awstats/awstats.pl -databasebreak=$periodrep -month=$monthrep -year=$yearrep -day=$dayrep -hour=$hourrep -config="${domain}" -lang=auto -output`;
# change awstats link for this controller
$res =~ s|action="/cgi-bin/awstats.pl?|action="/smanager/awstats3?trt=SHWP&|;
# change DirIcons for sm2 public one
$res =~ s|\.\./\.\./awstats|\./images/awstats/icon|g;
return $res;
}
sub freq_options_list {
my $c = shift;
return [[ '5 ' . $c->l('MINUTES') => '5m'],
[ '10 ' . $c->l('MINUTES') => '10m'],
[ '15 ' . $c->l('MINUTES') => '15m'],
[ '30 ' . $c->l('MINUTES') => '30m'],
[ '1 ' . $c->l('HOUR') => '1h'],
[ '2 ' . $c->l('HOURS') => '2h'],
[ '4 ' . $c->l('HOURS') => '4h'],
[ '8 ' . $c->l('HOURS') => '8h'],
[ '12 ' . $c->l('HOURS') => '12h']];
}
sub language_options_list {
my $c = shift;
return [[ 'Auto Detect' => 'auto' ],
['English' => 'en' ],
['French', => 'fr' ],
['Dutch' => 'nl' ],
['Spanish' => 'es' ],
['Italian' => 'it' ],
['German', => 'de' ],
['Polish', => 'pl' ],
['Greek' => 'gr' ],
['Czech' => 'cz' ],
['Portuguese' => 'pt' ]];
}
1

View File

@@ -0,0 +1,37 @@
'aws_FORM_TITLE' => 'Show or Configure Awstats Statistics',
'aws_BUTTON_CONFIGURE' => 'Configure AWStats',
'aws_STATS_NOTE' => 'Note: A Domain is not shown in the list below until after midnight on the day statistics are available. To force the display sooner, browse to the website to create some stats, then resave awstats settings.',
'aws_DOMAINS_TITLE' => 'List of Domains viewable by admin',
'aws_DISABLED' => 'AWStats is disabled.',
'aws_UPDATED' => 'Updated on [_1] in [_2] secs. [_3] new logs processed.',
'aws_COPYRIGHT' => 'Copyright neddix.de, Stuttgart',
'aws_CONTENT' => 'Content',
'aws_CONFIG_TITLE' => 'Configure AWStats Sme version',
'aws_LABEL_STATUS' => 'State',
'aws_REPORTED' => 'Reported period',
'aws_STATUS' => 'status',
'aws_MAILSTATUS' => 'Awstats Mail status',
'aws_FTPSTATUS' => 'Awstats Ftp status',
'aws_FREQUENCY' => 'Launch frequency',
'aws_NO_LOCAL_IP' => 'Ignore hits from your local network',
'aws_NO_EXTERNAL_IP' => 'Ignore hits from your external IP or network',
'aws_YES_EXT_IP' => 'Yes, external IP',
'aws_YES_EXT_IP_MSK' => 'Yes, external IP/Netmask',
'aws_NO_LOCAL' => 'Ignore hits from local networks as defined in the \'Local networks\' panel',
'aws_FRAME' => 'Show report in HTML frames',
'aws_LANGUAGE' => 'Default language',
'aws_RAWLOG' => 'Enable plugin \'Rawlog\'',
'aws_MAX_DOMAINS' => 'Max. number of domains shown',
'aws_MAX_HOSTS' => 'Max. number of hosts shown',
'aws_MIN_HIT_HOSTS' => 'Only show hosts with at least these hits:',
'aws_MAX_PAGES' => 'Max. number of pages shown',
'aws_MIN_HIT_PAGES' => 'Only show pages with at least these hits:',
'aws_MAX_ROBOTS' => 'Max. number of robots shown',
'aws_MIN_HIT_ROBOT' => 'Only show robots with at least these hits:',
'aws_MAX_REFERER' => 'Max. number of referrers shown',
'aws_MIN_HIT_REFERER' => 'Only show referrers with at least these hits:',
'aws_MAX_KEYWORDS' => 'Max. number of keywords shown',
'aws_MIN_HIT_KEYWORDS' => 'Only show keywords with at least these hits:',
'aws_BAR_SIZE' => 'Graphics bar size',
'aws_CONFIG_SUCCESSFULLY_MODIFIED' => 'Configuration has been updated successfully.<br>Please note, that changed ignore-rules will only effect processing of future logs.',
'aws_ERROR_CONFIG_UPDATE' => 'Error: internal failure while updating awstats configuration.',

View File

@@ -0,0 +1 @@
# link to original awstats icon directory for sm2

View File

@@ -0,0 +1,34 @@
% layout 'default', title => "Sme server 2 - AWStats";
% content_for 'module' => begin
<div id='module' class='module awstats-panel'>
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
%= dumper $aws_datas
</p>
% }
% if ( stash 'warning' ) {
<br><div class=sme-warning>
%= $c->render_to_string(inline => stash 'warning')
</div>
%}
% if ( stash 'error' ) {
<br><div class=sme-error>
%= $c->render_to_string(inline => stash 'error')
</div>
%}
<h1><%= $title%></h1>
% if ($aws_datas->{trt} eq 'CNF') {
%= include 'partials/_aws_cnf'
%} elsif ($aws_datas->{trt} eq 'SHW' or $aws_datas->{trt} eq 'SHWP') {
%= include 'partials/_aws_shw'
%} elsif ($aws_datas->{trt} eq 'UPD') {
%= include 'partials/_aws_cnf'
%} else {
%= include 'partials/_aws_list'
%}
</div>
% end

View File

@@ -0,0 +1,139 @@
<div id='aws_conf'>
%= form_for '/awstats2' => (method => 'POST') => begin
<h2><%=l 'aws_CONFIG_TITLE'%></h2>
<p><span class=label>
%=l 'aws_STATUS', class => 'label'
</span><span class=data>
% param 'Status' => $aws_datas->{status} unless param 'Status';
%= select_field 'Status' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span><span class=label2>
%=l 'aws_MAILSTATUS'
</span><span class=data>
% param 'Mailstatus' => $aws_datas->{mailstatus} unless param 'Mailstatus';
%= select_field 'Mailstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span><span class=label2>
%=l 'aws_FTPSTATUS'
</span><span class=data>
% param 'Ftpstatus' => $aws_datas->{ftpstatus} unless param 'Ftpstatus';
%= select_field 'Ftpstatus' => [[(l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_FREQUENCY'
</span><span class=data>
% param 'Freq' => $aws_datas->{freq} unless param 'Freq';
%= select_field 'Freq', $c->freq_options_list(), class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_LOCAL_IP', class => 'label'
</span><span class=data>
% param 'SkipLocalIP' => $aws_datas->{skipLocalIP} unless param 'SkipLocalIP';
%= select_field 'SkipLocalIP' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_EXTERNAL_IP', class => 'label'
</span><span class=data>
% param 'SkipExternalIP' => $aws_datas->{skipExternalIP} unless param 'SkipExternalIP';
%= select_field 'SkipExternalIP' => [[(l 'NO') => 'no'], [(l 'aws_YES_EXT_IP') => 'yes'], [(l 'aws_YES_EXT_IP_MSK') => 'mask']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_NO_LOCAL', class => 'label'
</span><span class=data>
% param 'SkipLocalNetworks' => $aws_datas->{skipLocalNetworks} unless param 'SkipLocalNetworks';
%= select_field 'SkipLocalNetworks' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_FRAME', class => 'label'
</span><span class=data>
% param 'UserFramesWhenCGI' => $aws_datas->{userFramesWhenCGI} unless param 'UserFramesWhenCGI';
%= select_field 'UserFramesWhenCGI' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_LANGUAGE'
</span><span class=data>
% param 'Language' => $aws_datas->{language} unless param 'Language';
%= select_field 'Language', $c->language_options_list(), class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_RAWLOG', class => 'label'
</span><span class=data>
% param 'Rawlog' => $aws_datas->{rawlog} unless param 'Rawlog';
%= select_field 'Rawlog' => [[ (l 'YES') => 'yes'], [ (l 'NO') => 'no']], class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_DOMAINS', class => 'label'
</span><span class=data>
% param 'MaxNbOfDomain' => $aws_datas->{maxNbOfDomain} unless param 'MaxNbOfDomain';
%= text_field 'MaxNbOfDomain' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_HOSTS', class => 'label'
</span><span class=data>
% param 'MaxNbOfHosts' => $aws_datas->{maxNbOfHosts} unless param 'MaxNbOfHosts';
%= text_field 'MaxNbOfHosts' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_HOSTS', class => 'label'
</span><span class=data>
% param 'MinHitHost' => $aws_datas->{minHitHost} unless param 'MinHitHost';
%= text_field 'MinHitHost' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_PAGES', class => 'label'
</span><span class=data>
% param 'MaxNbOfPages' => $aws_datas->{maxNbOfPage} unless param 'MaxNbOfPages';
%= text_field 'MaxNbOfPages' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_PAGES', class => 'label'
</span><span class=data>
% param 'MinHitPAge' => $aws_datas->{minHitPage} unless param 'MinHitPAge';
%= text_field 'MinHitPAge' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_ROBOTS', class => 'label'
</span><span class=data>
% param 'MaxNbOfRobot' => $aws_datas->{maxNbOfRobot} unless param 'MaxNbOfRobot';
%= text_field 'MaxNbOfRobot' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_ROBOT', class => 'label'
</span><span class=data>
% param 'MinHitRobot' => $aws_datas->{minHitRobot} unless param 'MinHitRobot';
%= text_field 'MinHitRobot' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_REFERER', class => 'label'
</span><span class=data>
% param 'MaxNbOfReferer' => $aws_datas->{maxNbOfReferer} unless param 'MaxNbOfReferer';
%= text_field 'MaxNbOfReferer' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_REFERER' => size => '5', class => 'label'
</span><span class=data>
% param 'MinHitRefer' => $aws_datas->{minHitRefer} unless param 'MinHitRefer';
%= text_field 'MinHitRefer' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_MAX_KEYWORDS', class => 'label'
</span><span class=data>
% param 'MaxNbOfKeywords' => $aws_datas->{maxNbOfKeywords} unless param 'MaxNbOfKeywords';
%= text_field 'MaxNbOfKeywords' => size => '5', class => 'input'
</span>
<span class=label>
%=l 'aws_MIN_HIT_KEYWORDS', class => 'label'
</span><span class=data>
% param 'MinHitKeyword' => $aws_datas->{minHitKeyword} unless param 'MinHitKeyword';
%= text_field 'MinHitKeyword' => size => '5', class => 'input'
</span></p>
<p><span class=label>
%=l 'aws_BAR_SIZE', class => 'label'
</span><span class=data>
% param 'BarSize' => $aws_datas->{barSize} unless param 'BarSize';
%= select_field 'BarSize' => [[(l 'MEDIUM') => 'medium'], [(l 'SMALL') => 'small'], [(l 'LARGE') => 'large']], class => 'input'
</span></p>
<div class='center'>
%= submit_button $c->l('SAVE'), class => 'action'
</div>
%= hidden_field 'trt' => 'UPD'
%end
</div>

View File

@@ -0,0 +1,74 @@
<div id='aws_list'>
%= form_for '/awstats' => (method => 'POST') => begin
%= submit_button l('aws_BUTTON_CONFIGURE'), class => 'action'
%= hidden_field 'trt' => 'CNF'
<p>
% if ( $aws_datas->{status} ne 'enabled' ) {
<h4><%= $c->l('aws_DISABLED') %></h4>
% if ($aws_datas->{username} eq 'admin' and $aws_datas->{mailstatus} eq 'enabled') {
<br>No WEB stats but <b>MAIL stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'> Here...</a><br>
% }
% if ($aws_datas->{username} eq 'admin' and $aws_datas->{ftpstatus} eq 'enabled') {
<br>No WEB stats but <b>FTP stats</b> are available -> <a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'> Here...</a><br>
% }
% } else {
<h2><%= $c->l('aws_DOMAINS_TITLE') %></h2>
%=l 'aws_STATS_NOTE'
<table class="sme-border"><tbody>
<tr><th class='sme-border'>
%=l 'DOMAIN_NAME'
</th><th class='sme-border'>
%=l 'DESCRIPTION_BRIEF'
</th><th class='sme-border'>
%=l 'aws_CONTENT'
</th><th class='sme-border'>AWStats</th>
<th class='sme-border'>
%=l 'aws_LABEL_STATUS'
</th></tr>
% foreach my $domain ( @$domains ) {
<tr>
%= t td => (class => 'sme-border') => $domain->{Domain}
%= t td => (class => 'sme-border') => $domain->{'Description'}
%= t td => (class => 'sme-border') => $domain->{'Content'}
% my $actionShow = l("$domain->{AWStats}");
% if ( $domain->{AWStats} eq 'Show' ) {
% $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=" . $domain->{Domain} . "'>" . l("$domain->{AWStats}") . "</a>";
% }
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => $domain->{'Status'}
</tr>
% }
% if ( $aws_datas->{mailstatus} eq 'enabled' ) {
<tr>
%= t td => (class => 'sme-border') => 'mail'
%= t td => (class => 'sme-border') => 'Qmail stats'
%= t td => (class => 'sme-border') => ''
% my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=mail'>Show...</a>";
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => 'active'
</tr>
% }
% if ( $aws_datas->{ftpstatus} eq 'enabled' ) {
<tr>
%= t td => (class => 'sme-border') => 'ftp'
%= t td => (class => 'sme-border') => 'Ftp stats'
%= t td => (class => 'sme-border') => ''
% my $actionShow = "<a href='awstats2?CsrfDef=TOKEN&trt=SHW&Domain=ftp'>Show...</a>";
<td class='sme-border'><%= $c->render_to_string(inline => $actionShow) %></td>
%= t td => (class => 'sme-border') => 'active'
</tr>
% }
</tbody></table>
</p>
%}
% if ( $aws_datas->{logres} ) {
<p>Web stats: <%= $c->render_to_string(inline => $aws_datas->{logres}) %></p>
%}
<p><%= $c->l( 'aws_COPYRIGHT') %></p>
% end
</div>

View File

@@ -0,0 +1,4 @@
<div id='aws_shw'>
%= $c->render_to_string(inline => $modul)
%=l 'aws_COPYRIGHT'
</div>