--- loncom/interface/printout.pl 2004/08/30 20:05:31 1.68
+++ loncom/interface/printout.pl 2004/12/20 21:15:20 1.71
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.68 2004/08/30 20:05:31 sakharuk Exp $
+# $Id: printout.pl,v 1.71 2004/12/20 21:15:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,6 +32,7 @@ use File::Path;
use IO::File;
use Image::Magick;
use Apache::lonhtmlcommon;
+use Apache::lonnet();
use Apache::loncommon;
use Apache::lonlocal;
@@ -67,7 +68,7 @@ END
my $advans_role = $ENV{'cgi.'.$identifier.'role'};
my $number_of_files = $ENV{'cgi.'.$identifier.'numberoffiles'}+1;
my $student_names = $ENV{'cgi.'.$identifier.'studentnames'};
- my $backref = $ENV{'cgi.'.$identifier.'backref'};
+ my $backref = &Apache::lonnet::unescape($ENV{'cgi.'.$identifier.'backref'});
my $adv = $ENV{'request.role.adv'};
@@ -86,7 +87,7 @@ END
#do we have figures?
if (-e $figfile) {
my %done_conversion;
- my $temporary_file=IO::File->new($figfile) || die "Couldn't open file for reading: $!\n";
+ my $temporary_file=IO::File->new($figfile) || die "Couldn't open fig file $figfile for reading: $!\n";
my @content_of_file = <$temporary_file>;
close $temporary_file;
my $noteps;
@@ -210,7 +211,7 @@ foreach $texfile (@texfile) {
} #to create index
#Do we have a latex error in the log file?
my $logfilename = $texfile; $logfilename =~ s/\.tex$/\.log/;
- my $temporary_file=IO::File->new($logfilename) || die "Couldn't open file for reading: $!\n";
+ my $temporary_file=IO::File->new($logfilename) || die "Couldn't open log file $logfilename for reading: $!\n";
my @content_of_file = <$temporary_file>;
close $temporary_file;
my $body_log_file = join(' ',@content_of_file);
@@ -226,7 +227,7 @@ foreach $texfile (@texfile) {
if ($whereitbegins!=-1 and $whereitends!=-1) {
print "With very high probability this error occured in ".substr($body_log_file,$whereitbegins+26,$whereitends-$whereitbegins-26)."
";
}
- print "Here are the error messages in the LaTeX log file
";
+ print "Here are the error messages in the LaTeX log file
"; my $sygnal = 0; for (my $i=0;$i<=$#content_of_file;$i++) { if ($content_of_file[$i]=~m/^Runaway argument?/ or $content_of_file[$i]=~m/^!/) { @@ -236,16 +237,17 @@ foreach $texfile (@texfile) { $sygnal = 0; } if ($sygnal) { - print "$content_of_file[$i]\n"; if ($advans_role) { print "The link to "; $logfilename=~s/\/home\/httpd//; print "Your log file "; print "\n"; #link tooriginal LaTeX file (included according Michael Hamlin desire) - my $tex_temporary_file=IO::File->new($texfile) || die "Couldn't open file for reading: $!\n"; + my $tex_temporary_file=IO::File->new($texfile) || die "Couldn't open tex file $texfile for reading: $!\n"; my @tex_content_of_file = <$tex_temporary_file>; close $tex_temporary_file; my $body_tex_file = join(' ',@tex_content_of_file); @@ -325,7 +327,7 @@ foreach $texfile (@texfile) { print "Your log file "; print "\n"; #link tooriginal LaTeX file (included according Michael Hamlin desire) - my $tex_temporary_file=IO::File->new($texfile) || die "Couldn't open file for reading: $!\n"; + my $tex_temporary_file=IO::File->new($texfile) || die "Couldn't open tex file $texfile for reading: $!\n"; my @tex_content_of_file = <$tex_temporary_file>; close $tex_temporary_file; my $body_tex_file = join(' ',@tex_content_of_file); @@ -380,9 +382,9 @@ foreach $texfile (@texfile) { 'a6'=>'<< /PageSize [298.75 421.1] >> setpagedevice', }; if ($paper ne 'letter') { - open(FFH,'<',$ps_file) || die "Couldn't open file for reading: $!\n"; + open(FFH,'<',$ps_file) || die "Couldn't open ps file $ps_file for reading: $!\n"; my $new_ps_file='new'.$ps_file; - open(FFHS,'>',$new_ps_file) || die "Couldn't open file for reading: $!\n"; + open(FFHS,'>',$new_ps_file) || die "Couldn't open new ps file $new_ps_file for reading: $!\n"; print FFHS $addtoPSfile->{$paper}."\n"; while (
"; + print "$content_of_file[$i]"; } } + print "