Handle hostnames with upper-case letters
[webmin.git] / vgetty / edit_options.cgi
1 #!/usr/local/bin/perl
2 # edit_options.cgi
3 # Display options for the entire voicemail server
4
5 require './vgetty-lib.pl';
6 &ui_print_header(undef, $text{'options_title'}, "");
7 @conf = &get_config();
8
9 print "<form action=save_options.cgi method=post>\n";
10 print "<table border width=100%>\n";
11 print "<tr $tb> <td><b>$text{'options_header'}</b></td> </tr>\n";
12 print "<tr $cb> <td><table width=100%>\n";
13
14 $rings = &find_value("rings", \@conf);
15 if ($rings =~ /^\//) {
16         open(TF, $rings);
17         chop($rc = <TF>);
18         close(TF);
19         }
20 else { $rc = $rings; }
21 print "<tr> <td><b>$text{'options_rings'}</b></td>\n";
22 print "<td nowrap><input name=rings size=5 value='$rc'></td>\n";
23 printf "<td colspan=2><input type=checkbox name=rings_port value=1 %s> %s\n",
24         $rings =~ /^\// ? "checked" : "", $text{'options_perport'};
25 print "</td> </tr>\n";
26
27 $ans = &find_value("answer_mode", \@conf);
28 if ($ans =~ /^\//) {
29         open(TF, $ans);
30         chop($rc = <TF>);
31         close(TF);
32         }
33 else { $rc = $ans; }
34 print "<tr> <td><b>$text{'options_ans'}</b></td>\n";
35 print "<td nowrap>",&answer_mode_input($rc, "ans"),"</td>\n";
36 printf "<td colspan=2><input type=checkbox name=ans_port value=1 %s> %s\n",
37         $ans =~ /^\// ? "checked" : "", $text{'options_perport'};
38 print "</td> </tr>\n";
39
40 print "<tr> <td><b>$text{'options_maxlen'}</b></td>\n";
41 printf "<td><input name=maxlen size=8 value='%s'> %s</td>\n",
42         &find_value("rec_max_len", \@conf), $text{'options_secs'};
43
44 print "<td><b>$text{'options_minlen'}</b></td>\n";
45 printf "<td><input name=minlen size=8 value='%s'> %s</td> </tr>\n",
46         &find_value("rec_min_len", \@conf), $text{'options_secs'};
47
48 $silence = &find_value("rec_remove_silence", \@conf);
49 print "<tr> <td><b>$text{'options_silence'}</b></td>\n";
50 printf "<td nowrap><input type=radio name=silence value=1 %s> %s\n",
51         $silence =~ /true/i ? "checked" : "", $text{'yes'};
52 printf "<input type=radio name=silence value=0 %s> %s</td>\n",
53         $silence =~ /true/i ? "" : "checked", $text{'no'};
54
55 print "<td><b>$text{'options_thresh'}</b></td>\n";
56 printf "<td><input name=thresh size=3 value='%s'> %%</td> </tr>\n",
57         &find_value("rec_silence_threshold", \@conf);
58
59 $rgain = &find_value("receive_gain", \@conf);
60 print "<tr> <td><b>$text{'options_rgain'}</b></td>\n";
61 printf "<td nowrap><input type=radio name=rgain_def value=1 %s> %s\n",
62         $rgain == -1 ? "checked" : "", $text{'default'};
63 printf "<input type=radio name=rgain_def value=0 %s>\n",
64         $rgain == -1 ? "" : "checked";
65 printf "<input name=rgain size=4 value='%s'> %%</td>\n",
66         $rgain == -1 ? "" : $rgain;
67
68 $tgain = &find_value("transmit_gain", \@conf);
69 print "<td><b>$text{'options_tgain'}</b></td>\n";
70 printf "<td nowrap><input type=radio name=tgain_def value=1 %s> %s\n",
71         $tgain == -1 ? "checked" : "", $text{'default'};
72 printf "<input type=radio name=tgain_def value=0 %s>\n",
73         $tgain == -1 ? "" : "checked";
74 printf "<input name=tgain size=4 value='%s'> %%</td> </tr>\n",
75         $tgain == -1 ? "" : $tgain;
76
77 $keep = &find_value("rec_always_keep", \@conf);
78 print "<tr> <td><b>$text{'options_keep'}</b></td>\n";
79 printf "<td nowrap><input type=radio name=keep value=1 %s> %s\n",
80         $keep =~ /true/i ? "checked" : "", $text{'yes'};
81 printf "<input type=radio name=keep value=0 %s> %s</td>\n",
82         $keep =~ /true/i ? "" : "checked", $text{'no'};
83
84 $light = &find_value("do_message_light", \@conf);
85 print "<td><b>$text{'options_light'}</b></td>\n";
86 printf "<td nowrap><input type=radio name=light value=1 %s> %s\n",
87         $light =~ /true/i ? "checked" : "", $text{'yes'};
88 printf "<input type=radio name=light value=0 %s> %s</td> </tr>\n",
89         $light =~ /true/i ? "" : "checked", $text{'no'};
90
91 print "<tr> <td><b>$text{'options_owner'}</b></td>\n";
92 printf "<td><input name=owner size=8 value='%s'> %s</td>\n",
93         &find_value("phone_owner", \@conf), &user_chooser_button("owner");
94
95 print "<td><b>$text{'options_group'}</b></td>\n";
96 printf "<td><input name=group size=8 value='%s'> %s</td> </tr>\n",
97         &find_value("phone_group", \@conf), &user_chooser_button("group");
98
99 print "<tr> <td><b>$text{'options_mode'}</b></td>\n";
100 printf "<td><input name=mode size=4 value='%s'></td>\n",
101         &find_value("phone_mode", \@conf);
102
103 $prog = &find_value("message_program", \@conf);
104 $mode = !$prog ? 0 : $prog eq "$module_config_directory/email.pl" ? 1 : 2;
105 print "<tr> <td valign=top><b>$text{'options_prog'}</b></td> <td colspan=3>\n";
106 printf "<input type=radio name=prog_mode value=0 %s> %s<br>\n",
107         $mode == 0 ? "checked" : "", $text{'options_prog0'};
108 printf "<input type=radio name=prog_mode value=1 %s> %s\n",
109         $mode == 1 ? "checked" : "", $text{'options_prog1'};
110 printf "<input name=email size=30 value='%s'><br>\n",
111         $mode == 1 ? $config{'email_to'} : "";
112 printf "<input type=radio name=prog_mode value=2 %s> %s\n",
113         $mode == 2 ? "checked" : "", $text{'options_prog2'};
114 printf "<input name=prog size=30 value='%s'></td> </tr>\n",
115         $mode == 2 ? $prog : "";
116
117 print "</tr>\n";
118
119 print "</table></td></tr></table>\n";
120 print "<input type=submit value='$text{'save'}'></form>\n";
121
122 &ui_print_footer("", $text{'index_return'});
123