Handle hostnames with upper-case letters
[webmin.git] / apache / mod_negotiation.pl
1 # mod_negotiation.pl
2 # Defines editors content negotiation directives
3
4 sub mod_negotiation_directives
5 {
6 $rv = [ [ 'CacheNegotiatedDocs', 0, 6, 'global' ],
7         [ 'LanguagePriority', 0, 19, 'virtual directory htaccess' ] ];
8 return &make_directives($rv, $_[0], "mod_negotiation");
9 }
10
11 sub mod_negotiation_handlers
12 {
13 return ("type-map");
14 }
15
16 sub edit_CacheNegotiatedDocs
17 {
18 if ($_[1]->{'version'} < 2.0) {
19         local $v = $_[0] ? "1" : "0";
20         return (1, $text{'mod_negotiation_cache'},
21                 &choice_input($v, "CacheNegotiatedDocs", "0",
22                 "$text{'yes'},1", "$text{'no'},0"));
23         }
24 else {
25         return (1, $text{'mod_negotiation_cache'},
26                 &choice_input($_[0]->{'value'}, "CacheNegotiatedDocs", "off",
27                               "$text{'yes'},on", "$text{'no'},off"));
28         }
29 }
30 sub save_CacheNegotiatedDocs
31 {
32 if ($_[0]->{'version'} < 2.0) {
33         return $in{'CacheNegotiatedDocs'} ? ( [ "" ] ) : ( [ ] );
34         }
35 else {
36         return &parse_choice("CacheNegotiatedDocs", "off");
37         }
38 }
39
40 sub edit_LanguagePriority
41 {
42 return (2, "$text{'mod_negotiation_pri'}",
43         &opt_input($_[0]->{'value'}, "LanguagePriority", "$text{'mod_negotiation_def'}", 40));
44 }
45 sub save_LanguagePriority
46 {
47 local $rv = &parse_opt("LanguagePriority", '\S', $text{'mod_negotiation_epri'});
48 if ($rv) {
49         $rv->[0] =~ s/^"(.*)"/$1/g;
50         }
51 return $rv;
52 }
53
54 1;
55