Handle hostnames with upper-case letters
[webmin.git] / bacula-backup / poolstatus_form.cgi
1 #!/usr/local/bin/perl
2 # Show a form for displaying the status of one pool
3
4 require './bacula-backup-lib.pl';
5 &ui_print_header(undef,  $text{'poolstatus_title'}, "", "poolstatus");
6 &ReadParse();
7
8 # Show pool selector
9 $conf = &get_director_config();
10 @pools =  map { $n=&find_value("Name", $_->{'members'}) }
11                 &find("Pool", $conf);
12 @pools = sort { lc($a) cmp lc($b) } @pools;
13 if (@pools == 1) {
14         $in{'pool'} ||= $pools[0];
15         }
16 print &ui_form_start("poolstatus_form.cgi");
17 print "<b>$text{'poolstatus_show'}</b>\n";
18 print &ui_select("pool", $in{'pool'},
19          [ map { [ $_ ] } @pools ]);
20 print &ui_submit($text{'poolstatus_ok'}),"<br>\n";
21 print &ui_form_end();
22
23 if ($in{'pool'}) {
24         # Show volumes in this pool
25         @volumes = &get_pool_volumes($in{'pool'});
26
27         print &ui_subheading($text{'poolstatus_volumes'});
28         $never = "<i>$text{'poolstatus_never'}</i>";
29         if (@volumes) {
30                 print &ui_form_start("delete_volumes.cgi", "post");
31                 print &ui_hidden("pool", $in{'pool'}),"\n";
32                 print &select_all_link("d", 1),"\n";
33                 print &select_invert_link("d", 1),"<br>\n";
34                 @tds = ( "width=5" );
35                 print &ui_columns_start([ "",
36                                           $text{'poolstatus_name'},
37                                           $text{'poolstatus_type'},
38                                           $text{'poolstatus_first'},
39                                           $text{'poolstatus_last'},
40                                           $text{'poolstatus_bytes'},
41                                           $text{'poolstatus_status'} ],
42                                         "100%", 0, \@tds);
43                 foreach $v (@volumes) {
44                         print &ui_columns_row([
45                                 &ui_checkbox("d", $v->{'volumename'}),
46                                 $v->{'volumename'},
47                                 $v->{'mediatype'},
48                                 $v->{'firstwritten'} || $never,
49                                 $v->{'lastwritten'} || $never,
50                                 $v->{'volbytes'},
51                                 $v->{'volstatus'},
52                                 ], \@tds);
53                         }
54                 print &ui_columns_end();
55                 print &select_all_link("d", 1),"\n";
56                 print &select_invert_link("d", 1),"<br>\n";
57                 print &ui_form_end([ [ "delete",$text{'poolstatus_delete'} ] ]);
58                 }
59         else {
60                 print "<b>$text{'poolstatus_none'}</b><p>\n";
61                 }
62         }
63
64 &ui_print_footer("", $text{'index_return'});
65
66 sub joblink
67 {
68 return $jobs{$_[0]} ? "<a href='edit_job.cgi?name=".&urlize($_[0])."'>$_[0]</a>" : $_[0];
69 }
70