Handle hostnames with upper-case letters
[webmin.git] / net / edit_host.cgi
1 #!/usr/local/bin/perl
2 # edit_host.cgi
3 # Edit or create a host address
4
5 require './net-lib.pl';
6 $access{'hosts'} == 2 || &error($text{'hosts_ecannot'});
7 &ReadParse();
8 if ($in{'new'}) {
9         &ui_print_header(undef, $text{'hosts_create'}, "");
10         }
11 else {
12         &ui_print_header(undef, $text{'hosts_edit'}, "");
13         @hosts = &list_hosts();
14         $h = $hosts[$in{'idx'}];
15         }
16
17 # Start of the form
18 print &ui_form_start("save_host.cgi");
19 print &ui_hidden("new", $in{'new'});
20 print &ui_hidden("idx", $in{'idx'});
21 print &ui_table_start($text{'hosts_detail'}, undef, 2);
22
23 # IP address
24 print &ui_table_row($text{'hosts_ip'},
25         &ui_textbox("address", $h->{'address'}, 30));
26
27 # Hostnames
28 print &ui_table_row($text{'hosts_host'},
29         &ui_textarea("hosts", join("\n", @{$h->{'hosts'}}), 5, 50));
30
31 # End of the form
32 print &ui_table_end();
33 if ($in{'new'}) {
34         print &ui_form_end([ [ undef, $text{'create'} ] ]);
35         }
36 else {
37         print &ui_form_end([ [ undef, $text{'save'} ],
38                              [ "delete", $text{'delete'} ] ]);
39         }
40
41 &ui_print_footer("list_hosts.cgi", $text{'hosts_return'});
42