From: eldy <> Date: Fri, 20 Sep 2002 12:42:04 +0000 (+0000) Subject: Added a link to data arrays for values of month and day chart. X-Git-Tag: AWSTATS_5_0_BETA~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=929cc8cf6dc7d833daf5a70248dcaeadb0bb7cc0;p=thirdparty%2FAWStats.git Added a link to data arrays for values of month and day chart. --- diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 9f356526..498720ac 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -1518,7 +1518,7 @@ sub Read_History_With_TmpUpdate { $SectionsToLoad{"general"}=1; $SectionsToLoad{"time"}=2; if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "allhosts" || $HTMLOutput eq "lasthosts" || $HTMLOutput eq "unknownip") { $SectionsToLoad{"visitor"}=3; } # before day, sider and session section - if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "days") { $SectionsToLoad{"day"}=4; } + if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "days" || $HTMLOutput eq 'monthdayvalues') { $SectionsToLoad{'day'}=4; } if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "alllogins" || $HTMLOutput eq "lastlogins") { $SectionsToLoad{"login"}=5; } if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "domains") { $SectionsToLoad{"domain"}=6; } if ($UpdateStats || $MigrateStats || $HTMLOutput eq "main" || $HTMLOutput eq "sessions") { $SectionsToLoad{"session"}=7; } @@ -3252,14 +3252,17 @@ sub Format_Bytes { #-------------------------------------------------------------------- # Function: Format a date according to Message[78] (country date format) -# Parameters: bytes -# Input: None +# Parameters: String date YYYYMMDDHHMMSS +# Option 0=LastUpdate and LastTime date +# 1=Arrays date except daymonthvalues +# 2=daymonthvalues date (only year month and day) +# Input: $Message[78] # Output: None -# Return: String YYYYMMDDHHMMSS +# Return: Date with format defined by Message[78] and option #-------------------------------------------------------------------- sub Format_Date { my $date=shift; - my $option=shift; + my $option=shift||0; my $year=substr("$date",0,4); my $month=substr("$date",4,2); my $day=substr("$date",6,2); @@ -3267,6 +3270,10 @@ sub Format_Date { my $min=substr("$date",10,2); my $sec=substr("$date",12,2); my $dateformat=$Message[78]; + if ($option == 2) { + $dateformat =~ s/^[^ymd]+//g; + $dateformat =~ s/[^ymd]+$//g; + } $dateformat =~ s/yyyy/$year/g; $dateformat =~ s/yy/$year/g; $dateformat =~ s/mmm/$MonthLib{$month}/g; @@ -4808,8 +4815,6 @@ if ($UpdateStats && $FrameName ne "index" && $FrameName ne "mainleft") { # Updat # Every 20,000 approved lines we test to clean too large hash arrays to flush data in tmp file if ($counter++ >= 20000) { if ((scalar keys %_host_u) > $LIMITFLUSH || (scalar keys %_url_p) > $LIMITFLUSH) { -# if ($counter++ >= 400) { -# if ((scalar keys %_host_u) > 1 || (scalar keys %_url_p) > 1) { # warning("Warning: Try to run AWStats update process more frequently to analyze smaller log files."); if ($Debug) { debug("End of set of ".($counter-1)." records: Some hash arrays are too large. We clean some.",2); @@ -4975,19 +4980,18 @@ if ($HTMLOutput) { EOF - + # READING DATA #------------- - &Init_HashArray(); # Loop on each month of year for (my $ix=12; $ix>=1; $ix--) { my $monthix=sprintf("%02s",$ix); if ($MonthRequired eq "year" || $monthix eq $MonthRequired) { - &Read_History_With_TmpUpdate($YearRequired,$monthix,0,0,"all"); # Read full history file + &Read_History_With_TmpUpdate($YearRequired,$monthix,0,0,"all"); # Read full history file } - elsif ($HTMLOutput eq "main" && $ShowMonthDayStats) { + elsif (($HTMLOutput eq "main" && $ShowMonthDayStats) || $HTMLOutput eq "monthdayvalues") { &Read_History_With_TmpUpdate($YearRequired,$monthix,0,0,"general time"); # Read general and time sections. } } @@ -5191,6 +5195,7 @@ EOF if (!$TotalDifferentSearchEngines) { $TotalDifferentSearchEngines=scalar keys %_se_referrals_h; } # TotalDifferentRefererPages (if not already specifically counted, we init it from _pagesrefs_h hash table) if (!$TotalDifferentRefererPages) { $TotalDifferentRefererPages=scalar keys %_pagesrefs_h; } + # Define firstdaytocountaverage, lastdaytocountaverage, firstdaytoshowtime, lastdaytoshowtime my $firstdaytocountaverage=$nowyear.$nowmonth."01"; # Set day cursor to 1st day of month my $firstdaytoshowtime=$nowyear.$nowmonth."01"; # Set day cursor to 1st day of month @@ -5222,11 +5227,8 @@ EOF if ($HTMLOutput eq "monthdayvalues") { if ($Debug) { debug("ShowMonthDayStats",2); } print "$Center 
\n"; - &tab_head("$Message[7] $SiteDomain",0); - print "$Message[8]"; - if ($MonthRequired eq "year") { print "$Message[6] $YearRequired
"; } - else { print "$Message[5] $MonthLib{$MonthRequired} $YearRequired
"; } - # Show links for possible years + &tab_head("$Message[5]",0); + my $NewLinkParams=${QueryString}; $NewLinkParams =~ s/update(=\w*|$|[ &]+)//i; $NewLinkParams =~ s/staticlinks(=\w*|$|[ &]+)//i; @@ -5238,43 +5240,10 @@ EOF my $NewLinkTarget=""; if ($FrameName eq "mainright") { $NewLinkTarget=" target=_parent"; } - foreach my $key (sort keys %ListOfYears) { - if ($ENV{"GATEWAY_INTERFACE"} || !$StaticLinks) { - print "$Message[6] $key   "; - } - } - print ""; - print "$Message[9]\n"; - - # Ratio - my $RatioVisits=0; my $RatioPages=0; my $RatioHits=0; my $RatioBytes=0; - if ($TotalUnique > 0) { $RatioVisits=int($TotalVisits/$TotalUnique*100)/100; } - if ($TotalVisits > 0) { $RatioPages=int($TotalPages/$TotalVisits*100)/100; } - if ($TotalVisits > 0) { $RatioHits=int($TotalHits/$TotalVisits*100)/100; } - if ($TotalVisits > 0) { $RatioBytes=int(($TotalBytes/1024)*100/$TotalVisits)/100; } - - if ($FirstTime) { print "".Format_Date($FirstTime,0).""; } - else { print "NA"; } - if ($LastTime) { print "".Format_Date($LastTime,0)."\n"; } - else { print "NA\n"; } - print ""; - print "$Message[11]"; - print "$Message[10]"; - print "$Message[56]"; - print "$Message[57]"; - print "$Message[75]"; - print "\n"; - print ""; - print "".($MonthRequired eq "year"?"<= $TotalUnique
$Message[129]":"$TotalUnique
 ").""; - print "$TotalVisits
