Annotation of loncom/xml/lontex.pm, revision 1.8

1.1       harris41    1: # The LearningOnline Network with CAPA
                      2: # TeX Content Handler
                      3: #
1.8     ! albertel    4: # $Id: lontex.pm,v 1.7 2005/04/07 06:56:27 albertel Exp $
1.3       www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
                     28: #
                     29: # Copyright for TtHfunc and TtMfunc by Ian Hutchinson. 
                     30: # TtHfunc and TtMfunc (the "Code") may be compiled and linked into 
                     31: # binary executable programs or libraries distributed by the 
                     32: # Michigan State University (the "Licensee"), but any binaries so 
                     33: # distributed are hereby licensed only for use in the context
                     34: # of a program or computational system for which the Licensee is the 
                     35: # primary author or distributor, and which performs substantial 
                     36: # additional tasks beyond the translation of (La)TeX into HTML.
                     37: # The C source of the Code may not be distributed by the Licensee
                     38: # to any other parties under any circumstances.
                     39: #
1.1       harris41   40: # 05/29/00,05/30,10/11 Gerd Kortemeyer
                     41: 
                     42: package Apache::lontex;
                     43: 
                     44: use strict;
                     45: use Apache::File;
                     46: use Apache::lontexconvert;
                     47: use Apache::Constants qw(:common);
1.7       albertel   48: use Apache::lonnet;
1.1       harris41   49: use tth;
                     50: 
                     51: # ================================================================ Main Handler
                     52: 
                     53: sub handler {
                     54:   my $r=shift;
                     55:   my @texcontents;
                     56:   my $texstring;
                     57: 
                     58: # ----------------------------------------------------------- Set document type
                     59: 
1.7       albertel   60:   if ($env{'browser.mathml'}) {
1.6       albertel   61:       &Apache::loncommon::content_type($r,'text/xml');
1.1       harris41   62:   } else {
1.6       albertel   63:       &Apache::loncommon::content_type($r,'text/html');
1.1       harris41   64:   }
                     65:   $r->send_http_header;
                     66: 
                     67:   return OK if $r->header_only;
                     68: 
                     69: # ------------------------------------------------------------------- Read file
                     70: 
                     71:   {
                     72:     my $fh=Apache::File->new($r->filename);
                     73:     @texcontents=<$fh>;
                     74:   }
                     75: 
                     76:   $texstring=join("\n",@texcontents);
                     77: 
                     78: # --------------------------------------------------------------- Render Output
                     79:   
1.8     ! albertel   80:   &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['mode',
        !            81: 								'buttons']);
        !            82: 
1.1       harris41   83:   $r->print(&Apache::lontexconvert::header());
1.2       www        84:   $r->print(
1.4       www        85:     '<body bgcolor="#FFFFFF" onLoad="'.
                     86:       &Apache::lonmenu::loadevents().
                     87:     '" onUnload="'.
                     88:       &Apache::lonmenu::unloadevents().
1.8     ! albertel   89: 	    '">');
        !            90:   if ($env{'form.buttons'} ne 'no') {
        !            91:       $r->print(&Apache::lonmenu::menubuttons(undef,'web',1));
        !            92:   }
        !            93:   &Apache::lontexconvert::jsMath_reset();
        !            94:   if ($env{'form.mode'} eq 'jsMath') {
        !            95:       $r->print(&Apache::lontexconvert::jsMath_header());
        !            96:   }
        !            97:   $r->print(&Apache::lontexconvert::converted(\$texstring,$env{'form.mode'}));
1.1       harris41   98:   $r->print('</body>');
                     99:   $r->print(&Apache::lontexconvert::footer());
                    100: 
                    101:   return OK;
                    102: }
                    103: 
                    104: 1;
                    105: __END__
                    106: 
                    107: 
                    108: 
                    109: 
                    110: 
                    111: 
                    112: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>