--- loncom/interface/lonhelp.pm 2006/05/23 18:13:07 1.26 +++ loncom/interface/lonhelp.pm 2006/06/26 22:22:00 1.28 @@ -1,4 +1,7 @@ # The LearningOnline Network with CAPA +# +# $Id: lonhelp.pm,v 1.28 2006/06/26 22:22:00 albertel Exp $ +# # .tex help system web server handler # # Copyright Michigan State University Board of Trustees @@ -24,8 +27,7 @@ # http://www.lon-capa.org/ # # .tex file help handler -# YEAR=2002 -# 7/4 Jeremy Bowers + package Apache::lonhelp; @@ -40,6 +42,9 @@ use Apache::lonlocal; use Apache::lonnet; use tth(); use GDBM_File(); +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + # This sub takes the name of a label in, and converts it to something # that is a valid anchor name. @@ -186,9 +191,9 @@ sub handler { my $serverroot = $ENV{'HTTP_HOST'}; &Apache::lonlocal::get_language_handle($r); + &Apache::loncommon::content_type($r,"text/html"); my $text=''; if ($env{'form.searchterm'}=~/\w/) { - &Apache::loncommon::content_type($r,"text/html"); ($text,my $matches)=&listmatches($docroot,$env{'form.searchterm'},&Apache::lonlocal::current_language().'/'); if ($matches) { my ($englishresult,$englishmatches)=&listmatches($docroot,$env{'form.searchterm'}); @@ -199,7 +204,7 @@ sub handler { $text=&listmatches($docroot,$env{'form.searchterm'}); } } else { - my $filenames = &Apache::lonnet::unescape(substr ($ENV{'REQUEST_URI'} , + my $filenames = &unescape(substr ($ENV{'REQUEST_URI'} , rindex($ENV{'REQUEST_URI'}, '/') + 1, -4)); # Security check on the file; the whole filename must consist @@ -228,24 +233,7 @@ sub handler { or return HTTP_NOT_FOUND; $tex .= join('', <$file>); } - - if ($env{'browser.mathml'}) { - &Apache::loncommon::content_type($r,'text/xml'); - &tth::ttminit(); - if ($env{'browser.unicode'}) { - &tth::ttmoptions('-L -u1'); - } else { - &tth::ttmoptions('-L -u0'); - } - } else { - &Apache::loncommon::content_type($r,"text/html"); - &tth::tthinit(); - if ($env{'browser.unicode'}) { - &tth::tthoptions('-L -u1'); - } else { - &tth::tthoptions('-L -u0'); - } - } + $text = &render($tex, $docroot, $serverroot); }