($RatioVisits $Message[52])"; - print "$TotalPages
($RatioPages ".lc($Message[56]."/".$Message[12]).")"; - print "$TotalHits
($RatioHits ".lc($Message[57]."/".$Message[12]).")"; - print "".Format_Bytes(int($TotalBytes))."
($RatioBytes $Message[108]/".lc($Message[12]).")"; - print "\n"; - print ""; - # Show monthly stats + print ""; print "
"; + print ""; print ""; $max_v=$max_p=$max_h=$max_k=1; @@ -5304,6 +5273,7 @@ EOF print "\n"; } print "\n"; + # Show lib for month print ""; for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); @@ -5314,29 +5284,41 @@ EOF print "\n"; } print "\n"; - # Array of values -# print "\n"; -# print "\n"; -# print "\n"; -# print "\n"; -# print ""; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "\n"; } -# print "\n"; -# print ""; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "\n"; } -# print "\n"; -# print ""; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "\n"; } -# print "\n"; -# print ""; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "\n"; } -# print "\n"; -# print ""; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "\n"; } -# print "\n"; print "
$Message[11]$MonthUnique{$YearRequired.$monthix}
$Message[10]$MonthVisits{$YearRequired.$monthix}
$Message[56]$MonthPages{$YearRequired.$monthix}
$Message[57]$MonthHits{$YearRequired.$monthix}
$Message[57]$MonthBytes{$YearRequired.$monthix}
\n
\n"; - print ""; + # Show data array for month + print "\n"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + for (my $ix=1; $ix<=12; $ix++) { + my $monthix=($ix<10?"0$ix":"$ix"); + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + } + print "
$Message[5]$Message[11]$Message[10]$Message[56]$Message[57]$Message[75]
",$MonthLib{$monthix},"",$MonthUnique{$YearRequired.$monthix}?$MonthUnique{$YearRequired.$monthix}:"0","",$MonthVisits{$YearRequired.$monthix}?$MonthVisits{$YearRequired.$monthix}:"0","",$MonthPages{$YearRequired.$monthix}?$MonthPages{$YearRequired.$monthix}:"0","",$MonthHits{$YearRequired.$monthix}?$MonthHits{$YearRequired.$monthix}:"0","",Format_Bytes(int($MonthBytes{$YearRequired.$monthix})),"
\n
"; + + print "
\n"; + print "\n"; + &tab_end; + + print "
\n"; + + &tab_head("$Message[4]",0); + print ""; + print "
"; + + print ""; + print ""; # Get max_v, max_h and max_k values $max_v=$max_h=$max_k=0; # Start from 0 because can be lower than 1 foreach my $daycursor ($firstdaytoshowtime..$lastdaytoshowtime) { @@ -5392,9 +5374,8 @@ EOF print "\"$Message[75]:"; print "\n"; } - print ""; - # Show average values - print ""; + print "\n"; + print ""; + print "\n"; print "\n"; - - print ""; + # Show lib for days + print ""; foreach my $daycursor ($firstdaytoshowtime..$lastdaytoshowtime) { $daycursor =~ /^(\d\d\d\d)(\d\d)(\d\d)/; my $year=$1; my $month=$2; my $day=$3; @@ -5423,13 +5405,15 @@ EOF print ($day==$nowday && $month==$nowmonth && $year==$nowyear?"":""); print "\n"; } - print ""; + print ""; print "\n"; + print "\n"; print "\n"; print "
  "; + print " "; # Show average value cell my $bredde_v=0; my $bredde_p=0; my $bredde_h=0; my $bredde_k=0; if ($max_v > 0) { $bredde_v=int($avg_day_v/$max_v*$BarHeight/2)+1; } if ($max_h > 0) { $bredde_p=int($avg_day_p/$max_h*$BarHeight/2)+1; } @@ -5408,10 +5389,11 @@ EOF print "\"$Message[56]:"; print "\"$Message[57]:"; print "\"$Message[75]:"; - print "
   $Message[96]
