--- loncom/interface/printout.pl 2005/09/12 10:16:52 1.90
+++ loncom/interface/printout.pl 2011/12/21 21:25:40 1.151
@@ -1,6 +1,7 @@
#!/usr/bin/perl
# CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
#
+# $Id: printout.pl,v 1.151 2011/12/21 21:25:40 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,31 +30,39 @@ use lib '/home/httpd/lib/perl';
use LONCAPA::loncgi;
use File::Path;
use File::Basename;
+use File::Copy;
use IO::File;
use Image::Magick;
-use Apache::lonhtmlcommon;
+use Apache::lonhtmlcommon();
use Apache::lonnet;
-use Apache::loncommon;
+use Apache::loncommon();
use Apache::lonlocal;
-use Apache::lonmsg;
+use Apache::lonmsg();
use LONCAPA::Enrollment;
+use LONCAPA::Configuration;
use strict;
+my $busy_wait_timeout = 30;
+my $pdfs_converted = 0; # non zero if PDF includes (need to fixps).
+
+my $debugging = 0;
+
+sub debug {
+ if ($debugging) {
+ my ($text) = @_;
+ print "$text
\n";
+ }
+}
-#
# Determine if a user is operating as a student for this course/domain.
-#
-#
#Parameters:
-# course - The course id.
-# cdom - The course domain.
-#
+# none
#Implicit:
# $env{request.role} contains the role under which this user operated this
# this request.
sub is_student {
- return (! $env{'request.role.adv'});
+ return ($env{'request.role'}=~/^st\./);
}
#
@@ -112,16 +121,18 @@ sub send_error_mail {
# The user is a student in the course:
#
- if (&is_student( $courseid, $coursedom)) {
+ if (&is_student()) {
# build the subject and message body:
- # print "sending message to course coordinators.
";
+ &debug("sending message to course coordinators.");
# Todo: Convert badurl into a url from file path:
my $subject = "Error [$badurl] Print failed for $user".'@'.$domain;
my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n";
$message .= " User was attempting to print: \n";
- $message .= " $resources\n";
+ foreach my $resource (split(/:/,$resources)) {
+ $message .= " $resource\n";
+ }
$message .= "--------------------LaTeX logfile:------------ \n";
$message .= $logfile;
$message .= "-----------------LaTeX source file: ------------\n";
@@ -129,11 +140,11 @@ sub send_error_mail {
foreach my $line (@$texfile) {
$message .= "$line\n";
}
- my (undef, %receivers) = &Apache::lonfeedback::decide_receiver(undef, 0,
- 1,1,1);
- # print "
sending...section: $env{'request.course.sec'}";
+ my (undef, %receivers) = &Apache::lonmsg::decide_receiver(undef, 0,
+ 1,1,1);
+ &debug("sending...section: $env{'request.course.sec'}");
foreach my $dest (keys %receivers) {
- # print "
dest is $dest";
+ &debug("dest is $dest");
my @destinfo = split(/:/,$dest);
my $user = $destinfo[0];
my $dom = $destinfo[1];
@@ -160,129 +171,146 @@ Your cookie information is incorrect.