#!/usr/bin/perl
# group_chooser.cgi
# This CGI generated the HTML for choosing a group or list of groups.
BEGIN { push(@INC, "."); };
use WebminCore;
&init_config();
if (&get_product_name() eq 'usermin') {
&switch_to_remote_user();
}
&ReadParse(undef, undef, 2);
%access = &get_module_acl();
# Build list of primary groups
setpwent();
while(@uinfo = getpwent()) {
push(@{$members{$uinfo[3]}}, $uinfo[0]);
}
endpwent() if ($gconfig{'os_type'} ne 'hpux');
if ($in{'multi'}) {
# selecting multiple groups.
if ($in{'frame'} == 0) {
# base frame
&PrintHeader();
print "\n";
print "$text{'groups_title1'}\n";
print "\n";
}
elsif ($in{'frame'} == 1) {
# list of all groups to choose from
&popup_header();
print "\n";
print "
\n";
if ( $cnt >= 10 ) {
print "";
print "";
}
&popup_footer();
}
elsif ($in{'frame'} == 2) {
# show chosen groups
&popup_header();
print "$text{'groups_sel'}\n";
print <<'EOF';
EOF
&popup_footer();
}
elsif ($in{'frame'} == 3) {
# output OK and Cancel buttons
&popup_header();
print "\n";
print "\n";
&popup_footer();
}
}
else {
# selecting just one group .. display a list of all groups to
# choose from
&popup_header($text{'groups_title2'});
print "\n";
print "