Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / list_devices.cgi
1 #!/usr/local/bin/perl
2 # Show a list of all backup devices
3
4 require './bacula-backup-lib.pl';
5 &ui_print_header(undef, $text{'devices_title'}, "", "devices");
6
7 $conf = &get_storage_config();
8 @devices = &find("Device", $conf);
9 &sort_by_name(\@devices);
10 if (@devices) {
11         print &ui_form_start("delete_devices.cgi", "post");
12         @links = ( &select_all_link("d"),
13                    &select_invert_link("d"),
14                    "<a href='edit_device.cgi?new=1'>$text{'devices_add'}</a>" );
15         print &ui_links_row(\@links);
16         @tds = ( "width=5", "width=30%", "width=40%", "width=30%" );
17         print &ui_columns_start([ "", $text{'devices_name'},
18                                   $text{'devices_device'},
19                                   $text{'devices_type'} ], "100%", 0, \@tds);
20         foreach $f (@devices) {
21                 $name = &find_value("Name", $f->{'members'});
22                 $device = &find_value("Archive Device", $f->{'members'});
23                 $type = &find_value("Media Type", $f->{'members'});
24                 print &ui_checked_columns_row([
25                         "<a href='edit_device.cgi?name=".&urlize($name)."'>".
26                         $name."</a>",
27                         $device,
28                         $type,
29                         ], \@tds, "d", $name);
30                 }
31         print &ui_columns_end();
32         print &ui_links_row(\@links);
33         print &ui_form_end([ [ "delete", $text{'devices_delete'} ] ]);
34         }
35 else {
36         print "<b>$text{'devices_none'}</b><p>\n";
37         print "<a href='edit_device.cgi?new=1'>$text{'devices_add'}</a><br>\n";
38         }
39
40 &ui_print_footer("", $text{'index_return'});
41