diff --git a/bandwidth/index.cgi b/bandwidth/index.cgi index f6ed8f643..04278e1ce 100755 --- a/bandwidth/index.cgi +++ b/bandwidth/index.cgi @@ -124,54 +124,47 @@ elsif ($missingrule || !$sysconf) { if (@hours) { # Show reporting form print &ui_form_start("index.cgi"); - print "\n"; + print &ui_table_start(undef, undef, 2); - print "\n"; - print "\n"; + print &ui_table_row($text{'index_by'}, + &ui_select("by", $in{'by'}, + [ [ 'hour', $text{'index_hour'} ], + [ 'day', $text{'index_day'} ], + [ 'host', $text{'index_host'} ], + [ 'proto', $text{'index_proto'} ], + [ 'iport', $text{'index_iport'} ], + [ 'oport', $text{'index_oport'} ], + [ 'port', $text{'index_port'} ] ])); - print "\n"; - print "\n"; + print &ui_table_row($text{'index_for'}, + &ui_select("for", $in{'for'}, + [ [ '', $text{'index_all'} ], + [ 'host', $text{'index_forhost'} ], + [ 'proto', $text{'index_forproto'} ], + [ 'iport', $text{'index_foriport'} ], + [ 'oport', $text{'index_foroport'} ] ])." ". + &ui_textbox("what", $in{'for'} ? $in{'what'} : "", 20)); - print "\n"; - print "\n"; + $in{'from_year'}, "from"). + &hourmin_input($in{'from_hour'}, "00", "from")); - print "\n"; - print "\n"; + $in{'to_year'}, "to"). + &hourmin_input($in{'to_hour'}, "00", "to")); if (!%in) { # Enable by default $in{'low'} = 1; } - print "\n"; + print &ui_table_row("", + &ui_checkbox("low", 1, $text{'index_low'}, $in{'low'}). + &ui_checkbox("resolv", 1, $text{'index_resolv'}, $in{'resolv'})); - print "\n"; - - print "
$text{'index_by'}",&ui_select("by", $in{'by'}, - [ [ 'hour', $text{'index_hour'} ], - [ 'day', $text{'index_day'} ], - [ 'host', $text{'index_host'} ], - [ 'proto', $text{'index_proto'} ], - [ 'iport', $text{'index_iport'} ], - [ 'oport', $text{'index_oport'} ], - [ 'port', $text{'index_port'} ] ]),"$text{'index_for'}",&ui_select("for", $in{'for'}, - [ [ '', $text{'index_all'} ], - [ 'host', $text{'index_forhost'} ], - [ 'proto', $text{'index_forproto'} ], - [ 'iport', $text{'index_foriport'} ], - [ 'oport', $text{'index_foroport'} ] ]),"\n"; - print &ui_textbox("what", $in{'for'} ? $in{'what'} : "", 20), - "
$text{'index_from'}", + print &ui_table_row($text{'index_from'}, &date_input($in{'from_day'}, $in{'from_month'}, - $in{'from_year'}, "from"), - &hourmin_input($in{'from_hour'}, "00", "from"),"
$text{'index_to'}", + print &ui_table_row($text{'index_to'}, &date_input($in{'to_day'}, $in{'to_month'}, - $in{'to_year'}, "to"), - &hourmin_input($in{'to_hour'}, "00", "to"),"
\n"; - print &ui_checkbox("low", 1, $text{'index_low'}, $in{'low'}); - print &ui_checkbox("resolv", 1, $text{'index_resolv'}, $in{'resolv'}); - print "
", - &ui_submit($text{'index_search'}),"
\n"; - print &ui_form_end(); + print &ui_table_end(); + print &ui_form_end([ [ undef, $text{'index_search'} ] ]); } elsif (!$missingrule && $sysconf) { print "$text{'index_none'}

\n"; @@ -344,37 +337,45 @@ if ($in{'by'}) { @order = grep { $count{$_} } @order; } if (@order) { - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $total = 0; + print &ui_columns_start([ $text{'index_h'.$in{'by'}}, + $text{'index_usage'}, + $text{'index_in'}, + $text{'index_out'}, + $text{'index_total'} ], 100, 0); + $itotal = $ototal = $total = 0; foreach $k (@order) { - print "\n"; + my @cols; if ($in{'by'} eq 'hour') { - print "\n"; + push(@cols, &make_date($k*60*60)); } elsif ($in{'by'} eq 'day') { $date = &make_date_day($k*60*60); - print "\n"; + push(@cols, $date); } else { - print "\n"; + push(@cols, $k); } - print ""; - print "\n"; + push(@cols, $bar); + push(@cols, &nice_size($icount{$k}), + &nice_size($ocount{$k}), + &nice_size($count{$k})); $total += $count{$k}; + $itotal += $icount{$k}; + $ototal += $ocount{$k}; print "\n"; + print &ui_columns_row(\@cols); } - print "\n"; - print "
",$text{'index_h'.$in{'by'}},"$text{'index_usage'}
",&make_date($k*60*60),"$date$k"; - printf "", + my $bar = sprintf + "", $max ? int($width * $icount{$k}/$max)+1 : 1; - printf "", + $bar .= sprintf + "", $max ? int($width * $ocount{$k}/$max)+1 : 1; - print "",&nice_size($count{$k}),"
", - &nice_size($total),"
\n"; + print &ui_columns_row([ undef, undef, + &nice_size($itotal), + &nice_size($ototal), + &nice_size($total) ]); + print &ui_columns_end(); } else { print "$text{'index_nomatch'}

\n"; diff --git a/bandwidth/lang/en b/bandwidth/lang/en index fe1044962..caced9afe 100644 --- a/bandwidth/lang/en +++ b/bandwidth/lang/en @@ -41,6 +41,9 @@ index_efrom=Invalid starting date and time index_eto=Invalid ending date and time index_err=Failed to generate report index_usage=Network traffic downloaded and uploaded +index_in=Download +index_out=Upload +index_total=Total index_hhour=Hour index_hhost=Host index_hday=Day