Handle hostnames with upper-case letters
[webmin.git] / man / index.cgi
1 #!/usr/local/bin/perl
2 # index.cgi
3 # Display the manual pages search form
4
5 require './man-lib.pl';
6 &ui_print_header(undef, $text{'index_title'}, "", "intro", $module_info{'usermin'} ? 0 : 1, 1);
7
8 # build list of available search options
9 @search = ( "man", "help" );
10 foreach $d (split(/\s+/, $config{'doc_dir'})) {
11         if (-d $d) {
12                 push(@search, "doc");
13                 last;
14                 }
15         }
16 foreach $h (split(/\s+/, $config{'howto_dir'})) {
17         if (-d $h) {
18                 push(@search, "howto");
19                 last;
20                 }
21         }
22 if (-d $config{'kde_dir'}) {
23         push(@search, "kde");
24         }
25 if (-d $config{'kernel_dir'}) {
26         push(@search, "kernel");
27         }
28 if ($perl_doc) {
29         push(@search, "perl");
30         }
31 if (-d $config{'custom_dir'}) {
32         push(@search, "custom");
33         }
34 push(@search, "google");
35
36 # display the search form
37 print &ui_form_start("search.cgi");
38 print &ui_table_start($text{'index_header'}, undef, 2);
39
40 # Search box and boolean mode
41 print &ui_table_row($text{'index_for'},
42         &ui_textbox("for", undef, 50)."<br>".
43         &ui_radio("and", 1, [ [ 1, $text{'index_and'} ],
44                               [ 0, $text{'index_or'} ] ]));
45
46 # Exact match
47 print &ui_table_row($text{'index_type'},
48         &ui_radio("exact", 1, [ [ 1, $text{'index_name'} ],
49                                 [ 0, $text{'index_data'} ] ]));
50
51 # Sections to search
52 $sects = "";
53 foreach $s (@search) {
54         $txt = $text{"index_${s}"};
55         $txt = $config{'custom_desc'}
56                 if ($s eq "custom" && $config{'custom_desc'});
57         $sects .= &ui_checkbox("section", $s, $txt, $s eq 'man')."<br>\n";
58         }
59 print &ui_table_row($text{'index_where'}, $sects);
60
61 print &ui_table_end();
62 print &ui_form_end([ [ undef, $text{'index_search'} ] ]);
63
64 # Form to control search from other modules
65 if (!$module_info{'usermin'}) {
66         @check = $config{'check'} ? split(/\s+/, $config{'check'}) : @search;
67         print &ui_hr();
68         print &ui_form_start("save_check.cgi");
69         print &ui_hidden("count", scalar(@search));
70         print "<b>$text{'index_others'}</b><br>\n";
71         @grid = ( );
72         foreach $s (@search) {
73                 push(@grid, &ui_checkbox("check", $s, $text{"index_other_${s}"},
74                                          &indexof($s, @check) >= 0));
75                 }
76         print &ui_grid_table(\@grid, 3);
77         print &ui_form_end([ [ undef, $text{'save'} ] ]);
78         }
79
80 &ui_print_footer("/", $text{'index'});
81