--- loncom/interface/lonprintout.pm 2001/09/18 14:35:11 1.4 +++ loncom/interface/lonprintout.pm 2001/09/18 21:08:47 1.5 @@ -19,7 +19,7 @@ use strict; use Apache::Constants qw(:common); use Apache::lonxml; use Apache::lonnet; -use Apache::File; +use Apache::File(); @@ -66,20 +66,31 @@ ENDPART my $result = ''; my %mystyle; +# my $ere; +# foreach $ere (%ENV) { +# $r->print(' SS '.$ere.' => '.$ENV{$ere}.' FF '); +# } + + if ($choice eq 'Standard LaTeX output for current document') { my $file=&Apache::lonnet::filelocation("",'/res/'.$ENV{'request.ambiguous'}); my $filecontents=&Apache::lonnet::getfile($file); $result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); - my $tempo_file; - my $file = '/home/httpd/prtspool/temp.tex'; - unless ($tempo_file = Apache::File->new($file)) { - $r->log_error("Couldn't open $file for output"); - return SERVER_ERROR; + { + my $temp_file; + my $filename = "/home/httpd/prtspool/$ENV{'environment.firstname'}temp$ENV{'user.login.time'}.tex"; + unless ($temp_file = Apache::File->new('>'.$filename)) { + $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') { my $current_file = '/res/'.$ENV{'request.ambiguous'}; @@ -88,8 +99,8 @@ ENDPART my $filecontents=&Apache::lonnet::getfile($file); $result = &Apache::lonxml::xmlparse('tex',$filecontents,'',%mystyle); - $result = &content_map($result); - $r->print($result); + my @number_seq = &content_map($result); + $r->print(@number_seq); @@ -104,11 +115,43 @@ FINALEND sub content_map { #-- find a list of files to publish my $map_string = shift; - + my @number_seq = (); + my $startlink = index($map_string,'',$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,'',$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,'