--- loncom/xml/lontex.pm 2005/08/16 16:31:14 1.8 +++ loncom/xml/lontex.pm 2006/03/24 18:09:23 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Content Handler # -# $Id: lontex.pm,v 1.8 2005/08/16 16:31:14 albertel Exp $ +# $Id: lontex.pm,v 1.9 2006/03/24 18:09:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -50,8 +50,23 @@ 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; @@ -77,26 +92,26 @@ sub handler { # --------------------------------------------------------------- Render Output - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['mode', - 'buttons']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, + ['texengine','inhibitmenu']); - $r->print(&Apache::lontexconvert::header()); - $r->print( - ''); - if ($env{'form.buttons'} ne 'no') { - $r->print(&Apache::lonmenu::menubuttons(undef,'web',1)); - } - &Apache::lontexconvert::jsMath_reset(); - if ($env{'form.mode'} eq 'jsMath') { - $r->print(&Apache::lontexconvert::jsMath_header()); - } - $r->print(&Apache::lontexconvert::converted(\$texstring,$env{'form.mode'})); - $r->print(''); - $r->print(&Apache::lontexconvert::footer()); + + &Apache::lontexconvert::init_tth(); + my $load_items = + 'onLoad="' .&Apache::lonmenu::loadevents(). '" '. + 'onUnload="'.&Apache::lonmenu::unloadevents().'" '; + + $r->print(&Apache::loncommon::start_page(undef,undef, + {'add_entries' => $load_items, + '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; }