diff --git a/ldap-useradmin/edit_group.cgi b/ldap-useradmin/edit_group.cgi index 736bdf360..f52eb0215 100755 --- a/ldap-useradmin/edit_group.cgi +++ b/ldap-useradmin/edit_group.cgi @@ -26,123 +26,122 @@ else { &ui_print_header(undef, $text{'gedit_title'}, ""); } -print "
\n"; -print "\n"; -print "\n"; +# Build list of all possible users +@ulist = &useradmin::list_users(); +%ulistdone = map { $_->{'user'}, 1 } @ulist; +push(@ulist, grep { !$ulistdone{$_->{'user'}} } &list_users()); -# Show group details -print "\n"; -print "\n"; -print "
$text{'gedit_details'}
\n"; +# Start of form +print &ui_form_start("save_group.cgi", "post"); +print &ui_hidden("new", $in{'new'}); +print &ui_hidden("dn", $in{'dn'}); +print &ui_table_start($text{'gedit_details'}, "width=100%", 4); +# Current DN and classes if (!$in{'new'}) { - print "\n"; - print "\n"; + print &ui_table_row($text{'gedit_dn'}, + "$in{'dn'}", 3); - print "\n"; - print "\n"; + print &ui_table_row($text{'uedit_classes'}, + join(" , ", map { "$_" } + $ginfo->get_value('objectClass')), 3); } -print "\n"; -print "\n"; +# Group name +print &ui_table_row($text{'gedit_group'}, + &ui_textbox("group", $group, 20)); -print "\n"; +# Group ID if ($in{'new'}) { # Next GID comes from LDAP only $newgid = $mconfig{'base_gid'}; while(&check_gid_used($ldap, $newgid)) { $newgid++; } - print "\n"; + $gidfield = &ui_textbox("gid", $newgid, 10); } else { - print "\n"; + $gidfield = &ui_textbox("gid", $gid, 10); } -print "\n"; +print &ui_table_row($text{'gedit_gid'}, + $gidfield); -print "\n"; -printf "\n"; +# Group password (rarely used, but..) +print &ui_table_row($text{'pass'}, + &ui_radio_table("passmode", $pass eq "" ? 0 : 1, + [ [ 0, $text{'none2'} ], + [ 1, $text{'encrypted'}, + &ui_textbox("encpass", $pass, 20) ], + [ 2, $text{'clear'}, + &ui_textbox("pass", undef, 15) ] ])); -print "\n"; -print "\n"; -print "
$text{'gedit_dn'}$in{'dn'}
$text{'uedit_classes'}",join(" , ", map { "$_" } - $ginfo->get_value('objectClass')),"
$text{'gedit_group'}$text{'gedit_gid'}
$text{'pass'} $text{'none2'}
\n", - $pass eq "" ? "checked" : ""; -printf " $text{'encrypted'}\n", - $pass eq "" ? "" : "checked"; -print "
\n"; -print " $text{'clear'}\n"; -print "
$text{'gedit_members'}\n"; -print "
",&user_chooser_button("members", 1), - "

\n"; +# Group members, using multi-select +print &ui_table_row($text{'gedit_members'}, + &ui_multi_select("members", + [ map { [ $_, $_ ] } @members ], + [ map { [ $_->{'user'}, $_->{'user'} ] } @ulist ], + 10, 1, 0, + $text{'gedit_allu'}, $text{'gedit_selu'}, 150)); +print &ui_table_end(); # Show extra fields (if any) &extra_fields_input($config{'group_fields'}, $ginfo); # Show capabilties section -print "\n"; -print "\n"; -print "
$text{'gedit_cap'}
\n"; +print &ui_table_start($text{'gedit_cap'}, "width=100%", 4, [ "width=30%" ]); -print "\n"; -printf "\n", - $oclass{$samba_group_class} ? "" : "checked", $text{'no'}; +# Samba group? +print &ui_table_row($text{'gedit_samba'}, + &ui_radio("samba", $oclass{$samba_group_class}, + [ [ 1, $text{'yes'} ], + [ 0, $text{'no'} ] ])); -print "\n"; - -print "
$text{'gedit_samba'} %s\n", - $oclass{$samba_group_class} ? "checked" : "", $text{'yes'}; -printf " %s

