diff --git a/itsecur-firewall/list_report.cgi b/itsecur-firewall/list_report.cgi index f815c3549..e5de62abf 100755 --- a/itsecur-firewall/list_report.cgi +++ b/itsecur-firewall/list_report.cgi @@ -8,7 +8,8 @@ use POSIX; print "Refresh: $config{'refresh'}\r\n" if ($config{'refresh'}); &header($text{'report_title'}, ""); -print "
\n"; + +print &ui_hr(); if ($in{'reset'}) { # Clear all inputs @@ -27,102 +28,92 @@ elsif ($in{'save_name'}) { } # Show search form -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -$i = 0; +print &ui_form_start("list_report.cgi", "post"); +print &ui_table_start(undef,"width=100%",2); + +print &ui_columns_row([&ui_submit($text{'report_search'}), + &ui_submit($text{'report_reset'},"reset")], + ["colspan=4 width=50%", "colspan=4 width=50%"]); + +my $i = 0; +my @cols_row; +my @sel; +my $tx = ""; foreach $f (@search_fields) { - print "\n" if ($i%2 == 0); - print "\n"; - print "\n"; + } + push(@cols_row, &ui_select(${f}."_mode", undef, \@sel, 1) ); + if ($f eq "dst_iface") { - print "\n"; + push(@cols_row, &iface_input($f."_what", $in{$f."_what"}) ); } elsif ($f eq "proto") { - print "\n"; + push(@cols_row, &protocol_input($f."_what", $in{$f."_what"}) ); } elsif ($f eq "dst_port" || $f eq "src_port") { - print "\n"; + push(@cols_row, &ui_textbox($f."_other", $in{$f."_other"}, 6) ); } elsif ($f eq "src" || $f eq "dst") { - print "\n"; + push(@cols_row, &group_input($f."_what", $in{$f."_what"}, 2, 0). + &ui_textbox($f."_other", $in{$f."_other"}, 10) ); } elsif ($f eq "first" || $f eq "last") { - print ""; + push(@cols_row, $tx); } elsif ($f eq "action") { - print "\n"; + push(@cols_row, &action_input($f."_what", + $in{$f."_what"}, 1) ); } elsif ($f eq "rule") { - printf "\n", - $f, $in{$f."_what"}; + push(@cols_row, &ui_textbox($f."_what", $in{$f."_what"}, 5) ); } else { - printf "\n", - $f, $in{$f."_what"}; + push(@cols_row, &ui_textbox($f."_what", $in{$f."_what"}, 20) ); } - print "\n"; - print "\n" if ($i++%2 == 1); + push(@cols_row, "  " ); + print &ui_columns_row(\@cols_row) if ($i++%2 == 1); } # Show saved search -@searches = &list_searches(); +my @searches = &list_searches(); if (@searches) { - print "\n"; - print "\n"; - print "\n"; + print &ui_columns_row([$text{'report_usesaved'}, &ui_select("save_name", undef, \@sel, 1)], ["", "colspan=7"] ); } -print "
",$text{'report_'.$f},"",&iface_input($f."_what", $in{$f."_what"}),"",&protocol_input($f."_what", $in{$f."_what"}),"",&service_input($f."_what", $in{$f."_what"}, 2, 0, 1); - printf "\n", - $f, $in{$f."_other"}; - print "",&group_input($f."_what", $in{$f."_what"}, 2, 0); - printf "\n", - $f, $in{$f."_other"}; - print ""; - &date_input($in{$f."_day"}, $in{$f."_month"}, + $tx = ""; + $tx .= &date_input($in{$f."_day"}, $in{$f."_month"}, $in{$f."_year"}, $f); if ($f eq "first") { - &hourmin_input($in{$f."_hour"} || "00", + $tx .= &hourmin_input($in{$f."_hour"} || "00", $in{$f."_min"} || "00", $f); } else { - &hourmin_input($in{$f."_hour"} || "23", + $tx .= &hourmin_input($in{$f."_hour"} || "23", $in{$f."_min"} || "59", $f); } - print "",&action_input($f."_what", - $in{$f."_what"}, 1),"  
$text{'report_usesaved'}
\n"; +print &ui_table_end(); +print &ui_form_end(undef,undef,1); -print "
\n"; -print "
\n"; +print &ui_hr(); # Find those matching current search @logs = &parse_all_logs(); @@ -147,22 +138,17 @@ if (@logs) { $e = $in{'start'} + $config{'perpage'} - 1; $e = @logs-1 if ($e >= @logs); if ($s) { - printf "%s\n", - $prog, 0, - "First page"; - printf "%s\n", - $prog, $s - $config{'perpage'}, - "Previous page"; - } - print "",&text('report_pos', $s+1, $e+1, - scalar(@logs)),"\n"; + print &ui_link($prog."start=0", + "First page" ); + print &ui_link($prog."start=".($s - $config{'perpage'}), + "Previous page" ); + } + print "".&text('report_pos', $s+1, $e+1, scalar(@logs))."\n"; if ($e < @logs-1) { - printf "%s\n", - $prog, $s + $config{'perpage'}, - "Next page"; - printf "%s\n", - $prog, int((@logs-1)/$config{'perpage'})*$config{'perpage'}, - "Last page"; + print &ui_link($prog."start=".($s + $config{'perpage'}), + "Next page" ); + print &ui_link($prog."start=".(int((@logs-1)/$config{'perpage'})*$config{'perpage'}), + "Last page" ); } print "\n"; } @@ -172,35 +158,33 @@ if (@logs) { $e = @logs - 1; } - print "\n"; - print " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "\n"; + print &ui_columns_start([$text{'report_action'}, + $text{'report_rule2'}, + $text{'report_date'}, + $text{'report_time'}, + $text{'report_src'}, + $text{'report_dst'}, + $text{'report_dst_iface'}, + $text{'report_proto'}, + $text{'report_src_port'}, + $text{'report_dst_port'}]); for($i=$s; $i<=$e; $i++) { $l = $logs[$i]; - print "\n"; - print "\n"; - print "\n"; - local @tm = localtime($l->{'time'}); - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; + @cols_row = (); + push(@cols_row, $text{'rule_'.$l->{'action'}}); + push(@cols_row, ( $l->{'rule'} || " ") ); + my @tm = localtime($l->{'time'}); + push(@cols_row, strftime("%d/%m/%Y", @tm) ); + push(@cols_row, strftime("%H:%M:%S", @tm) ); + push(@cols_row, $l->{'src'} ); + push(@cols_row, $l->{'dst'} ); + push(@cols_row, ( $l->{'dst_iface'} || " " ) ); + push(@cols_row, ( $l->{'proto'} || " " ) ); + push(@cols_row, ( $l->{'src_port'} || " " ) ); + push(@cols_row, ( $l->{'dst_port'} || " " ) ); + print &ui_columns_row(\@cols_row); } - print "
$text{'report_action'}$text{'report_rule2'}$text{'report_date'}$text{'report_time'}$text{'report_src'}$text{'report_dst'}$text{'report_dst_iface'}$text{'report_proto'}$text{'report_src_port'}$text{'report_dst_port'}
",$text{'rule_'.$l->{'action'}},"",$l->{'rule'} || "
","
",strftime("%d/%m/%Y", @tm),"",strftime("%H:%M:%S", @tm),"",$l->{'src'},"",$l->{'dst'},"",$l->{'dst_iface'} || "
","
",$l->{'proto'} || "
","
",$l->{'src_port'} || "
","
",$l->{'dst_port'} || "
","
\n"; + print &ui_columns_end(); } elsif ($anylogs) { print "$text{'report_none'}

