version 1.4, 2001/09/18 14:35:11
|
version 1.6, 2001/10/02 14:09:25
|
Line 19 use strict;
|
Line 19 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::File; |
use Apache::File(); |
|
|
|
|
|
|
Line 51 ENDMENUOUT
|
Line 51 ENDMENUOUT
|
} |
} |
|
|
|
|
|
|
sub output_data { |
sub output_data { |
my $r = shift; |
my $r = shift; |
$r->print(<<ENDPART); |
$r->print(<<ENDPART); |
Line 65 ENDPART
|
Line 66 ENDPART
|
my $choice = $ENV{'form.choice'}; |
my $choice = $ENV{'form.choice'}; |
my $result = ''; |
my $result = ''; |
my %mystyle; |
my %mystyle; |
|
my $filename; |
|
|
|
|
if ($choice eq 'Standard LaTeX output for current document') { |
if ($choice eq 'Standard LaTeX output for current document') { |
|
|
Line 72 ENDPART
|
Line 75 ENDPART
|
my $filecontents=&Apache::lonnet::getfile($file); |
my $filecontents=&Apache::lonnet::getfile($file); |
$result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); |
$result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); |
|
|
my $tempo_file; |
{ |
my $file = '/home/httpd/prtspool/temp.tex'; |
my $temp_file; |
unless ($tempo_file = Apache::File->new($file)) { |
$filename = "/home/httpd/prtspool/$ENV{'environment.firstname'}$ENV{'environment.lastname'}temp$ENV{'user.login.time'}.tex"; |
$r->log_error("Couldn't open $file for output"); |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
return SERVER_ERROR; |
$r->log_error("Couldn't open $filename for output $!"); |
|
return SERVER_ERROR; |
|
} |
|
print $temp_file $result; |
} |
} |
|
|
$r->print($result); |
|
|
|
|
|
} elsif ($choice eq 'Standard LaTeX output for the whole sequence') { |
} elsif ($choice eq 'Standard LaTeX output for the whole sequence') { |
my $current_file = '/res/'.$ENV{'request.ambiguous'}; |
my $current_file = '/res/'.$ENV{'request.ambiguous'}; |
Line 88 ENDPART
|
Line 95 ENDPART
|
my $filecontents=&Apache::lonnet::getfile($file); |
my $filecontents=&Apache::lonnet::getfile($file); |
$result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); |
$result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); |
|
|
$result = &content_map($result); |
my @number_seq = &content_map($result); |
$r->print($result); |
$r->print(@number_seq); |
|
|
|
|
|
|
|
|
} |
} |
|
|
|
|
$r->print(<<FINALEND); |
$r->print(<<FINALEND); |
|
<meta http-equiv="Refresh" content="0; url=http://bistromath.lite.msu.edu/cgi-bin/printout.pl?$filename"> |
</body> |
</body> |
</html> |
</html> |
FINALEND |
FINALEND |
} |
} |
|
|
|
|
|
|
|
|
sub content_map { |
sub content_map { |
#-- find a list of files to publish |
#-- find a list of files to publish |
my $map_string = shift; |
my $map_string = shift; |
|
|
|
|
|
my @number_seq = (); |
|
my $startlink = index($map_string,'<link',0); |
|
while ($startlink != -1) { |
|
my $endlink = index($map_string,'</link>',$startlink); |
|
my $chunk = substr($map_string,$startlink,$endlink-$startlink+7); |
|
substr($map_string,$startlink,$endlink-$startlink+7) = ''; |
|
$_ = $chunk; |
|
m/from=\"(\d+)\"/; |
|
push @number_seq,$1; |
|
m/to=\"(\d+)\"/; |
|
push @number_seq,$1; |
|
$startlink = index($map_string,'<link from="'.$1.'"',$startlink); |
|
} |
|
|
|
return @number_seq; |
|
|
return $map_string; |
|
|
# my @one = (); |
|
# my @two = (); |
|
# my @three = (); |
|
# my $start = index($map_string,'<link',0); |
|
# while ($start != -1) { |
|
# my $finish = index($map_string,'</link>',$start); |
|
# my $chunk = substr($map_string,$start,$finish-$start+7); |
|
# substr($map_string,$start,$finish-$start+7) = ''; |
|
# $_ = $chunk; |
|
# m/from=\"(\d+)\"/; |
|
# push @one,$1; |
|
# m/to=\"(\d+)\"/; |
|
# push @two,$1; |
|
# $start = index($map_string,'<link',$start); |
|
# } |
|
|
|
|
|
# return @three; |
|
# return $map_string; |
} |
} |
|
|
|
|
Line 127 sub handler {
|
Line 172 sub handler {
|
#-- core part |
#-- core part |
if ($ENV{'form.phase'} eq 'two') { |
if ($ENV{'form.phase'} eq 'two') { |
&output_data($r); |
&output_data($r); |
|
|
} |
} |
return OK; |
return OK; |
|
|
Line 134 sub handler {
|
Line 180 sub handler {
|
|
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|
|
# my $ere; |
|
# foreach $ere (%ENV) { |
|
# $r->print(' SS '.$ere.' => '.$ENV{$ere}.' FF '."\n\n"); |
|
# } |