--- loncom/xml/lontex.pm 2001/11/29 19:03:58 1.3 +++ loncom/xml/lontex.pm 2008/11/24 17:17:52 1.13 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Content Handler # -# $Id: lontex.pm,v 1.3 2001/11/29 19:03:58 www Exp $ +# $Id: lontex.pm,v 1.13 2008/11/24 17:17:52 jms Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,21 +45,37 @@ use strict; use Apache::File; use Apache::lontexconvert; use Apache::Constants qw(:common); +use Apache::lonnet; use tth; # ================================================================ Main Handler +sub footer { + my ($errorstring) = @_; + my $xmlstring=''; + if ($env{'request.state'} eq 'construct') { + $xmlstring.='
'. + $Apache::lontexconvert::errorstring.'
'; + } else { + &Apache::lonmsg::author_res_msg($env{'request.filename'}, + $Apache::lonxml::errorstring); + } +# -------------------------------------------------------------------- End Body + $xmlstring.=&Apache::loncommon::end_page({'discussion' => 1}); + return $xmlstring; +} + sub handler { - my $r=shift; + my ($r)= @_; my @texcontents; my $texstring; # ----------------------------------------------------------- Set document type - if ($ENV{'browser.mathml'}) { - $r->content_type('text/xml'); + if ($env{'browser.mathml'}) { + &Apache::loncommon::content_type($r,'text/xml'); } else { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); } $r->send_http_header; @@ -76,12 +92,20 @@ sub handler { # --------------------------------------------------------------- Render Output - $r->print(&Apache::lontexconvert::header()); - $r->print( - ''); - $r->print(&Apache::lontexconvert::converted(\$texstring)); - $r->print(''); - $r->print(&Apache::lontexconvert::footer()); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['texengine','inhibitmenu']); + + + $r->print(&Apache::loncommon::start_page(undef,undef, + {'bgcolor' => '#FFFFFF', + 'force_register' => 1, + 'only_body' => + ($env{'form.inhibitmenu'} + eq 'yes'), })); + + $r->print(&Apache::lontexconvert::converted(\$texstring, + $env{'form.texengine'})); + $r->print(&footer()); return OK; } @@ -89,6 +113,32 @@ sub handler { 1; __END__ +=pod + +=head1 NAME + +Apache::lontex.pm + +=head1 SYNOPSIS + +Handler for tex files (somewhere in modules) + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + + +=head1 SUBROUTINES + +=over + +=item footer() + +Main Handler + +=back + +=cut +