ONO::Apps::Admin::Screen::Info::Logfiles

package ONO::Apps::Admin::Screen::Info::Logfiles;
################################################################################
# COPYRIGHT / LICENSE #
################################################################################
#
# This file is part of the ONO Software Project.
#
# Copyright (C) 2000-2025 Jos KIRPS [ www.kirps.com | jos_AT_kirps_DOT_com ]
# and The Joopita Project [ www.joopita.org | contact_AT_joopita_DOT_com ]
#
# This file, as well as other parts of the ONO Software Project or related
# elements, are FREE SOFTWARE available under the ARTISTIC LICENSE 2.0.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# For the full license, see /ono/osr/license/LICENSE.txt, or write to
# jos_AT_kirps_DOT_com or contact_AT_joopita_DOT_com.
#
################################################################################
# END OF COPYRIGHT / LICENSE, HERE COMES THE CODE ... #
################################################################################


use strict;

use ONO::ToolBox::LogfileReader;

###############################################################################
# ONO
###############################################################################

sub screen {

my (
$self,
$db,
$community,
$lang,
$BLK_ref,
$vars_ref,
$sql_ref,
$ono_ref,
) = @_;

#: The ONO Admin logfile reader screen.

my %BLK = %$BLK_ref;
my %vars = %$vars_ref;

my ($TITLE,$SUBTITLE,$SCREEN,$LEFT,$RIGHT,$TOOLS);

$TITLE = "Logfiles";
$SUBTITLE = "";

if (!$vars{'logfile'}) {
$vars{'logfile'} = "ono";
}

my %but;
$but{$vars{'logfile'}} = "_dark";

$SCREEN = qq~<div class="inline w100 mb10">
<a href="/ono/admin/?/info_logfiles/" class="button$but{'ono'} button_left fl">ONO Log</a>
<a href="/ono/admin/?/info_logfiles/&logfile=access_log" class="button$but{'access_log'} button_middle fl">Webserver Log</a>
<a href="/ono/admin/?/info_logfiles/&logfile=error_log" class="button$but{'error_log'} button_middle fl">Webserver Errors</a>
<a href="/ono/admin/?/network_monitor/" class="button button_right fl">Website Monitoring</a>
</div>
~;

if ($vars{'logfile'} =~ /^(ono|access_log|error_log)$/) {

$SCREEN .= ONO::ToolBox::LogfileReader->reader(
$vars{'logfile'},
"/ono/admin/?/info_logfiles/&logfile=$vars{'logfile'}",
qq~$vars{'form'}<input type="hidden" name="mode" value="info_logfiles"><input type="hidden" name="logfile" value="$vars{'logfile'}"~,
$vars_ref,
$BLK_ref,
"",
);

}

return ($TITLE,$SUBTITLE,$SCREEN,$LEFT,$RIGHT,$TOOLS);

}

###############################################################################
# end of script
###############################################################################

1;

__END__