Completed ui-lib conversion

This commit is contained in:
Jamie Cameron
2008-01-04 18:33:29 +00:00
parent 95632ff085
commit 1b6dcde30f
2 changed files with 31 additions and 47 deletions

2
grub/CHANGELOG Normal file
View File

@@ -0,0 +1,2 @@
---- Changes since 1.390 ----
Converted all code to use the new Webmin user interface library.

View File

@@ -7,68 +7,50 @@ require './grub-lib.pl';
$conf = &get_menu_config();
&ui_print_header(undef, $text{'global_title'}, "");
print "<form action=save_global.cgi>\n";
print "<table border width=100%>\n";
print "<tr $tb> <td><b>$text{'global_header'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print &ui_form_start("save_global.cgi");
print &ui_table_start($text{'global_header'}, "width=100%", 4);
# Default kernel to boot
$default = &find_value("default", $conf);
@titles = &find_value("title", $conf);
print "<tr> <td><b>$text{'global_default'}</b></td>\n";
print "<td><select name=default>\n";
printf "<option value='' %s>%s\n",
$default eq '' ? 'selected' : '', $text{'global_first'};
for($i=0; $i<@titles; $i++) {
printf "<option value=%s %s>%s\n",
$i, $default eq $i ? 'selected' : '', $titles[$i];
}
print "</select></td>\n";
print &ui_table_row($text{'global_default'},
&ui_select("default", $default,
[ [ '', $text{'global_first'} ],
map { [ $_, $titles[$i] ] } (0..$#titles) ]));
# Fallback kernel
$fallback = &find_value("fallback", $conf);
print "<td><b>$text{'global_fallback'}</b></td>\n";
print "<td><select name=fallback>\n";
printf "<option value='' %s>%s\n",
$fallback eq '' ? 'selected' : '', $text{'global_first'};
for($i=0; $i<@titles; $i++) {
printf "<option value=%s %s>%s\n",
$i, $fallback eq $i ? 'selected' : '', $titles[$i];
}
print "</select></td> </tr>\n";
print &ui_table_row($text{'global_fallback'},
&ui_select("fallback", $fallback,
[ [ '', $text{'global_first'} ],
map { [ $_, $titles[$i] ] } (0..$#titles) ]));
# Boot timeout
$timeout = &find_value("timeout", $conf);
print "<tr> <td><b>$text{'global_timeout'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=timeout_def value=1 %s> %s\n",
$timeout eq '' ? 'checked' : '', $text{'global_forever'};
printf "<input type=radio name=timeout_def value=0 %s>\n",
$timeout eq '' ? '' : 'checked';
printf "<input name=timeout size=5 value='%s'> %s</td> </tr>\n",
$timeout, $text{'global_secs'};
print &ui_table_row($text{'global_timeout'},
&ui_opt_textbox("timeout", $timeout, 5, $text{'global_forever'}).
" ".$text{'global_secs'}, 3);
# Boot-time password
$password = &find("password", $conf);
@pv = split(/\s+/, $password->{'value'}) if ($password);
print "<tr> <td valign=top><b>$text{'global_password'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=password_def value=1 %s> %s\n",
$password eq '' ? 'checked' : '', $text{'global_none'};
printf "<input type=radio name=password_def value=0 %s>\n",
$password eq '' ? '' : 'checked';
printf "<input name=password size=20 value='%s'><br>\n", $pv[0];
printf "<input type=checkbox name=password_file %s> %s\n",
$pv[1] ? "checked" : "", $text{'global_password_file'};
printf "<input name=password_filename size=30 value='%s'></td> </tr>\n", $pv[1];
print &ui_table_row($text{'global_password'},
&ui_opt_textbox("password", $password, 30, $text{'global_none'})."<br>".
&ui_checkbox("password_file", 1, $text{'global_password_file'}, $pv[1]).
" ".&ui_textbox("password_filename", $pv[1], 30), 3);
# Partition to install on
$r = $config{'install'};
$dev = &bios_to_linux($r);
$sel = &foreign_call("fdisk", "partition_select", "install", $dev, 2, \$found);
print "<td><b>$text{'global_install'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=install_mode value=1 %s> %s %s\n",
$found ? 'checked' : '', $text{'global_sel'}, $sel;
printf "<input type=radio name=install_mode value=0 %s> %s\n",
$found ? '' : 'checked', $text{'global_other'};
printf "<input name=other size=10 value='%s'></td> </tr>\n",
$found ? '' : $r;
print &ui_table_row($text{'global_install'},
&ui_radio("install_mode", $found ? 1 : 0,
[ [ 1, $text{'global_sel'}." ".$sel."<br>" ],
[ 0, $text{'global_other'}." ".
&ui_textbox("other", $found ? "" : $r, 30) ] ]), 3);
print "</table></td></tr></table>\n";
print "<input type=submit value=\"$text{'save'}\"></form>\n";
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'save'} ] ]);
&ui_print_footer("", $text{'index_return'});