Handle hostnames with upper-case letters
[webmin.git] / grub / index.cgi
1 #!/usr/local/bin/perl
2 # index.cgi
3 # Display GRUB menu titles
4
5 require './grub-lib.pl';
6 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
7         &help_search_link("grub", "man", "doc"));
8
9 # Check that GRUB is installed
10 if (!-r $config{'menu_file'}) {
11         print "<p>",&text('index_efile', "<tt>$config{'menu_file'}</tt>",
12                           "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
13         &ui_print_footer("/", $text{'index'});
14         exit;
15         }
16 if (!&has_command($config{'grub_path'})) {
17         print "<p>",&text('index_epath', "<tt>$config{'grub_path'}</tt>",
18                           "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
19         &ui_print_footer("/", $text{'index'});
20         exit;
21         }
22
23 # List the boot options
24 @crlinks = ( "<a href='edit_title.cgi?new=1'>$text{'index_add'}</a>" );
25 $conf = &get_menu_config();
26 $def = &find_value("default", $conf);
27 @t = &find("title", $conf);
28 $i = 0;
29 foreach $t (@t) {
30         push(@icons, $t->{'chainloader'} ? "images/chain.gif"
31                                          : "images/kernel.gif");
32         local $tt = &html_escape($t->{'value'});
33         push(@titles, $def == $i ? "<b>$tt</b>" : $tt);
34         push(@links, "edit_title.cgi?idx=$t->{'index'}");
35         push(@befores, $i == 0 ? "&lt;&lt;&nbsp;|&nbsp;" :
36                 "<a href='up.cgi?idx=$i'>".
37                 "&lt;&lt;</a>&nbsp;|&nbsp;");
38         push(@afters, $i == @t-1 ? "&nbsp;|&nbsp;&gt;&gt;" :
39                 "&nbsp;|&nbsp;<a href='down.cgi?idx=$i'>".
40                 "&gt;&gt;</a>");
41         $i++;
42         }
43 if (@links) {
44         print &ui_links_row(\@crlinks);
45         &icons_table(\@links, \@titles, \@icons, 4, undef, undef, undef,
46                      \@befores, \@afters);
47         }
48 else {
49         print "<b>$text{'index_none'}</b><p>\n";
50         }
51 print &ui_links_row(\@crlinks);
52 print &ui_hr();
53
54 print &ui_buttons_start();
55
56 # Global options button
57 print &ui_buttons_row("edit_global.cgi", $text{'index_global'},
58                       $text{'index_globalmsg'});
59
60 # Install button
61 %flang = &load_language('fdisk');
62 $text{'select_part'} = $flang{'select_part'};
63 $text{'select_device'} = $flang{'select_device'};
64 $text{'select_fd'} = $flang{'select_fd'};
65 $r = $config{'install'};
66 $dev = &bios_to_linux($r);
67 &foreign_require("mount", "mount-lib.pl");
68 $dev = &mount::device_name($dev);
69 print &ui_buttons_row("install.cgi", $text{'index_install'},
70                       &text('index_installmsg', $dev),
71                       &ui_hidden("dev", $dev));
72
73 print &ui_buttons_end();
74
75 &ui_print_footer("/", $text{'index'});
76