3 # Display the contents of some table
5 require './shorewall-lib.pl';
7 &can_access($in{'table'}) || &error($text{'list_ecannot'});
8 &get_clean_table_name(\%in);
9 &ui_print_header(undef, $text{$in{'tableclean'}."_title"}, "");
11 $desc = $text{$in{'tableclean'}."_desc"};
12 print "$desc<p>\n" if ($desc);
14 $pfunc = &get_parser_func(\%in);
15 @table = &read_table_file($in{'table'}, $pfunc);
16 $cfunc = $in{'tableclean'}."_columns";
17 $cols = &$cfunc() if (defined(&$cfunc));
18 $nfunc = $in{'tableclean'}."_colnames";
19 #&debug_message("cfunc = $cfunc");
20 #&debug_message("nfunc = $nfunc");
21 if (defined(&$nfunc)) {
22 @colnames = &$nfunc();
26 for($j=0; defined($cols) ? ($j<$cols) : ($text{$in{'tableclean'}."_".$j}); $j++) {
27 push(@colnames, $text{$in{'tableclean'}."_".$j});
31 # Work out select/create links
32 @links = ( &select_all_link("d"),
33 &select_invert_link("d"),
34 "<a href='edit.cgi?table=$in{'table'}&new=1'>".
35 $text{$in{'tableclean'}."_add"}."</a>" );
36 if (&version_atleast(3, 3, 3) && &indexof($in{'table'}, @comment_tables) >= 0) {
37 push(@links, "<a href='editcmt.cgi?table=$in{'table'}&new=1'>".
38 $text{"comment_add"}."</a>");
43 print &ui_form_start("delete.cgi", "post");
44 print &ui_hidden("table", $in{'table'}),"\n";
45 print &ui_links_row(\@links);
46 print &ui_columns_start([
49 (@table > 1 ? ( $text{'list_move'} ) : ( )),
51 ], undef, 0, [ "width=5" ]);
53 $rfunc = $in{'tableclean'}."_row";
54 for($i=0; $i<@table; $i++) {
58 if ($t[0] eq "COMMENT") {
59 # Special case - a comment line
60 push(@cols, "<a href='editcmt.cgi?table=$in{'table'}&".
61 "idx=$i'><i>".join(" ", @t[1..$#t]).
63 @tds = ( "width=5", "colspan=".scalar(@colnames) );
66 # Some rule or other object
67 if (defined(&$rfunc)) {
70 for($j=0; $j<@colnames; $j++) {
72 $lnk = "<a href='edit.cgi?table=$in{'table'}&idx=$i'>$t[$j]</a>";
84 $mover .= "<img src=images/gap.gif>";
87 $mover .= "<a href='up.cgi?table=$in{'table'}&idx=$i'><img src=images/up.gif border=0></a>\n";
90 $mover .= "<img src=images/gap.gif>";
93 $mover .= "<a href='down.cgi?table=$in{'table'}&idx=$i'><img src=images/down.gif border=0></a>\n";
98 "<a href='edit.cgi?table=$in{'table'}&new=1&before=$i'>".
99 "<img src=images/before.gif border=0></a>\n".
100 "<a href='edit.cgi?table=$in{'table'}&new=1&after=$i'>".
101 "<img src=images/after.gif border=0></a>\n");
102 print &ui_checked_columns_row(\@cols, \@tds, "d", $i);
104 print &ui_columns_end();
107 print "<b>",$text{$in{'tableclean'}."_none"},"</b><p>\n";
108 shift(@links); shift(@links);
110 print &ui_links_row(\@links);
112 print &ui_form_end([ [ "delete", $text{'list_delete'} ] ]);
116 print &ui_buttons_start();
117 print &ui_buttons_row("manual_form.cgi", $text{'list_manual'},
118 &text('list_manualdesc',
119 "<tt>$config{'config_dir'}/$in{'table'}</tt>"),
120 &ui_hidden("table", $in{'table'}));
121 print &ui_buttons_end();
123 &ui_print_footer("", $text{'index_return'});