version 1.4, 2001/09/18 14:35:11
|
version 1.5, 2001/09/18 21:08:47
|
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 66 ENDPART
|
Line 66 ENDPART
|
my $result = ''; |
my $result = ''; |
my %mystyle; |
my %mystyle; |
|
|
|
# my $ere; |
|
# foreach $ere (%ENV) { |
|
# $r->print(' SS '.$ere.' => '.$ENV{$ere}.' FF '); |
|
# } |
|
|
|
|
if ($choice eq 'Standard LaTeX output for current document') { |
if ($choice eq 'Standard LaTeX output for current document') { |
|
|
my $file=&Apache::lonnet::filelocation("",'/res/'.$ENV{'request.ambiguous'}); |
my $file=&Apache::lonnet::filelocation("",'/res/'.$ENV{'request.ambiguous'}); |
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)) { |
my $filename = "/home/httpd/prtspool/$ENV{'environment.firstname'}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 99 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); |
|
|
|
|
|
|
Line 104 FINALEND
|
Line 115 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; |
|
|
|
|
|
# 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 $map_string; |
# return @three; |
|
# return $map_string; |
} |
} |
|
|
|
|