ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl view on Meta::CPAN
my $startTime = timelocal($currentSec, $currentMin, $currentHour, $currentDay, $localMonth, $localYear);
my $endDate;
# URL Access Parameters
my $cgi = new CGI;
my $pagedir = (defined $cgi->param('pagedir')) ? $cgi->param('pagedir') : 'index'; $pagedir =~ s/\+/ /g;
my $pageset = (defined $cgi->param('pageset')) ? $cgi->param('pageset') : 'index-cv'; $pageset =~ s/\+/ /g;
my $debug = (defined $cgi->param('debug')) ? $cgi->param('debug') : 'F';
my $selDetailed = (defined $cgi->param('detailed')) ? $cgi->param('detailed') : 'on';
my $CcatalogID = (defined $cgi->param('catalogID')) ? $cgi->param('catalogID') : $CATALOGID;
my $CcatalogIDreload = (defined $cgi->param('catalogIDreload')) ? $cgi->param('catalogIDreload') : 0;
my $uKey1 = (defined $cgi->param('uKey1')) ? $cgi->param('uKey1') : 'none';
my $uKey2 = (defined $cgi->param('uKey2')) ? $cgi->param('uKey2') : 'none';
my $uKey3 = (defined $cgi->param('uKey3')) ? $cgi->param('uKey3') : 'none';
my $startDate = (defined $cgi->param('startDate')) ? $cgi->param('startDate') : "$currentYear-$currentMonth-$currentDay";
my $inputType = (defined $cgi->param('inputType')) ? $cgi->param('inputType') : 'fromto';
my $selYear = (defined $cgi->param('year')) ? $cgi->param('year') : 0;
my $selWeek = (defined $cgi->param('week')) ? $cgi->param('week') : 0;
my $selMonth = (defined $cgi->param('month')) ? $cgi->param('month') : 0;
my $selQuarter = (defined $cgi->param('quarter')) ? $cgi->param('quarter') : 0;
my $timeperiodID = (defined $cgi->param('timeperiodID')) ? $cgi->param('timeperiodID') : 1;
my $statuspie = (defined $cgi->param('statuspie')) ? $cgi->param('statuspie') : 'off';
my $errorpie = (defined $cgi->param('errorpie')) ? $cgi->param('errorpie') : 'off';
my $bar = (defined $cgi->param('bar')) ? $cgi->param('bar') : 'off';
my $hourlyAvg = (defined $cgi->param('hourlyAvg')) ? $cgi->param('hourlyAvg') : 'off';
my $dailyAvg = (defined $cgi->param('dailyAvg')) ? $cgi->param('dailyAvg') : 'off';
my $details = (defined $cgi->param('details')) ? $cgi->param('details') : 'off';
my $comments = (defined $cgi->param('comments')) ? $cgi->param('comments') : 'off';
my $perfdata = (defined $cgi->param('perfdata')) ? $cgi->param('perfdata') : 'off';
my $topx = (defined $cgi->param('topx')) ? $cgi->param('topx') : 'off';
my $pf = (defined $cgi->param('pf')) ? $cgi->param('pf') : 'off';
my $formatOutput = (defined $cgi->param('formatOutput')) ? $cgi->param('formatOutput') : 'html';
my $htmlToPdf = (defined $cgi->param('htmlToPdf')) ? $cgi->param('htmlToPdf') : 0;
my ($pageDir, $environment) = split (/\//, $pagedir, 2);
$environment = 'P' unless (defined $environment);
if ( defined $cgi->param('endDate') and $cgi->param('endDate') ) { $endDate = $cgi->param('endDate'); } else { $endDate = ''; }
my $htmlTitle = ( ( $selDetailed eq 'on' ) ? 'Detailed Statistics and Report Generation' : 'Compare Response Time Trends' );
# User Session and Access Control
my ($sessionID, $iconAdd, $iconDelete, $iconDetails, $iconEdit, $iconQuery, $iconTable, $errorUserAccessControl, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $subTitle) = user_session_and_access_control (1, 'guest', $c...
# Serialize the URL Access Parameters into a string
my $urlAccessParameters = "pagedir=$pagedir&pageset=$pageset&debug=$debug&CGISESSID=$sessionID&detailed=$selDetailed&catalogID=$CcatalogID&catalogIDreload=$CcatalogIDreload&uKey1=$uKey1&uKey2=$uKey2&uKey3=$uKey3&startDate=$startDate&endDate=$endDate&...
# Debug information
print "<pre>pagedir : $pagedir<br>pageset : $pageset<br>debug : $debug<br>CGISESSID : $sessionID<br>detailed : $selDetailed<br>catalog ID : $CcatalogID<br>catalog ID reload : $CcatalogIDreload<br>uKey1 : $uKey1<br>uKey2 ...
unless ( defined $errorUserAccessControl ) {
if ( $formatOutput eq 'pdf' and ! $htmlToPdf ) {
my $url = "$HTTPSURL/cgi-bin/htmlToPdf.pl?HTMLtoPDFprg=$HTMLTOPDFPRG&HTMLtoPDFhow=$HTMLTOPDFHOW&scriptname=". $ENV{SCRIPT_NAME} ."&". encode_html_entities('U', $urlAccessParameters);
print <<EndOfHtml;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>$htmlTitle</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="refresh" content="1;url=$url">
<link rel="stylesheet" type="text/css" href="$HTTPSURL/asnmtap.css">
</head>
<BODY>
</BODY>
</HTML>
EndOfHtml
exit;
}
my ($rv, $dbh, $sth, $uKey, $sqlQuery, $sqlSelect, $sqlAverage, $sqlInfo, $sqlErrors, $sqlWhere, $sqlPeriode);
my ($printerFriendlyOutputBox, $formatOutputSelect, $catalogIDSelect, $uKeySelect1, $uKeySelect2, $uKeySelect3, $images);
my ($subtime, $endTime, $duration, $seconden, $status, $statusMessage, $title, $Title, $shortDescription, $rest, $dummy, $count);
my ($averageQ, $numbersOfTestsQ, $startDateQ, $stepQ, $endDateQ, $errorMessage, $chartOrTableChecked);
my ($checkbox, $tables, $shortDescriptionTextArea, $infoTable, $topxTable, $errorList, $errorDetailList, $commentDetailList, $perfdataDetailList, $responseTable, $goodDate);
my ($fromto, $years, $weeks, $months, $quarters, $slaWindows, $selectedYear, $selectedWeek, $selectedMonth, $selectedQuarter, $slaWindow, $i);
my @arrMonths = qw(January Februari March April May June July August September October November December);
# open connection to database and query data
$rv = 1;
$dbh = DBI->connect("dbi:mysql:$DATABASE:$SERVERNAMEREADONLY:$SERVERPORTREADONLY", "$SERVERUSERREADONLY", "$SERVERPASSREADONLY" ) or $rv = error_trap_DBI(*STDOUT, "Cannot connect to the database", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, ...
if ( $dbh and $rv ) {
$uKey1 = $uKey2 = $uKey3 = 'none' if ( $CcatalogIDreload );
$sqlQuery = "select catalogID, catalogName from $SERVERTABLCATALOG where not catalogID = '$CATALOGID' and activated = '1' order by catalogName asc";
($rv, $catalogIDSelect, undef) = create_combobox_from_DBI ($rv, $dbh, $sqlQuery, 1, '', $CcatalogID, 'catalogID', $CATALOGID, '-Parent-', '', 'onChange="javascript:submitForm();"', $pagedir, $pageset, $htmlTitle, $subTitle, $sessionID, $debug);
$sqlQuery = "select uKey, concat( LTRIM(SUBSTRING_INDEX(title, ']', -1)), ' (', $SERVERTABLENVIRONMENT.label, ')' ) as optionValueTitle from $SERVERTABLPLUGINS, $SERVERTABLENVIRONMENT where $SERVERTABLPLUGINS.catalogID = '$CcatalogID' and $SERVER...
$sth = $dbh->prepare( $sqlQuery ) or $rv = error_trap_DBI(*STDOUT, "Cannot dbh->prepare: $sqlQuery", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
$sth->execute() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->execute: $sqlQuery", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
$sth->bind_columns( \$uKey, \$title) or $rv = error_trap_DBI(*STDOUT, "Cannot sth->bind_columns: $sqlQuery", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID) if $rv;
if ( $rv ) {
$dummy = ($uKey1 eq 'none') ? " selected" : '';
$uKeySelect1 = " <option value=\"none\"$dummy>-Select-</option>\n";
$dummy = ($uKey2 eq 'none') ? " selected" : '';
$uKeySelect2 .= " <option value=\"none\"$dummy>-Select-</option>\n";
$dummy = ($uKey3 eq 'none') ? " selected" : '';
$uKeySelect3 .= " <option value=\"none\"$dummy>-Select-</option>\n";
while( $sth->fetch() ) {
if ($uKey eq $uKey1 and $selDetailed eq 'on') {
$htmlTitle = "Results for $title from $CcatalogID";
$Title = "$title from $CcatalogID";
}
$dummy = ($uKey eq $uKey1) ? " selected" : '';
$uKeySelect1 .= " <option value=\"$uKey\"$dummy>$title</option>\n";
$dummy = ($uKey eq $uKey2) ? " selected" : '';
$uKeySelect2 .= " <option value=\"$uKey\"$dummy>$title</option>\n";
$dummy = ($uKey eq $uKey3) ? " selected" : '';
$uKeySelect3 .= " <option value=\"$uKey\"$dummy>$title</option>\n";
}
$sth->finish() or $rv = error_trap_DBI(*STDOUT, "Cannot sth->finish", $debug, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', $sessionID);
if ($htmlToPdf) {
print <<EndOfHtml;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>$htmlTitle</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="$HTTPSURL/asnmtap.css">
</head>
<BODY TEXT="#000000">
EndOfHtml
} else {
print_header (*STDOUT, $pagedir, $pageset, $htmlTitle, $subTitle, 3600, '', 'F', "<script type=\"text/javascript\" language=\"JavaScript\" src=\"$HTTPSURL/AnchorPosition.js\"></script>\n <script type=\"text/javascript\" language=\"JavaScript...
}
# Section: FromTo
$dummy = ($inputType eq "fromto") ? ' checked' : '';
$fromto = "<input type=\"radio\" name=\"inputType\" value=\"fromto\"$dummy>From:";
# Section: Years
$dummy = ($inputType eq "year") ? ' checked' : '';
$years = "<input type=\"radio\" name=\"inputType\" value=\"year\"$dummy>Year:</td><td>\n";
$years .= " <select name=\"year\">\n";
($selectedWeek, $selectedYear) = Week_of_Year( $currentYear, $currentMonth, $currentDay );
$selectedYear = $selYear if ($selYear != 0);
my ($firstSelectedYear, undef, undef) = split (/-/, $FIRSTSTARTDATE);
for ($i = $firstSelectedYear; $i <= $currentYear; $i++) {
$dummy = ($i == $selectedYear) ? " selected" : '';
$years .= " <option value=\"". $i ."\"$dummy>". $i ."</option>\n";
}
$years .= " </select>";
# Section: Weeks
$dummy = ($inputType eq "week") ? ' checked' : '';
$weeks = "<input type=\"radio\" name=\"inputType\" value=\"week\"$dummy>Week:</td><td>";
$weeks .= " <select name=\"week\">\n";
$selectedWeek = $selWeek if ($selWeek != 0);
for ($i = 1; $i <= 53; $i++) {
$dummy = ($i == $selectedWeek) ? " selected" : '';
$weeks .= " <option value=\"". $i ."\"$dummy>". $i ."</option>\n";
}
$weeks .= " </select>\n";
# Section: Months
$dummy = ($inputType eq "month") ? ' checked' : '';
$months = "<input type=\"radio\" name=\"inputType\" value=\"month\"$dummy>Month:</td><td>\n";
$months .= " <select name=\"month\">\n";
$selectedMonth = ($selMonth == 0) ? $localMonth : $selMonth - 1;
for ($i = 0; $i < 12; $i++) {
$dummy = ($i == $selectedMonth) ? " selected" : '';
$months .= " <option value=\"". ($i+1) ."\"$dummy>". $arrMonths[$i] ."</option>\n";
}
$months .= " </select>\n";
# Section: Quarters
$dummy = ($inputType eq "quarter") ? ' checked' : '';
$quarters = "<input type=\"radio\" name=\"inputType\" value=\"quarter\"$dummy>Quarter:</td><td>\n";
$quarters .= " <select name=\"quarter\">\n";
$selectedQuarter = ($selQuarter == 0) ? (int (($localMonth + 2) / 3)) : $selQuarter;
for ($i = 1; $i <= 4; $i++) {
( run in 0.841 second using v1.01-cache-2.11-cpan-d8267643d1d )