mirror of
https://github.com/webmin/webmin.git
synced 2025-07-29 11:50:54 +00:00
Some ui-lib conversion
This commit is contained in:
@ -15,70 +15,58 @@ else {
|
||||
@user = @{$s->{'data'}->[0]};
|
||||
}
|
||||
|
||||
print "<form action=save_user.cgi>\n";
|
||||
print "<input type=hidden name=new value='$in{'new'}'>\n";
|
||||
print "<input type=hidden name=user value='$in{'user'}'>\n";
|
||||
print "<table border width=100%>\n";
|
||||
print "<tr $tb> <td><b>$text{'user_header'}</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table width=100%>\n";
|
||||
# Start of the form
|
||||
print &ui_form_start("save_user.cgi");
|
||||
print &ui_hidden("new", $in{'new'});
|
||||
print &ui_hidden("user", $in{'user'});
|
||||
print &ui_table_start($text{'user_header'}, undef, 2);
|
||||
|
||||
print "<tr> <td><b>$text{'user_name'}</b></td>\n";
|
||||
if ($in{'new'} || &get_postgresql_version() >= 7.4) {
|
||||
print "<td><input name=name value='$user[0]' size=20></td>\n";
|
||||
}
|
||||
else {
|
||||
print "<td>$user[0]</td>\n";
|
||||
}
|
||||
# Username, not always editable
|
||||
print &ui_table_row($text{'user_name'},
|
||||
$in{'new'} || &get_postgresql_version() >= 7.4 ?
|
||||
&ui_textbox("name", $user[0], 40) :
|
||||
$user[0]);
|
||||
|
||||
print "<td><b>$text{'user_passwd'}</b></td>\n";
|
||||
if ($in{'new'}) {
|
||||
# For new users, can select empty or specific password
|
||||
print "<td>",&ui_radio("pass_def", 1,
|
||||
print &ui_table_row($text{'user_passwd'},
|
||||
&ui_radio("pass_def", 1,
|
||||
[ [ 1, $text{'user_none'} ],
|
||||
[ 0, $text{'user_setto'} ] ]),"\n",
|
||||
&ui_password("pass", undef, 20),"</td> </tr>\n";
|
||||
[ 0, $text{'user_setto'} ] ])." ".
|
||||
&ui_password("pass", undef, 20));
|
||||
}
|
||||
else {
|
||||
# For existing users, can select empty, leave unchanged or
|
||||
# specific password
|
||||
print "<td>",&ui_radio("pass_def", 2,
|
||||
print &ui_table_row($text{'user_passwd'},
|
||||
&ui_radio("pass_def", 2,
|
||||
[ [ 2, $text{'user_nochange'} ],
|
||||
[ 0, $text{'user_setto'} ] ]),"\n",
|
||||
&ui_password("pass", undef, 20),"</td> </tr>\n";
|
||||
[ 0, $text{'user_setto'} ] ])." ".
|
||||
&ui_password("pass", undef, 20));
|
||||
}
|
||||
|
||||
print "<tr> <td><b>$text{'user_db'}</b></td>\n";
|
||||
printf "<td><input type=radio name=db value=1 %s> $text{'yes'}\n",
|
||||
$user[2] =~ /t|1/ ? 'checked' : '';
|
||||
printf "<input type=radio name=db value=0 %s> $text{'no'}</td>\n",
|
||||
$user[2] =~ /t|1/ ? '' : 'checked';
|
||||
# Can create databases?
|
||||
print &ui_table_row($text{'user_db'},
|
||||
&ui_yesno_radio("db", $user[2] =~ /t|1/));
|
||||
|
||||
print "<td><b>$text{'user_other'}</b></td>\n";
|
||||
printf "<td><input type=radio name=other value=1 %s> $text{'yes'}\n",
|
||||
$user[4] =~ /t|1/ ? 'checked' : '';
|
||||
printf "<input type=radio name=other value=0 %s> $text{'no'}</td> </tr>\n",
|
||||
$user[4] =~ /t|1/ ? '' : 'checked';
|
||||
# Create create other users?
|
||||
print &ui_table_row($text{'user_other'},
|
||||
&ui_yesno_radio("other", $user[4] =~ /t|1/));
|
||||
|
||||
print "<tr> <td><b>$text{'user_until'}</b></td> <td colspan=3>\n";
|
||||
if (!$user[6]) {
|
||||
printf "<input type=radio name=until_def value=1 %s> %s\n",
|
||||
$user[6] ? '' : 'checked', $text{'user_forever'};
|
||||
printf "<input type=radio name=until_def value=0 %s>\n",
|
||||
$user[6] ? 'checked' : '';
|
||||
}
|
||||
print "<input name=until size=30 value='$user[6]'></td> </tr>\n";
|
||||
# Valid until
|
||||
print &ui_table_row($text{'user_until'},
|
||||
$user[6] ? &ui_textbox("until", $user[6], 40) :
|
||||
&ui_opt_textbox("until", $user[6], 40, $text{'user_forever'}));
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<table width=100%><tr>\n";
|
||||
# End of form and buttons
|
||||
print &ui_table_end();
|
||||
if ($in{'new'}) {
|
||||
print "<td><input type=submit value='$text{'create'}'></td>\n";
|
||||
print &ui_form_end([ [ undef, $text{'create'} ] ]);
|
||||
}
|
||||
else {
|
||||
print "<td><input type=submit value='$text{'save'}'></td>\n";
|
||||
print "<td align=right><input type=submit name=delete ",
|
||||
"value='$text{'delete'}'></td>\n";
|
||||
print &ui_form_end([ [ undef, $text{'save'} ],
|
||||
[ 'delete', $text{'delete'} ] ]);
|
||||
}
|
||||
print "</tr></table>\n";
|
||||
|
||||
&ui_print_footer("list_users.cgi", $text{'user_return'});
|
||||
|
||||
|
Reference in New Issue
Block a user