Handle hostnames with upper-case letters
[webmin.git] / apache / dir_index.cgi
1 #!/usr/local/bin/perl
2 # dir_index.cgi
3 # Display a menu of icons for per-directory options
4
5 require './apache-lib.pl';
6 &ReadParse();
7 ($conf, $v) = &get_virtual_config($in{'virt'});
8 &can_edit_virt($v) || &error($text{'virt_ecannot'});
9 $d = $conf->[$in{'idx'}];
10 $desc = &text('dir_header', &dir_name($d), &virtual_name($v));
11 &ui_print_header($desc, $text{'dir_title'}, "",
12         undef, undef, undef, undef, &restart_button());
13
14 $sw_icon = { "icon" => "images/show.gif",
15              "name" => $text{'dir_show'},
16              "link" => "show.cgi?virt=$in{'virt'}&idx=$in{'idx'}" };
17 if ($access{'types'} eq '*') {
18         $ed_icon = { "icon" => "images/edit.gif",
19                      "name" => $text{'dir_edit'},
20                      "link" =>
21                         "manual_form.cgi?virt=$in{'virt'}&idx=$in{'idx'}" };
22         }
23 &config_icons("directory", "edit_dir.cgi?virt=$in{'virt'}&idx=$in{'idx'}&",
24               $sw_icon, $ed_icon ? ( $ed_icon) : ( ));
25
26 print &ui_hr();
27 print &ui_form_start("change_dir.cgi", "post");
28 print &ui_hidden("virt", $in{'virt'});
29 print &ui_hidden("idx", $in{'idx'});
30 print &ui_table_start($text{'dir_opts'}, undef, 2);
31
32 $dname = $d->{'name'};
33 $dname =~ s/Match$//;
34 print &ui_table_row($text{'dir_type'},
35         &ui_select("type", $dname,
36           [ map { [ $_, $text{'virt_'.$_} ] }
37                   $httpd_modules{'core'} >= 2.0 ?
38                         ( "Directory", "Files", "Location", "Proxy" ) :
39                   $httpd_modules{'core'} >= 1.2 ?
40                         ( "Directory", "Files", "Location" ) :
41                         ( "Directory", "Location" ) ]));
42
43 if ($httpd_modules{'core'} >= 1.2) {
44         $re = $d->{'words'}->[0] eq "~" || $d->{'name'} =~ /Match/i ? 1 : 0;
45         print &ui_table_row($text{'dir_regexp'},
46                 &ui_radio("regexp", $re, [ [ 0, $text{'virt_exact'} ],
47                                            [ 1, $text{'virt_re'} ] ]));
48         }
49
50 print &ui_table_row($text{'dir_path'},
51         &ui_textbox("path", $d->{'words'}->[0] eq "~" ? $d->{'words'}->[1]
52                                                   : $d->{'words'}->[0], 50));
53
54 print &ui_table_end();
55 print &ui_form_end([ [ "", $text{'save'} ],
56                      [ "delete", $text{'delete'} ] ]);
57
58 &ui_print_footer("virt_index.cgi?virt=$in{'virt'}", $text{'virt_return'});
59
60