\n";
+# Start of the form
+print &ui_form_start("save_user.cgi", "post");
+print &ui_hidden("new", $in{'new'});
+print &ui_hidden("dn", $in{'dn'});
+print &ui_table_start($text{'uedit_details'}, "width=100%", 2, \@tds);
+# DN and classes
if (!$in{'new'}) {
- print " | $text{'uedit_dn'} | \n";
- print "$in{'dn'} | \n";
+ print &ui_table_row($text{'uedit_dn'},
+ "$in{'dn'}", 3);
- print " | $text{'uedit_classes'} | \n";
- print "",join(" , ", map { "$_" }
- $uinfo->get_value('objectClass'))," | \n";
+ print &ui_table_row($text{'uedit_classes'},
+ ,join(" , ", map { "$_" }
+ $uinfo->get_value('objectClass')), 3);
}
# Show username input
-print " | $text{'user'} | \n";
-if (@users > 1) {
- print " | \n";
- }
-else {
- print " | \n";
- }
+print &ui_table_row($text{'user'},
+ @users > 1 ? &ui_textarea("user", join("\n", @users), 2, 10)
+ : &ui_textbox("user", $user, 20));
# Show UID input, filled in with a default for new users
-print "$text{'uid'} | \n";
if ($in{'new'}) {
# Find the first free UID above the base
$newuid = $mconfig{'base_uid'};
while(&check_uid_used($ldap, $newuid)) {
$newuid++;
}
- print " | \n";
+ $uidfield = &ui_textbox("uid", $newuid, 10);
}
else {
- print " | \n";
+ $uidfield = &ui_textbox("uid", $uid, 10);
}
+print &ui_table_row($text{'uid'}, $uidfield);
if ($config{'given'}) {
# Show Full name inputs
@@ -137,49 +131,39 @@ if ($config{'given'}) {
$onch = "onChange='form.real.value = form.lastname.value+\", \"+form.firstname.value'";
}
}
- print " | $text{'uedit_firstname'} | \n";
- print " | \n";
+ print &ui_table_row($text{'uedit_firstname'},
+ &ui_textbox("firstname", $firstname, 20, 0, undef, $onch));
- print "$text{'uedit_lastname'} | \n";
- print " | \n";
+ print &ui_table_row($text{'uedit_lastname'},
+ &ui_textbox("lastname", $lastname, 20, 0, undef, $onch));
}
# Show real name input
-print " | $text{'real'} | \n";
-print " | \n";
+print &ui_table_row($text{'real'},
+ &ui_textbox("real", $real, 40));
# Show home directory input, with an 'automatic' option
-print "$text{'home'} | \n";
-print "\n";
if ($mconfig{'home_base'}) {
local $hb = $in{'new'} ||
&auto_home_dir($mconfig{'home_base'}, $user) eq $home;
- printf " %s\n",
- $hb ? "checked" : "", $text{'uedit_auto'};
- printf "\n",
- $hb ? "" : "checked";
- printf " %s\n",
- $hb ? "" : $home,
- &file_chooser_button("home", 1);
+ $homefield = &ui_radio("home_base", $hb ? 1 : 0,
+ [ [ 1, $text{'uedit_auto'} ],
+ [ 0, &ui_filebox("home", $hb ? "" : $home,
+ 25, 0, undef, undef, 1) ]
+ ]);
}
else {
- print "\n",
- &file_chooser_button("home", 1);
+ $homefield = &ui_filebox("home", $home, 25, 0, undef, undef, 1);
}
-print " | \n";
+print &ui_table_row(&hlink($text{'home'}, "home"), $homefield);
# Show shell selection menu
-print " | $text{'shell'} | \n";
-print " | \n";
+print &ui_table_row($text{'shell'},
+ &ui_select("shell", $uinfo{'shell'}, \@shlist, 1, 0, 0, 0,
+ "onChange='form.othersh.disabled = form.shell.value != \"*\"'").
+ &ui_filebox("othersh", undef, 40, 1));
-# Show password fields
+# Generate password if needed
if ($in{'new'} && $mconfig{'random_password'}) {
&seed_random();
foreach (1 .. 15) {
@@ -187,7 +171,9 @@ if ($in{'new'} && $mconfig{'random_password'}) {
rand(scalar(@random_password_chars))];
}
}
-if (%uinfo && $pass ne $config{'lock_string'} && $pass ne "") {
+
+# Check if temporary locking is supported
+if (!$in{'new'} && $pass ne $mconfig{'lock_string'} && $pass ne "") {
# Can disable if not already locked, or if a new account
$can_disable = 1;
if ($pass =~ /^\Q$useradmin::disable_string\E/) {
@@ -195,69 +181,52 @@ if (%uinfo && $pass ne $config{'lock_string'} && $pass ne "") {
$pass =~ s/^\Q$useradmin::disable_string\E//;
}
}
-elsif (!%uinfo) {
+elsif ($in{'new'}) {
$can_disable = 1;
}
-print "$text{'pass'}",
- " | \n";
-printf" %s \n",
- $pass eq "" && $random_password eq "" ? "checked" : "",
- $mconfig{'empty_mode'} ? $text{'none1'} : $text{'none2'};
-printf" $text{'nologin'} \n",
- $pass eq $mconfig{'lock_string'} && $random_password eq "" ? "checked" : "";
-printf " $text{'clear'}\n",
- $random_password ne "" ? "checked" : "";
-printf " \n",
- $mconfig{'passwd_stars'} ? "type=password" : "",
- $mconfig{'random_password'} && $n eq "" ? $random_password : "";
+# Show password field
+$passmode = $pass eq "" && $random_password eq "" ? 0 :
+ $pass eq $mconfig{'lock_string'} && $random_password eq "" ? 1 :
+ $random_password ne "" ? 3 :
+ $pass && $pass ne $mconfig{'lock_string'} &&
+ $random_password eq "" ? 2 : -1;
+$pffunc = $mconfig{'passwd_stars'} ? \&ui_password : \&ui_textbox;
+print &ui_table_row(&hlink($text{'pass'}, "pass"),
+ &ui_radio_table("passmode", $passmode,
+ [ [ 0, $mconfig{'empty_mode'} ? $text{'none1'} : $text{'none2'} ],
+ [ 1, $text{'nologin'} ],
+ [ 3, $text{'clear'},
+ &$pffunc("pass", $mconfig{'random_password'} && $n eq "" ?
+ $random_password : "", 15) ],
+ $access{'nocrypt'} ? ( [ 2, $text{'nochange'},
+ &ui_hidden("encpass", $pass) ] ) :
+ ( [ 2, $text{'encrypted'},
+ &ui_textbox("encpass", $passmode == 2 ? $pass : "", 40) ] )
+ ]).
+ ($can_disable ? " ".&ui_checkbox("disable", 1,
+ $text{'uedit_disabled'}, $disabled) : "")
+ );
-printf " $text{'encrypted'}\n",
- $pass && $pass ne $mconfig{'lock_string'} ? "checked" : "";
-printf "\n",
- $pass && $pass ne $mconfig{'lock_string'} ? $pass : "";
-
-# Show password lock checkbox
-if ($can_disable) {
- printf " ".
- " %s\n",
- $disabled ? "checked" : "", $text{'uedit_disabled'};
- }
-
-print " | \n";
-
-# Show alternate shell field
-print " | $text{'uedit_other'} | \n";
-print "\n";
-print &file_chooser_button("othersh", 0)," | \n";
-print "
| \n";
-
-print " |