2 # Search Webmin modules and help pages and text and config.info
4 $trust_unknown_referers = 1;
5 BEGIN { push(@INC, ".."); };
9 do 'webmin-search-lib.pl';
12 $prod = &get_product_name();
13 $ucprod = ucfirst($prod);
14 &ui_print_unbuffered_header(undef,
15 $in{'title'} || &text('wsearch_title', $ucprod), "", undef, 0, 1);
17 # Validate search text
20 &error($text{'wsearch_esearch'});
25 # Find modules to search
29 my %infos = map { $_->{'dir'}, $_ } &get_all_module_infos();
30 foreach my $mn (split(/\0/, $in{'mod'})) {
31 my $minfo = $infos{$mn};
32 push(@$mods, $minfo) if ($minfo);
37 print &text('wsearch_searching', "<i>".&html_escape($re)."</i>"),"\n";
38 @rv = &search_webmin($re, \&print_search_dot, $mods);
39 print &text('wsearch_found', scalar(@rv)),"<p>\n";
43 print &ui_columns_start(
44 [ $text{'wsearch_htext'}, $text{'wsearch_htype'},
45 $text{'wsearch_hmod'}, $text{'wsearch_hcgis'} ], 100);
47 $hi = &highlight_text($r->{'text'});
49 $hi = "<a href='$r->{'link'}'>$hi</a>";
52 foreach my $c (@{$r->{'cgis'}}) {
53 ($cmod, $cpage) = split(/\//, $c);
54 ($cpage, $cargs) = split(/\?/, $cpage);
55 $ctitle = &cgi_page_title($cmod, $cpage) || $cpage;
56 if ($r->{'mod'}->{'installed'}) {
57 $cargs ||= &cgi_page_args($cmod, $cpage);
60 # For modules that aren't installed, linking
61 # to a CGI is likely useless
64 if ($cargs eq "none") {
65 push(@links, $ctitle);
68 $cargs = "?".$cargs if ($cargs ne '' &&
69 $cargs !~ /^(\/|%2F)/);
71 "<a href='$cmod/$cpage$cargs'>$ctitle</a>");
75 @links = ( @links[0..1], "..." );
77 print &ui_columns_row([
79 $text{'wsearch_type_'.$r->{'type'}},
80 "<a href='$r->{'mod'}->{'dir'}/'>$r->{'mod'}->{'desc'}</a>",
81 &ui_links_row(\@links),
84 print &ui_columns_end();
87 print "<b>",&text('wsearch_enone',
88 "<tt>".&html_escape($re)."</tt>"),"</b><p>\n";
94 # Print one dot per second
98 if ($now > $last_print_search_dot) {
100 $last_print_search_dot = $now;