Match color coding in pie chart and table in the cgi-scrips firewalllogip.dat, firewalllogport.dat and firewalllogcountry.dat.
Colors are coded color1 to color10 while old code for table mapped color0 to color9.
Signed-off-by: Michael Eitelwein michael@eitelwein.net --- diff --git a/html/cgi-bin/logs.cgi/firewalllogcountry.dat b/html/cgi-bin/logs.cgi/firewalllogcountry.dat index f998a62..7f71497 100644 --- a/html/cgi-bin/logs.cgi/firewalllogcountry.dat +++ b/html/cgi-bin/logs.cgi/firewalllogcountry.dat @@ -448,10 +448,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; $color++; print "<tr>"; @@ -489,10 +487,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
diff --git a/html/cgi-bin/logs.cgi/firewalllogip.dat b/html/cgi-bin/logs.cgi/firewalllogip.dat index 7d82d20..117b423 100644 --- a/html/cgi-bin/logs.cgi/firewalllogip.dat +++ b/html/cgi-bin/logs.cgi/firewalllogip.dat @@ -428,10 +428,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
@@ -459,10 +457,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
diff --git a/html/cgi-bin/logs.cgi/firewalllogport.dat b/html/cgi-bin/logs.cgi/firewalllogport.dat index 5b0db62..583c1b3 100644 --- a/html/cgi-bin/logs.cgi/firewalllogport.dat +++ b/html/cgi-bin/logs.cgi/firewalllogport.dat @@ -429,10 +429,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
@@ -446,10 +444,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
Hello Michael,
thank you very much for sending in your patches and welcome to the project. :)
This patch looks good and I think it could be merged. I am not sure about the coding style though. This is usually a bit difficult to make out in the patch format, but coding style in those old files is messed up pretty much already.
We usually use tabs, but there is some code that uses spaces instead.
Best, -Michael
On Thu, 2016-01-07 at 12:33 +0100, Michael Eitelwein wrote:
Match color coding in pie chart and table in the cgi-scrips firewalllogip.dat, firewalllogport.dat and firewalllogcountry.dat.
Colors are coded color1 to color10 while old code for table mapped color0 to color9.
Signed-off-by: Michael Eitelwein michael@eitelwein.net
diff --git a/html/cgi-bin/logs.cgi/firewalllogcountry.dat b/html/cgi-bin/logs.cgi/firewalllogcountry.dat index f998a62..7f71497 100644 --- a/html/cgi-bin/logs.cgi/firewalllogcountry.dat +++ b/html/cgi-bin/logs.cgi/firewalllogcountry.dat @@ -448,10 +448,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; $color++; print "<tr>"; @@ -489,10 +487,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
diff --git a/html/cgi-bin/logs.cgi/firewalllogip.dat b/html/cgi-bin/logs.cgi/firewalllogip.dat index 7d82d20..117b423 100644 --- a/html/cgi-bin/logs.cgi/firewalllogip.dat +++ b/html/cgi-bin/logs.cgi/firewalllogip.dat @@ -428,10 +428,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
@@ -459,10 +457,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
diff --git a/html/cgi-bin/logs.cgi/firewalllogport.dat b/html/cgi-bin/logs.cgi/firewalllogport.dat index 5b0db62..583c1b3 100644 --- a/html/cgi-bin/logs.cgi/firewalllogport.dat +++ b/html/cgi-bin/logs.cgi/firewalllogport.dat @@ -429,10 +429,8 @@ for($s=0;$s<$lines;$s++) $percent = $value[$s] * 100 / $linesjc; $percent = sprintf("%.f", $percent); $total = $total + $value[$s]; - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";
@@ -446,10 +444,8 @@ for($s=0;$s<$lines;$s++)
if($cgiparams{'otherspie'} == 2 ){} else{ - my $colorIndex = $color % 10; - if($colorIndex == 0) { - $colorIndex = 10; - } + # colors are numbered 1 to 10 + my $colorIndex = ($color % 10) + 1; $col="bgcolor='$color{"color$colorIndex"}'"; print "<tr>";