Handle hostnames with upper-case letters
[webmin.git] / samba / edit_group.cgi
1 #!/usr/local/bin/perl
2 # edit_group.cgi
3 # Show a form for editing an existing groups
4
5 require './samba-lib.pl';
6
7 $access{'maint_groups'} || &error($text{'groups_ecannot'});
8 &ReadParse();
9 if ($in{'new'}) {
10         &ui_print_header(undef, $text{'gedit_title1'}, "");
11         }
12 else {
13         &ui_print_header(undef, $text{'gedit_title2'}, "");
14         @groups = &list_groups();
15         $group = $groups[$in{'idx'}];
16         }
17
18 print "<form action=save_group.cgi method=post>\n";
19 print "<input type=hidden name=idx value='$in{'idx'}'>\n";
20 print "<input type=hidden name=new value='$in{'new'}'>\n";
21
22 print "<table border width=100%>\n";
23 print "<tr $tb> <td><b>$text{'gedit_header'}</b></td> </tr>\n";
24 print "<tr $cb> <td><table width=100%>\n";
25
26 print "<tr> <td><b>$text{'gedit_name'}</b></td>\n";
27 if ($in{'new'}) {
28         print "<td><input name=name size=20></td>\n";
29         }
30 else {
31         print "<td><tt>$group->{'name'}</b></td>\n";
32         }
33
34 print "<td><b>$text{'gedit_type'}</b></td>\n";
35 print "<td><select name=type>\n";
36 foreach $t ('l', 'd', 'b', 'u') {
37         printf "<option value=%s %s>%s\n",
38                 $t, $group->{'type'} eq $t ? "selected" : "",
39                 $text{'groups_type_'.$t};
40         $found++ if ($group->{'type'} eq $t);
41         }
42 print "<option selected>$group->{'type'}\n" if (!$found && !$in{'new'});
43 print "</select></td> </tr>\n";
44
45 print "<tr> <td><b>$text{'gedit_unix'}</b></td> <td>\n";
46 if ($group->{'unix'} == -1) {
47         printf "<input type=radio name=unix_def value=1 %s> %s\n",
48                 $group->{'unix'} == -1 ? "checked" : "", $text{'gedit_none'};
49         printf "<input type=radio name=unix_def value=0 %s> %s\n",
50                 $group->{'unix'} == -1 ? "" :"checked", $text{'gedit_unixgr'};
51         }
52 print &unix_group_input("unix",
53                        $group->{'unix'} == -1 ? undef : $group->{'unix'});
54 print "</td>\n";
55
56 print "<td><b>$text{'gedit_desc'}</b></td>\n";
57 print "<td><input name=desc size=30 ",
58       "value='$group->{'desc'}'></td> </tr>\n";
59
60 if ($in{'new'}) {
61         print "<tr> <td><b>$text{'gedit_priv'}</b></td> <td colspan=3>\n";
62         print "<input type=radio name=priv_def value=1 checked> $text{'gedit_none'}\n";
63         print "<input type=radio name=priv_def value=0> $text{'gedit_set'}\n";
64         print "<input name=priv size=50></td> </tr>\n";
65         }
66 else {
67         print "<tr> <td><b>$text{'gedit_sid'}</b></td>\n";
68         print "<td colspan=3><tt>$group->{'sid'}</tt></td> </tr>\n";
69
70         print "<tr> <td><b>$text{'gedit_priv'}</b></td>\n";
71         print "<td colspan=3>",$group->{'priv'} || $text{'gedit_none'},"</td> </tr>\n";
72         }
73
74 print "</table></td></tr></table>\n";
75
76 print "<table width=100%><tr>\n";
77 if ($in{'new'}) {
78         print "<td><input type=submit value='$text{'create'}'></td>\n";
79         }
80 else {
81         print "<td><input type=submit value='$text{'save'}'></td>\n";
82         print "<td align=right ><input type=submit name=delete ",
83               "value='$text{'delete'}'></td>\n";
84         }
85 print "</tr></table></form>\n";
86
87 &ui_print_footer("list_groups.cgi", $text{'groups_return'});
88