\n"; +print &ui_table_end(); # Show section for on-save or on-creation options if (!$in{'new'}) { - print "\n"; - print "\n"; - print "
$text{'onsave'}
\n"; + print &ui_table_start($text{'onsave'}, "width=100%", 2, + [ "width=30%" ]); - print "\n"; - print "\n"; + # Change GID on save + print &ui_table_row($text{'chgid'}, + &ui_radio("chgid", 0, + [ [ 0, $text{'no'} ], + [ 1, $text{'gedit_homedirs'} ], + [ 2, $text{'gedit_allfiles'} ] ])); - print "\n"; - printf "\n", - $mconfig{'default_other'} ? "" : "checked"; - print "
$text{'chgid'} $text{'no'}\n"; - print " $text{'gedit_homedirs'}\n"; - print " $text{'gedit_allfiles'}
$text{'gedit_mothers'} $text{'yes'}\n", - $mconfig{'default_other'} ? "checked" : ""; - printf " $text{'no'}
\n"; + # Update in other modules? + print &ui_table_row($text{'gedit_mothers'}, + &ui_radio("others", $mconfig{'default_other'}, + [ [ 1, $text{'yes'} ], + [ 0, $text{'no'} ] ])); + + print &ui_table_end(); } else { - print "\n"; - print "\n"; - print "
$text{'uedit_oncreate'}
\n"; + print &ui_table_start($text{'uedit_oncreate'}, "width=100%", 2, + [ "width=30%" ]); - print "\n"; - printf "\n", - $mconfig{'default_other'} ? "" : "checked"; - - print "
$text{'gedit_cothers'} $text{'yes'}\n", - $mconfig{'default_other'} ? "checked" : ""; - printf " $text{'no'}
\n"; + # Create in other modules? + print &ui_table_row($text{'gedit_cothers'}, + &ui_radio("others", $mconfig{'default_other'}, + [ [ 1, $text{'yes'} ], + [ 0, $text{'no'} ] ])); + print &ui_table_end(); } -print "\n"; -if ($in{'new'}) { - print "\n"; - } +# Save/delete/create buttons +if (!$in{'new'}) { + print &ui_form_end([ [ undef, $text{'save'} ], + [ 'raw', $text{'uedit_raw'} ], + [ 'delete', $text{'delete'} ], + ]); + } else { - print "\n"; - print "\n"; - print "\n"; - } -print "
\n"; + print &ui_form_end([ [ undef, $text{'create'} ] ]); + } &ui_print_footer("index.cgi?mode=groups", $text{'index_return'}); diff --git a/ldap-useradmin/raw.cgi b/ldap-useradmin/raw.cgi index bdf12c91a..988545049 100755 --- a/ldap-useradmin/raw.cgi +++ b/ldap-useradmin/raw.cgi @@ -19,19 +19,17 @@ else { &ui_print_header(&text('raw_for', $in{'dn'}), $text{'raw_title'}, ""); -print "\n"; -print "\n"; -print "\n"; foreach $a ($what->attributes()) { - print "\n"; - print "\n"; - print "\n"; + push(@table, [ "$a", + join(" , ", $what->get_value($a)) ]); } -print "
$text{'raw_name'}$text{'raw_value'}
$a",(join(" , ", $what->get_value($a)) || "
"),"
\n"; +print &ui_columns_table([ $text{'raw_name'}, $text{'raw_value'} ], + 100, \@table, undef); &ui_print_footer($in{'user'} ? ( "edit_user.cgi?dn=".&urlize($in{'dn'}), $text{'uedit_return'} ) : ( "edit_group.cgi?dn=".&urlize($in{'dn'}), $text{'gedit_return'} ), - "", $text{'index_return'}); + "index.cgi?mode=".($in{'user'} ? 'users' : 'groups'), + $text{'index_return'}); diff --git a/ldap-useradmin/save_group.cgi b/ldap-useradmin/save_group.cgi index 8e102a258..b6c4165bc 100755 --- a/ldap-useradmin/save_group.cgi +++ b/ldap-useradmin/save_group.cgi @@ -80,23 +80,21 @@ if ($in{'delete'}) { } else { # Ask the user if he is sure - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "

",&text('gdel_sure', $group),"

\n"; - print "\n"; - - printf "
%s
\n", - $mconfig{'default_other'} ? "checked" : "", - $text{'gdel_dothers'}; - print "

\n"; - print "

\n"; + print &ui_confirmation_form( + "save_group.cgi", + &text('gdel_sure', $group), + [ [ "dn", $in{'dn'} ], + [ "delete", 1 ] ], + [ [ "confirm", $text{'gdel_del'} ] ], + &ui_checkbox("others", 1, + $text{'gdel_dothers'}, + $mconfig{'default_other'}), + undef); } } $ldap->unbind(); - &ui_print_footer("", $text{'index_return'}); + &ui_print_footer("index.cgi?mode=groups", $text{'index_return'}); exit; } elsif ($in{'raw'}) {