X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2Fstats.cgi;h=b68a5dd741bf05be5790ae879fc0eaacd2a62772;hb=16babf81ce331af378de565ba73e927ff5491f65;hp=9964f4a62ce57be147463d1db4164cf4e3903261;hpb=9f51fc95d361092058a17611614f31318a3fad0c;p=clearscm.git diff --git a/maps/bin/stats.cgi b/maps/bin/stats.cgi index 9964f4a..b68a5dd 100755 --- a/maps/bin/stats.cgi +++ b/maps/bin/stats.cgi @@ -2,9 +2,9 @@ ################################################################################ # # File: $RCSfile: stats.cgi,v $ -# Revision: $Revision: 1.1 $ +# Revision: $Revision: 1.1 $ # Description: This script produces a table of statistics of mail processed for -# the user. +# the user. # Author: Andrew@DeFaria.com # Created: Fri Nov 29 14:17:21 2002 # Modified: $Date: 2013/06/12 14:05:47 $ @@ -19,7 +19,7 @@ use warnings; use FindBin; $0 = $FindBin::Script; -use lib $FindBin::Bin; +use lib "$FindBin::Bin/../lib"; use MAPS; use MAPSLog; @@ -27,85 +27,85 @@ use MAPSUtil; use MAPSWeb; use CGI qw (:standard *table start_Tr end_Tr); -use CGI::Carp "fatalsToBrowser"; +use CGI::Carp 'fatalsToBrowser'; -my $nbr_days = param ("nbr_days"); -my $date = param ("date"); +my $nbr_days = param('nbr_days'); +my $date = param('date'); -my $table_name = "stats"; +my $table_name = 'stats'; $date = defined $date ? $date : Today2SQLDatetime; sub Body { - print start_table ({-align => "center", - -id => $table_name, - -border => 0, - -cellspacing => 0, - -cellpadding => 2, - -cols => 9, - -width => "100%"}); - print start_Tr {-valign => "bottom"}; - print th {-class => "tableleftend"}, "Date"; - - foreach (@Types) { - print th {-class => "tableheader"}, ucfirst; - } # foreach - - print th {-class => "tablerightend"}, "Total"; - - my %dates = GetStats $nbr_days, $date; + print start_table ({-align => 'center', + -id => $table_name, + -border => 0, + -cellspacing => 0, + -cellpadding => 2, + -cols => 9, + -width => '100%'}); + print start_Tr {-valign => 'bottom'}; + print th {-class => 'tableleftend'}, 'Date'; + + for (@Types) { + print th {-class => 'tableheader'}, ucfirst; + } # for + + print th {-class => 'tablerightend'}, 'Total'; + + my %dates = GetStats($nbr_days, $date); my %totals; - foreach my $date (sort {$b cmp $a} (keys (%dates))) { + for my $date (sort {$b cmp $a} (keys (%dates))) { print start_Tr; - print td {-class => "tablerightleftdata", - -align => "center"}, FormatDate $date; + print td {-class => 'tablerightleftdata', + -align => 'center'}, FormatDate $date; my $day_total = 0; - foreach (@Types) { + for (@Types) { my $value = $dates{$date}{$_}; - if ($value eq 0) { - print td {-class => "tabledata"}, " "; + if ($value == 0) { + print td {-class => 'tabledata'}, ' '; } else { - print td {-class => "tabledata", - -align => "center"}, - a {-href => "detail.cgi?type=$_;date=$date"}, - $value; + print td {-class => 'tabledata', + -align => 'center'}, + a {-href => "detail.cgi?type=$_;date=$date"}, + $value; } # if $totals{$_} += $value; $day_total += $value; - } # foreach + } # for - if ($day_total eq 0) { - print td {-class => "tableleftrightdata"}, " "; + if ($day_total == 0) { + print td {-class => 'tableleftrightdata'}, ' '; } else { - print td {-class => "tableleftrightdata", - -align => "center"}, $day_total; + print td {-class => 'tableleftrightdata', + -align => 'center'}, $day_total; } # if print end_Tr; - } # foreach + } # for my $grand_total = 0; print start_Tr; - print th {-class => "tablebottomlefttotal"}, "Totals"; + print th {-class => 'tablebottomlefttotal'}, 'Totals'; - foreach (@Types) { + for (@Types) { if ($totals{$_} eq 0) { - print td {-class => "tablebottomtotal"}, " "; + print td {-class => 'tablebottomtotal'}, ' '; } else { - print td {-class => "tablebottomtotal", - -align => "center"}, - a {-href => "detail.cgi?type=$_"}, $totals{$_}; + print td {-class => 'tablebottomtotal', + -align => 'center'}, + a {-href => "detail.cgi?type=$_"}, $totals{$_}; } # if $grand_total += $totals{$_}; - } # foreach + } # for - print td {-class => "tablebottomrighttotal", - -align => "center"}, $grand_total; + print td {-class => 'tablebottomrighttotal', + -align => 'center'}, $grand_total; print end_Tr; print end_table; @@ -113,25 +113,25 @@ sub Body { # Main my $userid = Heading ( - "getcookie", - "", - "Statistics", - "Statistics", - "", + 'getcookie', + '', + 'Statistics', + 'Statistics', + '', $table_name ); -SetContext $userid; +SetContext($userid); -if (!defined $nbr_days) { +if (!$nbr_days) { my %options = GetUserOptions $userid; - $nbr_days = $options{"Dates"}; + $nbr_days = $options{Dates}; } # if -NavigationBar $userid; +NavigationBar($userid); Body; -Footing $table_name; +Footing($table_name); exit;