From: eldy <>
Date: Fri, 12 Sep 2003 14:23:21 +0000 (+0000)
Subject: Enhance the 'Extra' feature with parameters ExtraSectionFirstColumnFormatX, ExtraSect...
X-Git-Tag: AWSTATS_WEBMIN_1_0_RELEASE~13
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48461269b2fea129e599af64c088698a42d53c11;p=thirdparty%2FAWStats.git
Enhance the 'Extra' feature with parameters ExtraSectionFirstColumnFormatX, ExtraSectionAddAverageRowX, ExtraSectionAddSumRowX. Also add a dedicated page in documentation.
---
diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt
index 649e7e96..6d30c61d 100644
--- a/docs/awstats_changelog.txt
+++ b/docs/awstats_changelog.txt
@@ -21,6 +21,9 @@ Fixes:
- Fixed not working file type detection for default pages.
New features/improvements:
+- Enhance the 'Extra' feature with parameters ExtraSectionFirstColumnFormatX,
+ ExtraSectionAddAverageRowX, ExtraSectionAddSumRowX.
+ Also add a dedicated page in documentation.
- Added %lognamequot tag for LogFormat parameter.
- Added OnlyUserAgents parameter.
- Added awredir.pl tool.
diff --git a/docs/awstats_config.html b/docs/awstats_config.html
index 8d8590f1..822c4242 100644
--- a/docs/awstats_config.html
+++ b/docs/awstats_config.html
@@ -1535,7 +1535,9 @@ color_u,color_v,color_p,color_h,color_k,color_s
Extra...
-Version : 5.2+
+Version :
+5.2+
+5.8 for ExtraSectionFirstColumnFormatX, ExtraSectionAddAverageRowX, ExtraSectionAddSumRowX
# You can define your own charts, you choose here what are rows and columns
# keys. This feature is particularly usefull for marketing purpose, tracking
# products orders for example.
@@ -1556,8 +1558,11 @@ color_u,color_v,color_p,color_h,color_k,color_s
# extract the value used for first column. Each different value found will
# be a different row. Be sure that list of different values is "limited" to
# avoid "not enough memory" problems !
+
# ExtraSectionFirstColumnFormatX is the string used to write value.
# ExtraSectionStatTypesX are things you want to count. You can use standard
# code letters (P for pages,H for hits,B for bandwidth,L for last access).
+
# ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
+
# ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
# MaxNbOfExtraX is maximum number of rows shown in chart.
# MinHitExtraX is minimum number of hits required to be shown in chart.
#
@@ -1567,7 +1572,10 @@ color_u,color_v,color_p,color_h,color_k,color_s
ExtraSectionCondition1="URL,/cgi-bin/order.cgi"
ExtraSectionFirstColumnTitle1="Product ID"
ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
+
ExtraSectionFirstColumnFormat1="%s"
ExtraSectionStatTypes1=PL
+
ExtraSectionAddAverageRow1=0
+
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=20
MinHitExtra1=1
diff --git a/docs/awstats_extra.html b/docs/awstats_extra.html
index 0f2e066b..8fd02152 100644
--- a/docs/awstats_extra.html
+++ b/docs/awstats_extra.html
@@ -58,8 +58,11 @@ user or agent, etc...
extract the value used for first column. Each different value found will
be a different row. Be sure that list of different values is "limited" to
avoid "not enough memory" problems !
+
ExtraSectionFirstColumnFormatX is the string used to write value.
ExtraSectionStatTypesX are things you want to count. You can use standard
code letters (P for pages,H for hits,B for bandwidth,L for last access).
+
ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
+
ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
MaxNbOfExtraX is maximum number of rows shown in chart.
MinHitExtraX is minimum number of hits required to be shown in chart.
@@ -81,7 +84,10 @@ ExtraSectionName1="Product orders"
ExtraSectionCondition1="URL,/cgi-bin/order.cgi"
ExtraSectionFirstColumnTitle1="Product ID"
ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
+ExtraSectionFirstColumnFormat1="%s"
ExtraSectionStatTypes1=PL
+ExtraSectionAddAverageRow1=0
+ExtraSectionAddSumRow1=1
MaxNbOfExtra1=100
MinHitExtra1=1
@@ -96,7 +102,10 @@ ExtraSectionName1="Bugzilla: Most frequently viewed bugs"
ExtraSectionCondition1="URL,/bugzilla/show_bug.cgi"
ExtraSectionFirstColumnTitle1="Bug ID"
ExtraSectionFirstColumnValues1="QUERY_STRING,id=([^&]+)"
+ExtraSectionFirstColumnFormat1="%s"
ExtraSectionStatTypes1=PL
+ExtraSectionAddAverageRow=0
+ExtraSectionAddSumRow=1
MaxNbOfExtra1=10
MinHitExtra1=1
diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf
index 42e64d1a..17081a26 100644
--- a/wwwroot/cgi-bin/awstats.model.conf
+++ b/wwwroot/cgi-bin/awstats.model.conf
@@ -1192,8 +1192,11 @@ color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2
# extract the value used for first column. Each different value found will
# be a different row. Be sure that list of different values is "limited" to
# avoid "not enough memory" problems !
+# ExtraSectionFirstColumnFormatX is the string used to write value.
# ExtraSectionStatTypesX are things you want to count. You can use standard
# code letters (P for pages,H for hits,B for bandwidth,L for last access).
+# ExtraSectionAddAverageRowX add a row at bottom of chart with average values.
+# ExtraSectionAddSumRowX add a row at bottom of chart with sum values.
# MaxNbOfExtraX is maximum number of rows shown in chart.
# MinHitExtraX is minimum number of hits required to be shown in chart.
#
@@ -1203,7 +1206,10 @@ color_x="C1B2E2" # Background color for number of exit pages (Default = "C1B2
#ExtraSectionCondition1="URL,/cgi-bin/order.cgi"
#ExtraSectionFirstColumnTitle1="Product ID"
#ExtraSectionFirstColumnValues1="QUERY_STRING,productid=([^&]+)"
+#ExtraSectionFirstColumnFormat1="%s"
#ExtraSectionStatTypes1=PL
+#ExtraSectionAddAverageRow1=0
+#ExtraSectionAddSumRow1=1
#MaxNbOfExtra1=20
#MinHitExtra1=1
diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl
index 37046185..fbb0008a 100644
--- a/wwwroot/cgi-bin/awstats.pl
+++ b/wwwroot/cgi-bin/awstats.pl
@@ -216,9 +216,10 @@ use vars qw/
@OnlyHosts @OnlyUserAgents @OnlyFiles
@URLWithQueryWithoutFollowingParameters
@ExtraName @ExtraCondition @ExtraStatTypes @MaxNbOfExtra @MinHitExtra
-@ExtraFirstColumnTitle @ExtraFirstColumnValues
+@ExtraFirstColumnTitle @ExtraFirstColumnValues @ExtraFirstColumnFormat
@ExtraConditionType @ExtraConditionTypeVal
@ExtraFirstColumnValuesType @ExtraFirstColumnValuesTypeVal
+@ExtraAddAverageRow @ExtraAddSumRow
@PluginsToLoad
/;
@MiscListOrder=('AddToFavourites','JavaEnabled','DirectorSupport','FlashSupport','RealPlayerSupport','QuickTimeSupport','WindowsMediaPlayerSupport','PDFSupport');
@@ -239,9 +240,10 @@ use vars qw/
@OnlyHosts = @OnlyUserAgents = @OnlyFiles = ();
@URLWithQueryWithoutFollowingParameters = ();
@ExtraName = @ExtraCondition = @ExtraStatTypes = @MaxNbOfExtra = @MinHitExtra = ();
-@ExtraFirstColumnTitle = @ExtraFirstColumnValues = ();
+@ExtraFirstColumnTitle = @ExtraFirstColumnValues = @ExtraFirstColumnFormat = ();
@ExtraConditionType = @ExtraConditionTypeVal = ();
@ExtraFirstColumnValuesType = @ExtraFirstColumnValuesTypeVal = ();
+@ExtraAddAverageRow = @ExtraAddSumRow = ();
@PluginsToLoad = ();
# ---------- Init hash arrays --------
use vars qw/
@@ -1272,6 +1274,9 @@ sub Parse_Config {
if ($param =~ /^ExtraSectionStatTypes(\d+)/) { $ExtraStatTypes[$1]=$value; next; }
if ($param =~ /^ExtraSectionFirstColumnTitle(\d+)/) { $ExtraFirstColumnTitle[$1]=$value; next; }
if ($param =~ /^ExtraSectionFirstColumnValues(\d+)/) { $ExtraFirstColumnValues[$1]=$value; next; }
+ if ($param =~ /^ExtraSectionFirstColumnFormat(\d+)/) { $ExtraFirstColumnFormat[$1]=$value; next; }
+ if ($param =~ /^ExtraSectionAddAverageRow(\d+)/) { $ExtraAddAverageRow[$1]=$value; next; }
+ if ($param =~ /^ExtraSectionAddSumRow(\d+)/) { $ExtraAddSumRow[$1]=$value; next; }
if ($param =~ /^MaxNbOfExtra(\d+)/) { $MaxNbOfExtra[$1]=$value; next; }
if ($param =~ /^MinHitExtra(\d+)/) { $MinHitExtra[$1]=$value; next; }
# Special appearance parameters
@@ -1541,6 +1546,7 @@ sub Check_Config {
if ($MaxNbOfExtra[$extracpt] !~ /^\d+$/ || $MaxNbOfExtra[$extracpt]<1) { $MaxNbOfExtra[$extracpt]=20; }
if ($MinHitExtra[$extracpt] !~ /^\d+$/ || $MinHitExtra[$extracpt]<1) { $MinHitExtra[$extracpt]=1; }
if (! $ExtraFirstColumnValues[$extracpt]) { error("Extra section number $extracpt is defined without ExtraSectionFirstColumnValues$extracpt parameter"); }
+ if (! $ExtraFirstColumnFormat[$extracpt]) { $ExtraFirstColumnFormat[$extracpt] = '%s'; }
}
# Optional appearance setup section
if ($MaxRowsInHTMLOutput !~ /^\d+/ || $MaxRowsInHTMLOutput<1) { $MaxRowsInHTMLOutput=1000; }
@@ -5816,7 +5822,6 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat
my $PageBool=1;
my $extension;
# Extension
-print "xxx $urlwithnoquery yyy $DefaultFile[0] zzz";
if ($urlwithnoquery =~ /\.(\w{1,6})$/ || ($urlwithnoquery =~ /[\\\/]$/ && $DefaultFile[0] =~ /\.(\w{1,6})$/)) {
$extension=lc($1);
if ($NotPageList{$extension}) { $PageBool=0; }
@@ -9209,7 +9214,8 @@ if (scalar keys %HTMLOutput) {
print "$Center
";
my $title=$ExtraName[$extranum];
&tab_head("$title",19);
- print "| ".$ExtraFirstColumnTitle[$extranum]." | ";
+ print "
|---|
";
+ print "| ".$ExtraFirstColumnTitle[$extranum]." | ";
if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "$Message[56] | "; }
if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "$Message[57] | "; }
if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "$Message[75] | "; }
@@ -9227,7 +9233,11 @@ if (scalar keys %HTMLOutput) {
}
foreach my $key (@keylist) {
my $firstcol = CleanFromCSSA(DecodeEncodedString($key));
- print "
| $firstcol | ";
+ $total_p+=${'_section_' . $extranum . '_p'}{$key};
+ $total_h+=${'_section_' . $extranum . '_h'}{$key};
+ $total_k+=${'_section_' . $extranum . '_k'}{$key};
+ print "
";
+ printf("| $ExtraFirstColumnFormat[$extranum] | ", $firstcol, $firstcol, $firstcol, $firstcol, $firstcol);
if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "" . ${'_section_' . $extranum . '_p'}{$key} . " | "; }
if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "" . ${'_section_' . $extranum . '_h'}{$key} . " | "; }
if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "" . Format_Bytes(${'_section_' . $extranum . '_k'}{$key}) . " | "; }
@@ -9235,6 +9245,24 @@ if (scalar keys %HTMLOutput) {
print "
\n";
$count++;
}
+ if ($ExtraAddAverageRow[$extranum]) {
+ print "";
+ print "| $Message[96] | ";
+ if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "" . ($total_p/$count) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "" . ($total_h/$count) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "" . Format_Bytes(($total_k/$count)) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/L/i) { print " | "; }
+ print "
\n";
+ }
+ if ($ExtraAddSumRow[$extranum]) {
+ print "";
+ print "| $Message[102] | ";
+ if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "" . ($total_p) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "" . ($total_h) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "" . Format_Bytes($total_k) . " | "; }
+ if ($ExtraStatTypes[$extranum] =~ m/L/i) { print " | "; }
+ print "
\n";
+ }
&tab_end;
}