\n
\n"; - print "\n"; - print ""; + # Show data array for days + print "
$Message[4]
\n"; + print ""; print ""; print ""; print ""; @@ -5437,18 +5421,16 @@ EOF foreach my $daycursor ($firstdaytoshowtime..$lastdaytoshowtime) { $daycursor =~ /^(\d\d\d\d)(\d\d)(\d\d)/; my $year=$1; my $month=$2; my $day=$3; - if ( $DayVisits{$year.$month.$day} > 0 ) { - print ""; - if (! DateIsValid($day,$month,$year)) { next; } # If not an existing day, go to next - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - } + if (! DateIsValid($day,$month,$year)) { next; } # If not an existing day, go to next + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; } - print "
$Message[4]$Message[10]$Message[56]$Message[57]
",$year,"/",$month,"/",$day,"",$DayVisits{$year.$month.$day},"",$DayPages{$year.$month.$day},"",$DayHits{$year.$month.$day},"",Format_Bytes(int($DayBytes{$year.$month.$day})),"
",Format_Date("$year$month$day"."000000",2),"",$DayVisits{$year.$month.$day}?$DayVisits{$year.$month.$day}:"0","",$DayPages{$year.$month.$day}?$DayPages{$year.$month.$day}:"0","",$DayHits{$year.$month.$day}?$DayHits{$year.$month.$day}:"0","",Format_Bytes(int($DayBytes{$year.$month.$day})),"
"; + print "\n
"; print "
\n"; print "\n"; @@ -6021,10 +6003,7 @@ EOF if ($Debug) { debug("ShowMonthDayStats",2); } print "$Center 
\n"; &tab_head("$Message[7] $SiteDomain",0); - print "$Message[8]"; - if ($MonthRequired eq "year") { print "$Message[6] $YearRequired
"; } - else { print "$Message[5] $MonthLib{$MonthRequired} $YearRequired
"; } - # Show links for possible years + my $NewLinkParams=${QueryString}; $NewLinkParams =~ s/update(=\w*|$|[ &]+)//i; $NewLinkParams =~ s/staticlinks(=\w*|$|[ &]+)//i; @@ -6036,14 +6015,6 @@ EOF my $NewLinkTarget=""; if ($FrameName eq "mainright") { $NewLinkTarget=" target=_parent"; } - foreach my $key (sort keys %ListOfYears) { - if ($ENV{"GATEWAY_INTERFACE"} || !$StaticLinks) { - print "$Message[6] $key   "; - } - } - print ""; - print "$Message[9]\n"; - # Ratio my $RatioVisits=0; my $RatioPages=0; my $RatioHits=0; my $RatioBytes=0; if ($TotalUnique > 0) { $RatioVisits=int($TotalVisits/$TotalUnique*100)/100; } @@ -6051,6 +6022,17 @@ EOF if ($TotalVisits > 0) { $RatioHits=int($TotalHits/$TotalVisits*100)/100; } if ($TotalVisits > 0) { $RatioBytes=int(($TotalBytes/1024)*100/$TotalVisits)/100; } + # Show range and links for possible years + print "$Message[8]"; + if ($MonthRequired eq "year") { print "$Message[6] $YearRequired
"; } + else { print "$Message[5] $MonthLib{$MonthRequired} $YearRequired
"; } + foreach my $key (sort keys %ListOfYears) { + if ($ENV{"GATEWAY_INTERFACE"} || !$StaticLinks) { + print "$Message[6] $key   "; + } + } + print ""; + print "$Message[9]\n"; if ($FirstTime) { print "".Format_Date($FirstTime,0).""; } else { print "NA"; } if ($LastTime) { print "".Format_Date($LastTime,0)."\n"; } @@ -6112,26 +6094,6 @@ EOF print "\n"; } print "\n"; - # Array of values -# print "\n"; -# print "\n"; -# print "\n"; -# print "\n"; -# print "$Message[11]"; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "$MonthUnique{$YearRequired.$monthix}\n"; } -# print "\n"; -# print "$Message[10]"; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "$MonthVisits{$YearRequired.$monthix}\n"; } -# print "\n"; -# print "$Message[56]"; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "$MonthPages{$YearRequired.$monthix}\n"; } -# print "\n"; -# print "$Message[57]"; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "$MonthHits{$YearRequired.$monthix}\n"; } -# print "\n"; -# print "$Message[57]"; -# for (my $ix=1; $ix<=12; $ix++) { my $monthix=($ix<10?"0$ix":"$ix"); print "$MonthBytes{$YearRequired.$monthix}\n"; } -# print "\n"; print "\n
\n"; # Show daily stats @@ -6228,7 +6190,8 @@ EOF print "\n"; print "\n
\n"; -# print "$Message[130]"; + # Show data arrays link + print "$Message[130]"; print "\n"; print "\n";