version 1.90, 2005/09/12 10:16:52
|
version 1.93, 2005/11/15 20:53:06
|
Line 25
|
Line 25
|
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
|
|
|
BEGIN { |
|
eval "use Apache2::compat();"; |
|
}; |
use lib '/home/httpd/lib/perl'; |
use lib '/home/httpd/lib/perl'; |
use LONCAPA::loncgi; |
use LONCAPA::loncgi; |
use File::Path; |
use File::Path; |
Line 41 use LONCAPA::Enrollment;
|
Line 44 use LONCAPA::Enrollment;
|
use strict; |
use strict; |
|
|
|
|
# |
|
# Determine if a user is operating as a student for this course/domain. |
# Determine if a user is operating as a student for this course/domain. |
# |
|
# |
|
#Parameters: |
#Parameters: |
# course - The course id. |
# none |
# cdom - The course domain. |
|
# |
|
#Implicit: |
#Implicit: |
# $env{request.role} contains the role under which this user operated this |
# $env{request.role} contains the role under which this user operated this |
# this request. |
# this request. |
sub is_student { |
sub is_student { |
return (! $env{'request.role.adv'}); |
return ($env{'request.role'}=~/^st\./); |
} |
} |
|
|
# |
# |
Line 112 sub send_error_mail {
|
Line 110 sub send_error_mail {
|
# The user is a student in the course: |
# The user is a student in the course: |
# |
# |
|
|
if (&is_student( $courseid, $coursedom)) { |
if (&is_student()) { |
# build the subject and message body: |
# build the subject and message body: |
# print "sending message to course coordinators.<br />"; |
# print "sending message to course coordinators.<br />"; |
|
|
Line 121 sub send_error_mail {
|
Line 119 sub send_error_mail {
|
my $subject = "Error [$badurl] Print failed for $user".'@'.$domain; |
my $subject = "Error [$badurl] Print failed for $user".'@'.$domain; |
my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n"; |
my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n"; |
$message .= " User was attempting to print: \n"; |
$message .= " User was attempting to print: \n"; |
$message .= " $resources\n"; |
foreach my $resource (split(/:/,$resources)) { |
|
$message .= " $resource\n"; |
|
} |
$message .= "--------------------LaTeX logfile:------------ \n"; |
$message .= "--------------------LaTeX logfile:------------ \n"; |
$message .= $logfile; |
$message .= $logfile; |
$message .= "-----------------LaTeX source file: ------------\n"; |
$message .= "-----------------LaTeX source file: ------------\n"; |
Line 180 END
|
Line 180 END
|
my $student_names = $env{'cgi.'.$identifier.'.studentnames'}; |
my $student_names = $env{'cgi.'.$identifier.'.studentnames'}; |
my $backref = &Apache::lonnet::unescape($env{'cgi.'.$identifier.'.backref'}); |
my $backref = &Apache::lonnet::unescape($env{'cgi.'.$identifier.'.backref'}); |
|
|
|
|
my $adv = $env{'request.role.adv'}; |
|
|
|
my @names_pack=(); |
my @names_pack=(); |
if ($student_names=~/_END_/) { |
if ($student_names=~/_END_/) { |
Line 202 END
|
Line 200 END
|
close $temporary_file; |
close $temporary_file; |
my $noteps; |
my $noteps; |
my %prog_state; |
my %prog_state; |
if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Coverting Images to EPS','Picture Conversion Status',$#content_of_file,'inline','80'); } |
if ($advanced_role) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Coverting Images to EPS','Picture Conversion Status',$#content_of_file,'inline','80'); } |
foreach my $not_eps (@content_of_file) { |
foreach my $not_eps (@content_of_file) { |
chomp($not_eps); |
chomp($not_eps); |
if ($not_eps ne '') { |
if ($not_eps ne '') { |
Line 232 END
|
Line 230 END
|
$not_eps =~ s/\s+$//; |
$not_eps =~ s/\s+$//; |
$not_eps =~ s/ /\\ /g; |
$not_eps =~ s/ /\\ /g; |
if ( exists($done_conversion{$not_eps})) { next; } |
if ( exists($done_conversion{$not_eps})) { next; } |
if ($adv) { |
if ($advanced_role) { |
my $prettyname=$not_eps; |
my $prettyname=$not_eps; |
$prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; |
$prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; |
$prettyname=~s|$Apache::lonnet::perlvar{'lonDocRoot'}/|/|; |
$prettyname=~s|$Apache::lonnet::perlvar{'lonDocRoot'}/|/|; |
Line 252 END
|
Line 250 END
|
} |
} |
} |
} |
} |
} |
if ($adv) { |
if ($advanced_role) { |
&Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); |
} |
} |
unlink($figfile); |
unlink($figfile); |
Line 272 END
|
Line 270 END
|
my $ind=-1; |
my $ind=-1; |
my %prog_state; |
my %prog_state; |
print "<a href=\"$backref\"><b>Return</b></a> to last resource.<br /><br />"; |
print "<a href=\"$backref\"><b>Return</b></a> to last resource.<br /><br />"; |
if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status','Class Print Status',$number_of_files,'inline','80'); } |
if ($advanced_role) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status','Class Print Status',$number_of_files,'inline','80'); } |
print "<br />"; |
print "<br />"; |
my $num_files = @texfile; |
my $num_files = @texfile; |
foreach $texfile (@texfile) { |
foreach $texfile (@texfile) { |
Line 316 foreach $texfile (@texfile) {
|
Line 314 foreach $texfile (@texfile) {
|
} |
} |
$name_range =~ s/'//g; # O'Neil -> ONeil e.g. |
$name_range =~ s/'//g; # O'Neil -> ONeil e.g. |
print "<br/>"; |
print "<br/>"; |
if ($adv) { &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,'Creating PDF for '.$status_statement); } |
if ($advanced_role) { &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,'Creating PDF for '.$status_statement); } |
# This little piece of dirt puts username ranges into the original tex |
# This little piece of dirt puts username ranges into the original tex |
# Tex filename from which they'll propagate into the other filenames as well. |
# Tex filename from which they'll propagate into the other filenames as well. |
# |
# |
Line 606 if ($number_of_files>1) {
|
Line 604 if ($number_of_files>1) {
|
$zipfile=~s/\/home\/httpd//; |
$zipfile=~s/\/home\/httpd//; |
print "<br /> A <a href=\"$zipfile\">ZIP file</a> of all the PDFs."; |
print "<br /> A <a href=\"$zipfile\">ZIP file</a> of all the PDFs."; |
} |
} |
if ($adv) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } |
if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } |
|
|
my $done; |
my $done; |
sub REAPER { |
sub REAPER { |
Line 619 sub busy_wait_command {
|
Line 617 sub busy_wait_command {
|
$SIG{CHLD} = \&REAPER; |
$SIG{CHLD} = \&REAPER; |
$done=0; |
$done=0; |
my $pid=open(CMD,"$command |"); |
my $pid=open(CMD,"$command |"); |
if ($adv) { |
if ($advanced_role) { |
&Apache::lonhtmlcommon::Update_PrgWin('',$progress_win,$message); |
&Apache::lonhtmlcommon::Update_PrgWin('',$progress_win,$message); |
} |
} |
while(!$done) { |
while(!$done) { |
Line 629 sub busy_wait_command {
|
Line 627 sub busy_wait_command {
|
my $size=(stat($output_file))[7]; |
my $size=(stat($output_file))[7]; |
$extra_msg=", $size bytes generated"; |
$extra_msg=", $size bytes generated"; |
} |
} |
if ($adv) { |
if ($advanced_role) { |
&Apache::lonhtmlcommon::Update_PrgWin('',$progress_win, |
&Apache::lonhtmlcommon::Update_PrgWin('',$progress_win, |
$message.$extra_msg); |
$message.$extra_msg); |
} |
} |