--- loncom/interface/lonhelp.pm 2006/03/16 17:18:34 1.22 +++ loncom/interface/lonhelp.pm 2006/05/23 18:13:07 1.26 @@ -53,18 +53,17 @@ sub processLabelName { # Serve out the text sub servetext { my ($r,$text) = @_; - my $html=&Apache::lonxml::xmlbegin(); - my $htmlend=&Apache::lonxml::xmlend(); my $bugs=&Apache::loncommon::help_open_bug('Documentation'); + my $start_page= + &Apache::loncommon::start_page('LON-CAPA Help',undef, + {'only_body' => 1,}); + my $end_page= + &Apache::loncommon::end_page(); my $header=&mt('LON-CAPA Help'); $r->print(< - LON-CAPA Help - - -

$header
$bugs

+ $start_page +

help logo$header


$bugs HEADER @@ -73,21 +72,23 @@ HEADER if (&Apache::lonnavmaps::advancedUser()) { my $search=&mt('Search LON-CAPA help'); my $about=&mt('About LON-CAPA help and More Help'); + my $query=&mt('Search'); + my $uri = $r->uri; $r->print(< -
-$search:
+
+$search: +
+
$about - -$htmlend FOOTER - } else { - $r->print(<print(< - -$htmlend + $end_page ENDBODY - } + } # Render takes a tex fragment, transforms it for TtH, and returns the @@ -144,12 +145,13 @@ sub render { } sub listmatches { - my ($docroot,$term) =@_; + my ($docroot,$term,$subdir) =@_; + unless ($subdir) { $subdir=''; } my $output=''; - opendir(DIR,$docroot.'/adm/help/tex/'); + opendir(DIR,$docroot.'/adm/help/tex/'.$subdir); foreach my $filename (sort readdir(DIR)) { if ($filename=~/\.tex$/) { - open(FH,$docroot.'/adm/help/tex/'.$filename); + open(FH,$docroot.'/adm/help/tex/'.$subdir.$filename); my $quote=''; while (my $line=) { if ($line=~/\Q$term\E/i) { @@ -157,7 +159,9 @@ sub listmatches { $line=~s/\{//gs; $line=~s/\}//gs; $line=~s/\\/ /gs; - $line=~s/\Q$term\E/\$term\<\/b\>/gsi; + $line=~s/(\Q$term\E)/\$1\<\/b\>/gsi; + $line=~s/\/\>\;/gs; $quote.='
...'.$line.'...'; } } @@ -167,12 +171,12 @@ sub listmatches { $title=~s/\_/ /gs; $title=~s/\.tex$//; $filename=~s/\.tex$/\.hlp/; - $output.='
  • '.$title.''.$quote.'
  • '; + $output.='
  • '.$title.''.$quote.'
  • '; } } } closedir(DIR); - return ($output?'
      '.$output.'
    ':&mt('"[_1]" not found',$term)); + return (($output?'
      '.$output.'
    ':&mt('"[_1]" not found',$term)),$output); } sub handler { @@ -185,7 +189,15 @@ sub handler { my $text=''; if ($env{'form.searchterm'}=~/\w/) { &Apache::loncommon::content_type($r,"text/html"); - $text=&listmatches($docroot,$env{'form.searchterm'}); + ($text,my $matches)=&listmatches($docroot,$env{'form.searchterm'},&Apache::lonlocal::current_language().'/'); + if ($matches) { + my ($englishresult,$englishmatches)=&listmatches($docroot,$env{'form.searchterm'}); + if ($englishmatches) { + $text.='
    '.$englishresult; + } + } else { + $text=&listmatches($docroot,$env{'form.searchterm'}); + } } else { my $filenames = &Apache::lonnet::unescape(substr ($ENV{'REQUEST_URI'} , rindex($ENV{'REQUEST_URI'}, '/') + 1, -4));