2 # Search Webmin modules and help pages and text and config.info
4 BEGIN { push(@INC, ".."); };
8 do 'webmin-search-lib.pl';
11 $prod = &get_product_name();
12 $ucprod = ucfirst($prod);
13 &ui_print_unbuffered_header(
14 undef, &text('wsearch_title', $ucprod), "", undef, 0, 1);
16 # Validate search text
19 &error($text{'wsearch_esearch'});
25 print &text('wsearch_searching', "<i>".&html_escape($re)."</i>"),"\n";
26 @rv = &search_webmin($re, \&print_search_dot);
27 print &text('wsearch_found', scalar(@rv)),"<p>\n";
31 print &ui_columns_start(
32 [ $text{'wsearch_htext'}, $text{'wsearch_htype'},
33 $text{'wsearch_hmod'}, $text{'wsearch_hcgis'} ], 100);
35 $hi = &highlight_text($r->{'text'});
37 $hi = "<a href='$r->{'link'}'>$hi</a>";
40 foreach my $c (@{$r->{'cgis'}}) {
41 ($cmod, $cpage) = split(/\//, $c);
42 ($cpage, $cargs) = split(/\?/, $cpage);
43 $ctitle = &cgi_page_title($cmod, $cpage) || $cpage;
44 if ($r->{'mod'}->{'installed'}) {
45 $cargs ||= &cgi_page_args($cmod, $cpage);
48 # For modules that aren't installed, linking
49 # to a CGI is likely useless
52 if ($cargs eq "none") {
53 push(@links, $ctitle);
56 $cargs = "?".$cargs if ($cargs ne '' &&
57 $cargs !~ /^(\/|%2F)/);
59 "<a href='$cmod/$cpage$cargs'>$ctitle</a>");
63 @links = ( @links[0..1], "..." );
65 print &ui_columns_row([
67 $text{'wsearch_type_'.$r->{'type'}},
68 "<a href='$r->{'mod'}->{'dir'}/'>$r->{'mod'}->{'desc'}</a>",
69 &ui_links_row(\@links),
72 print &ui_columns_end();
75 print "<b>",&text('wsearch_enone',
76 "<tt>".&html_escape($re)."</tt>"),"</b><p>\n";
82 # Print one dot per second
86 if ($now > $last_print_search_dot) {
88 $last_print_search_dot = $now;