--- loncom/interface/printout.pl 2007/02/22 01:00:13 1.121 +++ loncom/interface/printout.pl 2007/10/11 22:49:49 1.128 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.121 2007/02/22 01:00:13 albertel Exp $ +# $Id: printout.pl,v 1.128 2007/10/11 22:49:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,7 @@ use Apache::loncommon(); use Apache::lonlocal; use Apache::lonmsg(); use LONCAPA::Enrollment; +use LONCAPA::Configuration; use strict; @@ -128,8 +129,8 @@ sub send_error_mail { foreach my $line (@$texfile) { $message .= "$line\n"; } - my (undef, %receivers) = &Apache::lonfeedback::decide_receiver(undef, 0, - 1,1,1); + my (undef, %receivers) = &Apache::lonmsg::decide_receiver(undef, 0, + 1,1,1); # print "
sending...section: $env{'request.course.sec'}"; foreach my $dest (keys %receivers) { # print "
dest is $dest"; @@ -161,9 +162,11 @@ Your cookie information is incorrect. END return; } + +my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; &Apache::lonlocal::get_language_handle(); &Apache::loncommon::content_type(undef,'text/html'); - +$env{'request.noversionuri'} = '/cgi-bin/printout.pl'; print(&Apache::loncommon::start_page('Creating PDF')); my $identifier = $ENV{'QUERY_STRING'}; @@ -184,9 +187,10 @@ END if ($student_names=~/_END_/) { @names_pack=split(/_ENDPERSON_/,$student_names); } - -print "Return to last resource.

"; - + if ($backref) { + print('

'.&mt("[_1]Return[_2] to editing resource.", + "","").'

'); + } my $figfile = $texfile; $figfile =~ s/^(.*_printout)_\d+_\d+_\d+\.tex/$1\.dat/; my $duefile = $texfile; @@ -214,13 +218,13 @@ print "ReturnReturn\n"; # print "
Advanced role
"; print "The link to "; - $logfilename=~s/\/home\/httpd//; + $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; print "
Your log file "; print "\n"; #link tooriginal LaTeX file (included according Michael Hamlin desire) @@ -454,7 +458,7 @@ foreach $texfile (@texfile) { print $tex_temporary_file 'LOGFILE
'.$body_tex_file.'
'."\n"; print "

"; print "The link to "; - $texfile=~s/\/home\/httpd//; + $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"); @@ -520,7 +524,7 @@ foreach $texfile (@texfile) { if ($tableofindex eq 'yes') { my $idxname = $latex_file; $idxname =~ s/\.tex$/\.idx/; - &busy_wait_command("makindex $idxname", + &busy_wait_command("makeindex $idxname", "Re-creating index file", \%prog_state, $idxname); &busy_wait_command("latex $latex_file 1>/dev/null 2>/dev/null", @@ -559,7 +563,7 @@ foreach $texfile (@texfile) { #print("
Missing fonts file is: $missfonts_file"); if (-e $missfonts_file) { #print("
Missing fonts file exists\n"); - &create_missing_fonts($missfonts_file); + &create_missing_fonts($missfonts_file,\%prog_state); &busy_wait_command("$comma $name_file 1>/dev/null 2>/dev/null", "for $status_statement dvips generated missing fonts", \%prog_state, $new_name_file); @@ -612,7 +616,7 @@ foreach $texfile (@texfile) { if ($advanced_role) { print "

"; print "The link to "; - $logfilename=~s/\/home\/httpd//; + $logfilename=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; print "Your log file "; print "\n"; #link tooriginal LaTeX file (included according Michael Hamlin desire) @@ -625,7 +629,7 @@ foreach $texfile (@texfile) { print $tex_temporary_file 'LOGFILE
'.$body_tex_file.'
'."\n"; print "

"; print "The link to "; - $texfile=~s/\/home\/httpd//; + $texfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; print "Your original LaTeX file "; print "\n"; } @@ -670,7 +674,7 @@ foreach $texfile (@texfile) { #print("
Missing fonts file is: $missfonts_file"); if (-e $missfonts_file) { #print("
Missing fonts file exists\n"); - &create_missing_fonts($missfonts_file); + &create_missing_fonts($missfonts_file,\%prog_state); &busy_wait_command("$comma $name_file 1>/dev/null 2>/dev/null", "for $status_statement dvips generated missing fonts", \%prog_state, $new_name_file); @@ -780,7 +784,7 @@ if ($number_of_files>1) { print("
Zip Output:\n");
     system($statement);
     print("
"); - $zipfile=~s/\/home\/httpd//; + $zipfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; print "
A ZIP file of all the PDFs."; } if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } @@ -865,7 +869,7 @@ sub repaginate { # bottom of the page, m the page number within the document. # - if ($line =~ /^%%Page:/) { + if ($line =~ /^%%Page:\s+\d+\s+\d+/) { my @pageinfo = split(/\s+/, $line); if ($page_number < $pageinfo[1]) { $page_number = $pageinfo[1]; @@ -997,7 +1001,7 @@ sub create_missing_fonts { #print("
Creating fonts via command: $command"); &busy_wait_command("$command 1>/dev/null 2>/dev/null", "Creating missing font", - $state, $command); + $state); }