--- loncom/interface/printout.pl 2008/03/26 09:50:21 1.135
+++ loncom/interface/printout.pl 2009/03/24 10:15:15 1.139
@@ -1,7 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
-# $Id: printout.pl,v 1.135 2008/03/26 09:50:21 foxr Exp $
+# $Id: printout.pl,v 1.139 2009/03/24 10:15:15 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -264,7 +264,7 @@ my $ind=-1;
my %prog_state;
if ($advanced_role) {
- %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status','Class Print Status',$number_of_files,'inline','80');
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status',&mt('Class Print Status'),$number_of_files,'inline','80');
}
print "
";
my $num_files = @texfile; # How does this differ from $number_of_files , can that be 0?
@@ -403,7 +403,10 @@ foreach $texfile (@texfile) {
my $papera=$paper;
if ($papera eq 'letter') {$papera='';}
if ($papera ne '') {$papera='-t'.$papera;}
- my $comma = "dvips $papera -Ppdf -G0 -o $new_name_file";
+ my $extra_ps_header = $perlvar{'lonLib'} .'/includepsheader.ps';
+ &Apache::lonnet::logthis("Extra ps header: $extra_ps_header");
+ my $comma = "dvips $papera -h $extra_ps_header -Ppdf -G0 -o $new_name_file";
+ &Apache::lonnet::logthis("dvips command: $comma");
&busy_wait_command("$comma $name_file 1>/dev/null 2>/dev/null",
"for $status_statement now Converting to PS",
\%prog_state,$new_name_file);
@@ -594,7 +597,7 @@ sub busy_wait_command {
# various bits and pieces that control how the latex file is processed:
# LaTeX is run as many times a needed to make this all happen... this may
# result in several runs of LaTeX that just are errors if the LaTeX is
-# bad, butthe printing subsystem is _supposed_ to not do that.
+# bad, but the printing subsystem is _supposed_ to not do that.
#
# Parameters:
# name_file - Name of the LaTeX file to process.
@@ -966,16 +969,20 @@ sub analyze_logfile {
length($badtext) - $whereitbegins - 48);
# print "
failing resourcename: $badresource
";
}
- }
+ }
# Guys with privileged roles get a more detailed error output:
if ($advanced_role) {
#LaTeX failed to parse tex file
- print "
"; + print "".&mt('LaTeX could not successfully parse your TeX file.')."
"; + print &mt('It probably has errors in it.')."
"; + if ($badtext) { + print &mt('With very high probability this error occured in [_1].',$badtext) + ."
"; + } + print &mt('Here are the error messages in the LaTeX log file:') + .""; my $sygnal = 0; for (my $i=0;$i<=$#content_of_file;$i++) { @@ -991,10 +998,10 @@ sub analyze_logfile { } print "\n"; # print "
Advanced role
"; - print "The link to "; $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; - print "Your log file "; - print "\n"; + print "" + .&mt('The link to [_1]Your log file[_2]','','') + ."\n"; #link to original LaTeX file 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>; @@ -1004,11 +1011,11 @@ sub analyze_logfile { $tex_temporary_file = IO::File->new('>'.$texfile); print $tex_temporary_file 'LOGFILE '.$body_tex_file.''."\n"; print "
"; - print "The link to "; $texfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; - print "Your original LaTeX file "; - print "\n"; - my $help_text = &Apache::loncommon::help_open_topic("Print_Resource", "Help on printing"); + print "" + .&mt('The link to [_1]Your original LaTeX file[_2]','','') + ."
\n"; + my $help_text = &Apache::loncommon::help_open_topic("Print_Resource", &mt('Help on printing')); print ("$help_text"); # Students on the other hand get a minimal error message, since they won't @@ -1021,13 +1028,20 @@ sub analyze_logfile { # $name_file - is the name of the LaTeX file. # $identifier - is the unique LaTeX identifier.l - print "
There are errors in $badtext"; - print "
These errors prevent this resource from printing correctly"; + print "
"; + if ($badtext) { + print &mt('There are errors in [_1].',$badtext); + } else { + print &mt('There are errors.'); + } + print "
".&mt('These errors prevent this resource from printing correctly.'); my $tex_handle = IO::File->new($texfile); my @tex_contents = <$tex_handle>; &send_error_mail($identifier, $badresource, $body_log_file, \@tex_contents); - print "
A message has been sent to the instructor describing this failure
"; - my $help_text = &Apache::loncommon::help_open_topic("Print_Resource", "Help on printing"); + print "" + .&mt('A message has been sent to the instructor describing this failure.') + ."
"; + my $help_text = &Apache::loncommon::help_open_topic("Print_Resource", &mt('Help on printing')); print ("$help_text"); } @@ -1044,22 +1058,24 @@ sub analyze_logfile { } elsif ($body_log_file=~m//) { my $whereitbegins = index $body_log_file,' '; - print "You are running LaTeX in batch mode."; + print &mt('You are running LaTeX in [_1]batch mode[_2].','',''); while ($whereitbegins != -1) { my $tempobegin=$whereitbegins; $whereitbegins = rindex $body_log_file,'STAMPOFPASSEDRESOURCESTART',$whereitbegins; my $whereitends = index $body_log_file,'STAMPOFPASSEDRESOURCEEND',$whereitbegins; - print "
It has found an error in".substr($body_log_file,$whereitbegins+26,$whereitends-$whereitbegins-26)."
and corrected it.\n"; - print "Usually this correction is valid but you probably need to check the indicated resource one more time and implement neccessary corrections by yourself.\n"; + print "
" + .&mt('It has found an error in [_1][_2]and corrected it.',substr($body_log_file,$whereitbegins+26,$whereitends-$whereitbegins-26),"
")."\n"; + print &mt('Usually this correction is valid but you probably need to check the indicated resource one more time and implement neccessary corrections by yourself.')."\n"; $whereitbegins = index $body_log_file,'',$tempobegin+10; } if ($advanced_role) { print "
"; - print "The link to "; $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; - print "Your log file "; - print "\n"; + print "" + .&mt('The link to [_1]Your log file[_2]' + ,'','') + ."\n"; #link to original LaTeX file 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>; @@ -1069,10 +1085,10 @@ sub analyze_logfile { $tex_temporary_file = IO::File->new('>'.$texfile); print $tex_temporary_file 'LOGFILE '.$body_tex_file.''."\n"; print "
"; - print "The link to "; $texfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; - print "Your original LaTeX file "; - print "\n"; + print "" + .&mt('The link to [_1]Your original LaTeX file[_2]','',''); + print "\n"; } return 1; }