--- loncom/xml/lontex.pm 2003/02/17 17:34:17 1.5 +++ loncom/xml/lontex.pm 2006/04/10 22:30:11 1.10 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Content Handler # -# $Id: lontex.pm,v 1.5 2003/02/17 17:34:17 www Exp $ +# $Id: lontex.pm,v 1.10 2006/04/10 22:30:11 albertel 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::lonxml::xmlend(); + 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,18 +92,22 @@ sub handler { # --------------------------------------------------------------- Render Output - $r->print(&Apache::lontexconvert::header()); - $r->print( - ''. - &Apache::lonmenu::menubuttons(undef,'web',1) - ); - $r->print(&Apache::lontexconvert::converted(\$texstring)); - $r->print(''); - $r->print(&Apache::lontexconvert::footer()); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['texengine','inhibitmenu']); + + + &Apache::lontexconvert::init_tth(); + + $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; }