version 1.9, 2006/03/24 18:09:23
|
version 1.16, 2025/02/20 03:46:11
|
Line 46 use Apache::File;
|
Line 46 use Apache::File;
|
use Apache::lontexconvert; |
use Apache::lontexconvert; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::loncommon; |
|
use Apache::lonmsg; |
|
use Apache::lonlocal; |
use tth; |
use tth; |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
|
|
sub footer { |
sub footer { |
my ($errorstring) = @_; |
|
my $xmlstring=''; |
my $xmlstring=''; |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
$xmlstring.='<address>'. |
$xmlstring.='<address>'. |
Line 61 sub footer {
|
Line 63 sub footer {
|
$Apache::lonxml::errorstring); |
$Apache::lonxml::errorstring); |
} |
} |
# -------------------------------------------------------------------- End Body |
# -------------------------------------------------------------------- End Body |
$xmlstring.=&Apache::lonxml::xmlend(); |
$xmlstring.=&Apache::loncommon::end_page({'discussion' => 1}); |
return $xmlstring; |
return $xmlstring; |
} |
} |
|
|
Line 84 sub handler {
|
Line 86 sub handler {
|
# ------------------------------------------------------------------- Read file |
# ------------------------------------------------------------------- Read file |
|
|
{ |
{ |
my $fh=Apache::File->new($r->filename); |
if (-e $r->filename) { |
@texcontents=<$fh>; |
my $fh=Apache::File->new($r->filename); |
|
@texcontents=<$fh>; |
|
close($fh); |
|
} else { |
|
my $filename=(split('/',$r->filename))[-1]; |
|
my $error = &mt('Unable to find [_1]', |
|
'<span class="LC_filename">'.$filename.'</span>'); |
|
&Apache::loncommon::simple_error_page($r,'Not available', |
|
$error,{'no_auto_mt_msg' => 1}); |
|
return OK; |
|
} |
} |
} |
|
|
$texstring=join("\n",@texcontents); |
$texstring=join("\n",@texcontents); |
Line 96 sub handler {
|
Line 108 sub handler {
|
['texengine','inhibitmenu']); |
['texengine','inhibitmenu']); |
|
|
|
|
&Apache::lontexconvert::init_tth(); |
|
my $load_items = |
|
'onLoad="' .&Apache::lonmenu::loadevents(). '" '. |
|
'onUnload="'.&Apache::lonmenu::unloadevents().'" '; |
|
|
|
$r->print(&Apache::loncommon::start_page(undef,undef, |
$r->print(&Apache::loncommon::start_page(undef,undef, |
{'add_entries' => $load_items, |
{'bgcolor' => '#FFFFFF', |
'bgcolor' => '#FFFFFF', |
|
'force_register' => 1, |
'force_register' => 1, |
'only_body' => |
'only_body' => |
($env{'form.inhibitmenu'} |
($env{'form.inhibitmenu'} |
eq 'yes'), })); |
eq 'yes'), })); |
|
|
|
my $displaymode; |
|
if (&Apache::lonnet::EXT('resource.0.texdisplay') =~ /^(tth|mathjax)$/i) { |
|
$displaymode = $1; |
|
} |
|
if ($env{'form.texengine'} =~ /^(tth|mathjax)$/i) { |
|
$displaymode = $1; |
|
} |
$r->print(&Apache::lontexconvert::converted(\$texstring, |
$r->print(&Apache::lontexconvert::converted(\$texstring, |
$env{'form.texengine'})); |
$displaymode)); |
$r->print(&footer()); |
$r->print(&footer()); |
|
|
return OK; |
return OK; |
Line 119 sub handler {
|
Line 132 sub handler {
|
1; |
1; |
__END__ |
__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 |
|
|
|
|
|
|
|
|