Handle hostnames with upper-case letters
[webmin.git] / nis / edit_netgroup.cgi
1 #!/usr/local/bin/perl
2 # edit_netgroup.cgi
3 # Edit a NIS netgroup table entry
4
5 require './nis-lib.pl';
6 &ReadParse();
7 &ui_print_header(undef, $text{'netgroup_title'}, "");
8
9 ($t, $lnums, $netgroup) = &table_edit_setup($in{'table'}, $in{'line'}, '\s+');
10 print "<form action=save_netgroup.cgi method=post>\n";
11 print "<input type=hidden name=table value='$in{'table'}'>\n";
12 print "<input type=hidden name=line value='$in{'line'}'>\n";
13
14 print "<table border>\n";
15 print "<tr $tb> <td><b>$text{'netgroup_header'}</b></td> </tr>\n";
16 print "<tr $cb> <td><table>\n";
17
18 print "<tr> <td><b>$text{'netgroup_name'}</b></td>\n";
19 print "<td><input name=name size=15 value='$netgroup->[0]'></td> </tr>\n";
20
21 print "<tr> <td valign=top><b>$text{'netgroup_members'}</b></td>\n";
22 print "<td><table border>\n";
23 print "<tr $tb> <td><b>$text{'netgroup_host'}</b></td> ",
24       "<td><b>$text{'netgroup_user'}</b></td> ",
25       "<td><b>$text{'netgroup_domain'}</b></td> </tr>\n";
26 $i = 0;
27 foreach $h (@$netgroup[1 .. @$netgroup-1], "(x,,)", "(x,,)") {
28         $h =~ /^\((\S*),(\S*),(\S*)\)$/ || next;
29         print "<tr $cb>\n";
30         foreach $v (['host',$1],['user',$2],['dom',$3]) {
31                 printf "<td><input type=radio name=$v->[0]_def_$i value=1 %s>%s\n",
32                         $v->[1] ? '' : 'checked', $text{'netgroup_any'};
33                 printf "<input type=radio name=$v->[0]_def_$i value=2 %s>%s\n",
34                         $v->[1] eq 'x' ? 'checked' : '', $text{'netgroup_none'}
35                         if ($v->[0] eq 'host');
36                 printf "<input type=radio name=$v->[0]_def_$i value=0 %s>\n",
37                         $v->[1] && $v->[1] ne 'x' ? 'checked' : '';
38                 printf "<input name=$v->[0]_$i size=15 value='%s'></td>\n",
39                         $v->[1] eq "x" ? "" : $v->[1];
40                 }
41         print "</tr>\n";
42         $i++;
43         }
44 print "</table></td> </tr>\n";
45
46 print "</table></td></tr></table>\n";
47 if (defined($in{'line'})) {
48         print "<input type=submit value='$text{'save'}'>\n";
49         print "<input type=submit name=delete value='$text{'delete'}'>\n";
50         }
51 else {
52         print "<input type=submit value='$text{'create'}'>\n";
53         }
54 print "</form>\n";
55 &ui_print_footer("edit_tables.cgi?table=$in{'table'}", $text{'tables_return'},
56         "", $text{'index_return'});
57