Handle hostnames with upper-case letters
[webmin.git] / openslp / edit_netcfg.cgi
1 #!/usr/local/bin/perl
2 #
3 # An OpenSLP webmin module
4 # by Monty Charlton <monty@caldera.com>,
5 #
6 # Copyright (c) 2000 Caldera Systems
7 #
8 # Permission to use, copy, modify, and distribute this software and its
9 # documentation under the terms of the GNU General Public License is hereby 
10 # granted. No representations are made about the suitability of this software 
11 # for any purpose. It is provided "as is" without express or implied warranty.
12 # See the GNU General Public License for more details.
13 #
14
15 require './slp-lib.pl';
16 &ui_print_header(undef, $text{'netcfg_title'}, "");
17
18 local $netcfg = &get_netcfg_config();
19 print "<form action=save_netcfg.cgi>\n";
20 print "<table border width=100%>\n";
21 print "<tr $tb> <td><b>$text{'netcfg_title'}</b></td> </tr>\n";
22 print "<tr $cb> <td><table width=100% cellpadding=2>\n";
23
24 if ($netcfg->{'isBroadcastOnly'} !~ /^true$/i || $netcfg->{'isBroadcastOnlyDisabled'}) {
25         $false = " checked";
26 } else {
27         $true = " checked";
28 }
29 print "<tr><td><b>$text{'netcfg_isBroadcastOnly'}</b></td><td nowrap>\n";
30 print "<input type=radio name=isBroadcastOnly value=1$true>\n";
31 print "True&nbsp;&nbsp;<BR>";
32 print "<input type=radio name=isBroadcastOnly value=0$false>\n";
33 print "False&nbsp;(default)";
34 print "</td>\n";
35 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
36
37 local $true=""; local $false="";
38 if ($netcfg->{'passiveDADetection'} !~ /^false$/i || $netcfg->{'passiveDADetectionDisabled'}) {
39         $true = " checked";
40 } else {
41         $false = " checked";
42 }
43 print "<td><b>$text{'netcfg_passiveDADetection'}</b></td><td nowrap>\n";
44 print "<input type=radio name=passiveDADetection value=1$true>\n";
45 print "True&nbsp;(default)&nbsp;<BR>";
46 print "<input type=radio name=passiveDADetection value=0$false>\n";
47 print "False&nbsp;";
48 print "</td></tr>\n";                                                                                               
49 print "<tr><td colspan=6><HR></td></tr>";
50
51 $true=""; $false="";
52 if ($netcfg->{'activeDADetection'} !~ /^false$/i || $netcfg->{'activeDADetectionDisabled'}) {
53         $true = " checked";
54 } else {
55         $false = " checked";
56 }
57 print "<tr><td><b>$text{'netcfg_activeDADetection'}</b></td><td nowrap>\n";
58 print "<input type=radio name=activeDADetection value=1$true>\n";
59 print "True&nbsp;(default)&nbsp;<BR>";
60 print "<input type=radio name=activeDADetection value=0$false>\n";
61 print "False&nbsp;";
62 print "</td>\n";
63 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
64  
65 $true=""; $false="";
66 if ($netcfg->{'DAActiveDiscoveryIntervalDisabled'}) {
67         $true = " checked";
68 } else {
69         $false = " checked";
70 }
71 print "<td><b>$text{'netcfg_DAActiveDiscoveryInterval'}</b></td><td nowrap>\n";
72 print "<input type=radio name=DAActiveDiscoveryInterval value=1$true>\n";
73 print "Default&nbsp;";
74 print "<input type=radio name=DAActiveDiscoveryInterval value=0$false>\n";
75 print "&nbsp;";
76 printf "<input name=DAActiveDiscoveryIntervalValue size=6 value=\"%s\"><br>\n",
77         $netcfg->{'DAActiveDiscoveryInterval'};
78 print "</td>\n";
79 print "<tr><td colspan=6><HR></td>";
80
81 $true=""; $false="";
82 if ($netcfg->{'multicastTTLDisabled'}) {
83         $true = " checked";
84 } else {
85         $false = " checked";
86 }
87 print "<tr><td><b>$text{'netcfg_multicastTTL'}</b></td><td nowrap>\n";
88 print "<input type=radio name=multicastTTL value=1$true>\n";
89 print "Default&nbsp;";
90 print "<input type=radio name=multicastTTL value=0$false>\n";
91 print "&nbsp;";
92 printf "<input name=multicastTTLValue size=6 value=\"%s\"><br>\n",
93         $netcfg->{'multicastTTL'};
94 print "</td>\n";
95 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
96
97 $true=""; $false="";
98 if ($netcfg->{'DADiscoveryMaximumWaitDisabled'}) {
99         $true = " checked";
100 } else {
101         $false = " checked";
102 }
103 print "<td><b>$text{'netcfg_DADiscoveryMaximumWait'}</b></td><td nowrap>\n";
104 print "<input type=radio name=DADiscoveryMaximumWait value=1$true>\n";
105 print "Default&nbsp;";
106 print "<input type=radio name=DADiscoveryMaximumWait value=0$false>\n";
107 print "&nbsp;";
108 printf "<input name=DADiscoveryMaximumWaitValue size=6 value=\"%s\"><br>\n",
109         $netcfg->{'DADiscoveryMaximumWait'};
110 print "</td></tr>\n";
111 print "<tr><td colspan=6><HR></td>";
112
113 $true=""; $false="";
114 if ($netcfg->{'DADiscoveryTimeoutsDisabled'}) {
115         $true = " checked";
116 } else {
117         $false = " checked";
118 }
119 print "<tr><td><b>$text{'netcfg_DADiscoveryTimeouts'}</b></td><td nowrap>\n";
120 print "<table><tr><td nowrap>\n";
121 print "<input type=radio name=DADiscoveryTimeouts value=1$true>\n";
122 print "Default&nbsp;";
123 print "<input type=radio name=DADiscoveryTimeouts value=0$false></td><td>\n";
124 for ($i=0; $i<5; $i++) {
125         printf "<input name=DADiscoveryTimeoutsValue_$i size=6 value=\"%s\"><br>\n",
126                 $netcfg->{'DADiscoveryTimeouts'}->[$i];
127 }
128 print "</td></tr></table></td>\n";
129 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
130
131 $true=""; $false="";
132 if ($netcfg->{'HintsFileDisabled'}) {
133         $true = " checked";
134 } else {
135         $false = " checked";
136 }
137 print "<td><b>$text{'netcfg_HintsFile'}</b></td><td nowrap>\n";
138 print "<input type=radio name=HintsFile value=1$true>\n";
139 print "Default&nbsp;";
140 print "<input type=radio name=HintsFile value=0$false>\n";
141 print "&nbsp;";
142 printf "<input name=HintsFileValue size=13 value=\"%s\"><br>\n",
143         $netcfg->{'HintsFile'};
144 print "</td></tr>\n";
145 print "<tr><td colspan=6><HR></td>";
146
147 $true=""; $false="";
148 if ($netcfg->{'multicastMaximumWaitDisabled'}) {
149         $true = " checked";
150 } else {
151         $false = " checked";
152 }
153 print "<tr><td><b>$text{'netcfg_multicastMaximumWait'}</b></td><td nowrap>\n";
154 print "<input type=radio name=multicastMaximumWait value=1$true>\n";
155 print "Default&nbsp;";
156 print "<input type=radio name=multicastMaximumWait value=0$false>\n";
157 print "&nbsp;";
158 printf "<input name=multicastMaximumWaitValue size=6 value=\"%s\"><br>\n",
159         $netcfg->{'multicastMaximumWait'};
160 print "</td>\n";
161 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
162
163 $true=""; $false="";
164 if ($netcfg->{'multicastTimeoutsDisabled'}) {
165         $true = " checked";
166 } else {
167         $false = " checked";
168 }
169 print "<td><b>$text{'netcfg_multicastTimeouts'}</b></td><td nowrap>\n";
170 print "<table><tr><td nowrap>\n";
171 print "<input type=radio name=multicastTimeouts value=1$true>\n";
172 print "Default&nbsp;";
173 print "<input type=radio name=multicastTimeouts value=0$false></td><td>\n";
174 for ($i=0; $i<5; $i++) {
175         printf "<input name=multicastTimeoutsValue_$i size=6 value=\"%s\"><br>\n",
176                 $netcfg->{'multicastTimeouts'}->[$i];
177 }
178 print "</td></tr></table></td><tr>\n";
179 print "<tr><td colspan=6><HR></td>";
180
181 $true=""; $false="";
182 if ($netcfg->{'unicastMaximumWaitDisabled'}) {
183         $true = " checked";
184 } else {
185         $false = " checked";
186 }
187 print "<tr><td><b>$text{'netcfg_unicastMaximumWait'}</b></td><td nowrap>\n";
188 print "<input type=radio name=unicastMaximumWait value=1$true>\n";
189 print "Default&nbsp;";
190 print "<input type=radio name=unicastMaximumWait value=0$false>\n";
191 print "&nbsp;";
192 printf "<input name=unicastMaximumWaitValue size=6 value=\"%s\"><br>\n",
193         $netcfg->{'unicastMaximumWait'};
194 print "</td>\n";
195 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
196
197 $true=""; $false="";
198 if ($netcfg->{'randomWaitBoundDisabled'}) {
199         $true = " checked";
200 } else {
201         $false = " checked";
202 }
203 print "<td><b>$text{'netcfg_randomWaitBound'}</b></td><td nowrap>\n";
204 print "<input type=radio name=randomWaitBound value=1$true>\n";
205 print "Default&nbsp;";
206 print "<input type=radio name=randomWaitBound value=0$false>\n";
207 print "&nbsp;";
208 printf "<input name=randomWaitBoundValue size=6 value=\"%s\"><br>\n",
209         $netcfg->{'randomWaitBound'};
210 print "</td></tr>\n";
211 print "<tr><td colspan=6><HR></td>";
212
213 $true=""; $false="";
214 if ($netcfg->{'MTUDisabled'}) {
215         $true = " checked";
216 } else {
217         $false = " checked";
218 }
219 print "<tr><td><b>$text{'netcfg_MTU'}</b></td><td nowrap>\n";
220 print "<input type=radio name=MTU value=1$true>\n";
221 print "Default&nbsp;";
222 print "<input type=radio name=MTU value=0$false>\n";
223 print "&nbsp;";
224 printf "<input name=MTUValue size=6 value=\"%s\"><br>\n",
225         $netcfg->{'MTU'};
226 print "</td>\n";
227 print "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
228
229 $true=""; $false="";
230 if ($netcfg->{'interfacesDisabled'}) {
231         $true = " checked";
232 } else {
233         $false = " checked";
234 }
235 print "<td><b>$text{'netcfg_interfaces'}</b></td><td nowrap>\n";
236 print "<table><tr><td nowrap>\n";
237 print "<input type=radio name=interfaces value=1$true>\n";
238 print "All&nbsp;";
239 print "<input type=radio name=interfaces value=0$false></td><td>\n";
240 for ($i=0; $i<5; $i++) {
241         printf "<input name=interfacesValue_$i size=13 value=\"%s\"><br>\n",
242                 $netcfg->{'interfaces'}->[$i];
243 }
244 print "</td></tr></table></td><tr>\n";
245
246 print "</table></td></tr></table>\n";
247 print "<input type=submit value=\"$text{'save'}\"></form>\n";
248
249 &ui_print_footer("", $text{'index_return'});
250