\n"; @@ -210,36 +194,34 @@ else { } -print "


\n"; -print "\n"; - +print &ui_hr(); +my $hastable = 0; if (@logs && &can_edit("report")) { # Show export button - print "\n"; + print &ui_table_start(undef,"width=100%",2); + $hastable = 1; + print &ui_form_start("list_welf.cgi", "post"); foreach $i (keys %in) { - print "\n"; + print &ui_hidden($i, &html_escape($in{$i}) ); } - print "\n"; - print "\n"; - print "\n"; + print &ui_columns_row([&ui_submit($text{'report_welf'}), $text{'report_welfdesc'}], ["valign=middle","valign=middle"] ); + print &ui_form_end(undef,undef,1); $anyrows++; } if (@searchvars && &can_edit("report")) { # Show button to save this search - print "\n"; + print &ui_table_start(undef,"width=100%",2) if ( $hastable == 0 ); + print &ui_form_start("save_search.cgi", "post"); foreach $i (keys %in) { - print "\n"; + print &ui_hidden($i, &html_escape($in{$i}) ); } - print "\n"; - print "\n"; - print "\n"; + print &ui_columns_row([&ui_submit($text{'report_save'}), + $text{'report_savedesc'}."
". + "".$text{'report_savename'}." ". + &ui_textbox("save_name", $in{'save_name'}, 30) ], + ["valign=middle","valign=middle"] ); + print &ui_form_end(undef,undef,1); $anyrows++; } @@ -262,32 +244,35 @@ if (@searchvars && &can_edit("report")) { # $anyrows++; # } -print "
$text{'report_welfdesc'}
$text{'report_savedesc'}
\n"; - print "$text{'report_savename'}\n"; - printf "\n", - $in{'save_name'}; - print "
\n"; +print &ui_table_end() if ( $hastable == 1 ); -print "
\n" if ($anyrows); +print &ui_hr() if ($anyrows); &footer("", $text{'index_return'}); # date_input(day, month, year, prefix) sub date_input { -print ""; -print "/"; -print "/"; -print &date_chooser_button("$_[3]_day", "$_[3]_month", "$_[3]_year"); -print "\n"; +$rv .= &ui_select($_[3]."_month", undef, \@sel, 1); +$rv .= "/"; +$rv .= &ui_textbox($_[3]."_year", $_[2], 4); +$rv .= &date_chooser_button("$_[3]_day", "$_[3]_month", "$_[3]_year"); +return $rv; } # hourmin_input(hour, min, prefix) sub hourmin_input { -print ""; -print ":"; -print ""; -print "\n"; +my $rv = ""; +$rv .= &ui_textbox($_[2]."_hour", $_[0], 2); +$rv .= ":"; +$rv .= &ui_textbox($_[2]."_min", $_[1], 2); +return $rv; }