Handle hostnames with upper-case letters
[webmin.git] / squid / edit_cachemgr.cgi
1 #!/usr/local/bin/perl
2 # Show a list of per-function cache manager passwords
3
4 require './squid-lib.pl';
5 $access{'cachemgr'} || &error($text{'cachemgr_ecannot'});
6 &ui_print_header(undef, $text{'cachemgr_title'}, "", "edit_cachemgr", 0, 0, 0,
7                  &restart_button());
8
9 # Find password directives
10 $conf = &get_config();
11 @cachemgr = &find_config("cachemgr_passwd", $conf);
12
13 # Show them in a table
14 print &ui_form_start("save_cachemgr.cgi", "post");
15 print &ui_radio("cachemgr_def", @cachemgr ? 0 : 1,
16     [ [ 1, $text{'cachemgr_def1'} ], [ 0, $text{'cachemgr_def0'} ] ]),"<br>\n";
17 print &ui_columns_start([ $text{'cachemgr_pass'},
18                           $text{'cachemsg_actions'} ], 100, 0);
19 $i = 0;
20 foreach $c (@cachemgr, { 'values' => [ 'none' ] }) {
21         @grid = ( );
22         ($p, @acts) = @{$c->{'values'}};
23         %acts = map { $_, 1 } @acts;
24         foreach my $a (&list_cachemgr_actions()) {
25                 push(@grid, &ui_checkbox("action_$i", $a, $a, $acts{$a}));
26                 delete($acts{$a});
27                 }
28         @others = grep { $_ ne 'all' } keys %acts;
29         $pmode = $p eq "none" ? "none" : $p eq "disable" ? "disable" : undef;
30         print &ui_columns_row([
31                 &ui_radio("pass_def_$i", $pmode,
32                           [ [ "none", $text{'cachemgr_none'}."<br>" ],
33                             [ "disable", $text{'cachemgr_disable'}."<br>" ],
34                             [ "", $text{'cachemgr_set'} ] ])." ".
35                 &ui_textbox("pass_$i", $pmode ? "" : $p, 15),
36                 &ui_checkbox("all_$i", 1, $text{'cachemgr_all'}, $acts{'all'}).
37                 "<br>\n".
38                 &ui_grid_table(\@grid, 6, 100).
39                 (@others ? "<br>\n".$text{'cachemgr_others'}." ".
40                            &ui_textbox("others_$i", join(" ", @others), 40)
41                          : "")
42                  ], [ "valign=top", "valign=top" ]);
43         $i++;
44         }
45 print &ui_columns_end();
46 print &ui_form_end([ [ undef, $text{'save'} ] ]);
47
48 &ui_print_footer("", $text{'index_return'});