Handle hostnames with upper-case letters
[webmin.git] / apache / mod_imap.pl
1 # mod_imap.pl
2 # Defines editors for imagemap directives
3
4 sub mod_imap_directives
5 {
6 $rv = [ [ 'ImapMenu', 0, 20, 'virtual directory htaccess' ],
7         [ 'ImapDefault', 0, 20, 'virtual directory htaccess' ],
8         [ 'ImapBase', 0, 20, 'virtual directory htaccess' ] ];
9 return &make_directives($rv, $_[0], "mod_imap");
10 }
11
12 sub mod_imap_handlers
13 {
14 return ("imap-file");
15 }
16
17 sub edit_ImapMenu
18 {
19 return (2, "$text{'mod_imap_action'}",
20         &select_input($_[0]->{'value'}, "ImapMenu", "", "$text{'mod_imap_default'},",
21          "$text{'mod_imap_godefurl'},none", "$text{'mod_imap_form'},formatted",
22          "$text{'mod_imap_semiform'},semiformatted",
23          "$text{'mod_imap_unform'},unformatted"));
24 }
25 sub save_ImapMenu
26 {
27 return &parse_select("ImapMenu", "");
28 }
29
30 sub edit_ImapDefault
31 {
32 local($rv, $v);
33 if ($_[0]->{'value'} =~ /^\S+:/) { $v = "url"; }
34 else { $v = $_[0]->{'value'}; }
35 $rv = &select_input($v, "ImapDefault", "", "$text{'mod_imap_default'},",
36        "$text{'mod_imap_disperr'},error",  "$text{'mod_imap_donoth'},nocontent",
37        "$text{'mod_imap_goimap'},map", "$text{'mod_imap_goref'},referer",
38        "$text{'mod_imap_gourl'},url");
39 $rv .= sprintf "&nbsp;<input name=ImapDefault_url size=30 value=\"%s\">\n",
40         $v eq "url" ? $_[0]->{'value'} : "";
41 return (2, "$text{'mod_imap_defact'}", $rv);
42 }
43 sub save_ImapDefault
44 {
45 if ($in{'ImapDefault'} eq "") { return ( [ ] ); }
46 elsif ($in{'ImapDefault'} ne "url") { return ( [ $in{'ImapDefault'} ] ); }
47 elsif ($in{'ImapDefault_url'} !~ /^\S+$/) {
48         &error(&text('mod_imap_eurl', $in{'ImapDefault_url'}));
49         }
50 else { return ( [ $in{'ImapDefault_url'} ] ); }
51 }
52
53 sub edit_ImapBase
54 {
55 local($rv, $v);
56 if ($_[0]->{'value'} =~ /^\S+:/) { $v = "url"; }
57 else { $v = $_[0]->{'value'}; }
58 $rv = &select_input($v, "ImapBase", "", "$text{'mod_imap_default2'},",
59        "$text{'mod_imap_root'},root", "$text{'mod_imap_imapurl'},map",
60        "$text{'mod_imap_refurl'},referer", "$text{'mod_imap_url'},url");
61 $rv .= sprintf "&nbsp;<input name=ImapBase_url size=30 value=\"%s\">\n",
62         $v eq "url" ? $_[0]->{'value'} : "";
63 return (2, "$text{'mod_imap_defbase'}", $rv);
64 }
65 sub save_ImapBase
66 {
67 if ($in{'ImapBase'} eq "") { return ( [ ] ); }
68 elsif ($in{'ImapBase'} ne "url") { return ( [ $in{'ImapBase'} ] ); }
69 elsif ($in{'ImapBase_url'} !~ /^\S+$/) {
70         &error(&text('mod_imap_eurl', $in{'ImapBase_url'}));
71         }
72 else { return ( [ $in{'ImapBase_url'} ] ); }
73 }
74
75 1;
76