Handle hostnames with upper-case letters
[webmin.git] / syslog-ng / list_destinations.cgi
1 #!/usr/local/bin/perl
2 # Show a list of log destinations
3
4 require './syslog-ng-lib.pl';
5 &ui_print_header(undef, $text{'destinations_title'}, "", "destinations");
6
7 $conf = &get_config();
8 @dests = &find("destination", $conf);
9 @links = ( &select_all_link("d"),
10            &select_invert_link("d"),
11            "<a href='edit_destination.cgi?new=1'>$text{'destinations_add'}</a>",
12          );
13 if (@dests) {
14         @tds = ( "width=5" );
15         print &ui_form_start("delete_destinations.cgi", "post");
16         print &ui_links_row(\@links);
17         print &ui_columns_start([ "",
18                                   $text{'destinations_name'},
19                                   $text{'destinations_type'},
20                                   $text{'destinations_file'},
21                                   "", ], undef, 0, \@tds);
22         foreach $d (@dests) {
23                 ($type, $typeid) = &nice_destination_type($d);
24                 $file = &nice_destination_file($d);
25                 $realfile = &find_value("file", $d->{'members'});
26                 print &ui_checked_columns_row([
27                         "<a href='edit_destination.cgi?name=".
28                           &urlize($d->{'value'})."'>$d->{'value'}</a>",
29                         $type || "???",
30                         $file || "???",
31                         $typeid == 0 && -f $realfile ?
32                           "<a href='view_log.cgi?dest=".&urlize($d->{'value'}).
33                           "'>$text{'destinations_view'}</a>" : "",
34                         ], \@tds, "d", $d->{'value'});
35                 }
36         print &ui_columns_end();
37         print &ui_links_row(\@links);
38         print &ui_form_end([ [ "delete", $text{'destinations_delete'} ] ]);
39         }
40 else {
41         print "<b>$text{'destinations_none'}</b><p>\n";
42         print &ui_links_row([ $links[2] ]);
43         }
44
45 # Show other module's logs
46 @others = &get_other_module_logs();
47 if (@others) {
48         print &ui_hr();
49         print &ui_columns_start([ $text{'destinations_desc'},
50                                   $text{'destinations_file'},
51                                   "" ]);
52         foreach $o (@others) {
53                 print &ui_columns_row([
54                         $o->{'desc'},
55                         $o->{'file'} ? "<tt>$o->{'file'}</tt>"
56                                      : &text('destinations_cmd', $o->{'cmd'}),
57                         "<a href='view_log.cgi?oidx=$o->{'mindex'}".
58                         "&omod=$o->{'mod'}'>$text{'destinations_view'}</a>",
59                         ]);
60                 }
61         print &ui_columns_end();
62         }
63
64 &ui_print_footer("", $text{'index_return'});
65