version 1.522, 2008/03/23 19:48:49
|
version 1.537, 2008/08/25 10:16:27
|
Line 39 use Apache::File();
|
Line 39 use Apache::File();
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::admannotations; |
use Apache::admannotations; |
use Apache::lonenc; |
use Apache::lonenc; |
|
use Apache::entities; |
|
|
use HTTP::Response; |
use HTTP::Response; |
|
|
use LONCAPA::map(); |
use LONCAPA::map(); |
Line 116 sub annotate {
|
Line 118 sub annotate {
|
# the number of times requested by the caller. |
# the number of times requested by the caller. |
# If we still have a proble, no text is appended to the |
# If we still have a proble, no text is appended to the |
# output and we set some global variables. |
# output and we set some global variables. |
# to indicate to the caller an SSI error occured. |
# to indicate to the caller an SSI error occurred. |
# All of this is supposed to deal with the issues described |
# All of this is supposed to deal with the issues described |
# in LonCAPA BZ 5631 see: |
# in LonCAPA BZ 5631 see: |
# http://bugs.lon-capa.org/show_bug.cgi?id=5631 |
# http://bugs.lon-capa.org/show_bug.cgi?id=5631 |
Line 132 sub annotate {
|
Line 134 sub annotate {
|
# On success, returns the rendered resource identified by the resource parameter. |
# On success, returns the rendered resource identified by the resource parameter. |
# Side Effects: |
# Side Effects: |
# The following global variables can be set: |
# The following global variables can be set: |
# ssi_error - If an unrecoverable error occured this becomes true. |
# ssi_error - If an unrecoverable error occurred this becomes true. |
# It is up to the caller to initialize this to false |
# It is up to the caller to initialize this to false |
# if desired. |
# if desired. |
# ssi_last_error_resource - If an unrecoverable error occured, this is the value |
# ssi_last_error_resource - If an unrecoverable error occurred, this is the value |
# of the resource that could not be rendered by the ssi |
# of the resource that could not be rendered by the ssi |
# call. |
# call. |
# ssi_last_error - The error string fetched from the ssi response |
# ssi_last_error - The error string fetched from the ssi response |
Line 150 sub ssi_with_retries {
|
Line 152 sub ssi_with_retries {
|
$ssi_error = 1; |
$ssi_error = 1; |
$ssi_last_error_resource = $resource; |
$ssi_last_error_resource = $resource; |
$ssi_last_error = $response->code . " " . $response->message; |
$ssi_last_error = $response->code . " " . $response->message; |
|
$content='\section*{!!! An error occurred !!!}'; |
&Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error"); |
&Apache::lonnet::logthis("Error in SSI resource: $resource Error: $ssi_last_error"); |
} |
} |
|
|
Line 158 sub ssi_with_retries {
|
Line 160 sub ssi_with_retries {
|
|
|
} |
} |
|
|
|
sub get_student_view_with_retries { |
|
my ($curresline,$retries,$username,$userdomain,$courseid,$target,$moreenv)=@_; |
|
|
|
my ($content, $response) = &Apache::loncommon::get_student_view_with_retries($curresline,$retries,$username,$userdomain,$courseid,$target,$moreenv); |
|
if (!$response->is_success) { |
|
$ssi_error = 1; |
|
$ssi_last_error_resource = $curresline.' for user '.$username.':'.$userdomain; |
|
$ssi_last_error = $response->code . " " . $response->message; |
|
$content='\section*{!!! An error occurred !!!}'; |
|
&Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error User: $username:$userdomain"); |
|
} |
|
return $content; |
|
|
|
} |
|
|
# |
# |
# printf_style_subst item format_string repl |
# printf_style_subst item format_string repl |
# |
# |
Line 212 sub printf_style_subst {
|
Line 229 sub printf_style_subst {
|
# %a - Assignment name. |
# %a - Assignment name. |
# %c - Course name. |
# %c - Course name. |
# %n - Student name. |
# %n - Student name. |
|
# %s - The section if it is supplied. |
# |
# |
sub format_page_header { |
sub format_page_header { |
my ($width, $format, $assignment, $course, $student) = @_; |
my ($width, $format, $assignment, $course, $student, $section) = @_; |
|
|
|
|
$width = &recalcto_mm($width); # Get width in mm. |
$width = &recalcto_mm($width); # Get width in mm. |
# Default format? |
# Default format? |
Line 231 sub format_page_header {
|
Line 250 sub format_page_header {
|
# - Allow the assignment to be 2 lines (wrapped). |
# - Allow the assignment to be 2 lines (wrapped). |
# |
# |
my $chars_per_line = $width/2; # Character/textline. |
my $chars_per_line = $width/2; # Character/textline. |
|
|
|
|
|
|
my $firstline = "$student $course"; |
my $name_length = int($chars_per_line *3 /4); |
if (length($firstline) > $chars_per_line) { |
my $sec_length = int($chars_per_line / 5); |
my $lastchar = $chars_per_line - length($student) - 1; |
|
if ($lastchar > 0) { |
$format = "%$name_length".'n'; |
$course = substr($course, 0, $lastchar); |
|
} else { # Nothing left of course: |
if ($section) { |
$course = ''; |
$format .= ' - Sec: '."%$sec_length".'s'; |
} |
|
} |
|
if (length($assignment) > $chars_per_line) { |
|
$assignment = substr($assignment, 0, $chars_per_line); |
|
} |
} |
|
|
$format = "\\textbf{$student} $course \\hfill \\thepage \\\\ \\textit{$assignment}"; |
|
|
|
} else { |
|
# An open question is how to handle long user formatted page headers... |
|
# A possible future is to support e.g. %na so that the user can control |
|
# the truncation of the elements that can appear in the header. |
|
# |
|
$format = &printf_style_subst("a", $format, $assignment); |
|
$format = &printf_style_subst("c", $format, $course); |
|
$format = &printf_style_subst("n", $format, $student); |
|
|
|
# If the user put %'s in the format string, they must be escaped |
|
# to \% else LaTeX will think they are comments and terminate |
|
# the line.. which is bad!!! |
|
|
|
|
$format .= '\\\\%c \\\\ %a'; |
|
|
|
|
} |
} |
|
# An open question is how to handle long user formatted page headers... |
|
# A possible future is to support e.g. %na so that the user can control |
|
# the truncation of the elements that can appear in the header. |
|
# |
|
$format = &printf_style_subst("a", $format, $assignment); |
|
$format = &printf_style_subst("c", $format, $course); |
|
$format = &printf_style_subst("n", $format, $student); |
|
$format = &printf_style_subst("s", $format, $section); |
|
|
|
|
|
# If the user put %'s in the format string, they must be escaped |
|
# to \% else LaTeX will think they are comments and terminate |
|
# the line.. which is bad!!! |
|
|
|
|
|
|
return $format; |
return $format; |
Line 487 sub adjust_number_to_print {
|
Line 504 sub adjust_number_to_print {
|
# Unmodified. |
# Unmodified. |
} else { |
} else { |
# Error!!!! |
# Error!!!! |
|
|
croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print"; |
croak "bad SPLIT_PDFS: $split_pdf in lonprintout::adjust_number_to_print"; |
|
|
} |
} |
} |
} |
|
|
|
|
sub character_chart { |
sub character_chart { |
|
my $result = shift; |
|
return &Apache::entities::replace_entities($result); |
|
} |
|
|
|
sub old_character_chart { |
my $result = shift; |
my $result = shift; |
$result =~ s/&\#0?0?(7|9);//g; |
$result =~ s/&\#0?0?(7|9);//g; |
$result =~ s/&\#0?(10|13);//g; |
$result =~ s/&\#0?(10|13);//g; |
Line 614 sub character_chart {
|
Line 638 sub character_chart {
|
$result =~ s/&(\#165|yen);/\\textyen /g; |
$result =~ s/&(\#165|yen);/\\textyen /g; |
$result =~ s/&(\#166|brvbar);/\\textbrokenbar /g; |
$result =~ s/&(\#166|brvbar);/\\textbrokenbar /g; |
$result =~ s/&(\#167|sect);/\\textsection /g; |
$result =~ s/&(\#167|sect);/\\textsection /g; |
$result =~ s/&(\#168|uml);/\\texthighdieresis /g; |
$result =~ s/&(\#168|uml);/\\"\{\} /g; |
$result =~ s/&(\#169|copy);/\\copyright /g; |
$result =~ s/&(\#169|copy);/\\copyright /g; |
$result =~ s/&(\#170|ordf);/\\textordfeminine /g; |
$result =~ s/&(\#170|ordf);/\\textordfeminine /g; |
$result =~ s/&(\#172|not);/\\ensuremath\{\\neg\}/g; |
$result =~ s/&(\#172|not);/\\ensuremath\{\\neg\}/g; |
Line 625 sub character_chart {
|
Line 649 sub character_chart {
|
$result =~ s/&(\#177|plusmn);/\\ensuremath\{\\pm\}/g; |
$result =~ s/&(\#177|plusmn);/\\ensuremath\{\\pm\}/g; |
$result =~ s/&(\#178|sup2);/\\ensuremath\{^2\}/g; |
$result =~ s/&(\#178|sup2);/\\ensuremath\{^2\}/g; |
$result =~ s/&(\#179|sup3);/\\ensuremath\{^3\}/g; |
$result =~ s/&(\#179|sup3);/\\ensuremath\{^3\}/g; |
$result =~ s/&(\#180|acute);/\\textacute /g; |
$result =~ s/&(\#180|acute);/\\'\{\} /g; |
$result =~ s/&(\#181|micro);/\\ensuremath\{\\mu\}/g; |
$result =~ s/&(\#181|micro);/\\ensuremath\{\\mu\}/g; |
$result =~ s/&(\#182|para);/\\P/g; |
$result =~ s/&(\#182|para);/\\P/g; |
$result =~ s/&(\#183|middot);/\\ensuremath\{\\cdot\}/g; |
$result =~ s/&(\#183|middot);/\\ensuremath\{\\cdot\}/g; |
Line 954 sub get_course {
|
Line 978 sub get_course {
|
my $courseidinfo; |
my $courseidinfo; |
if (defined($env{'request.course.id'})) { |
if (defined($env{'request.course.id'})) { |
$courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); |
$courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); |
|
my $sec = $env{'request.course.sec'}; |
|
|
} |
} |
return $courseidinfo; |
return $courseidinfo; |
} |
} |
Line 976 sub page_format_transformation {
|
Line 1002 sub page_format_transformation {
|
|
|
my $name = &get_name(); |
my $name = &get_name(); |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
|
my $header_text = $parmhash{'print_header_format'}; |
my $header_text = $parmhash{'print_header_format'}; |
$header_text = &format_page_header($textwidth, $header_text, $assignment, |
$header_text = &format_page_header($textwidth, $header_text, $assignment, |
$courseidinfo, $name); |
$courseidinfo, $name); |
Line 1127 sub print_latex_header {
|
Line 1152 sub print_latex_header {
|
'\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n". |
'\usepackage[dvips]{graphicx}\usepackage{epsfig}'."\n". |
'\usepackage{wrapfig}'. |
'\usepackage{wrapfig}'. |
'\usepackage{picins}\usepackage{calc}'."\n". |
'\usepackage{picins}\usepackage{calc}'."\n". |
'\usepackage[utf8]{inputenc}'."\n". |
'\usepackage[T1]{fontenc}'."\n". |
|
'\usepackage[postscript]{ucs}'."\n". |
|
'\usepackage[utf8x]{inputenc}'."\n". |
|
'\usepackage{pifont}' . "\n". |
|
'\usepackage{latexsym}'."\n". |
|
'\usepackage{amsmath}'. |
|
'\usepackage{amssymb}'. |
|
'\usepackage{amsfonts}'. |
|
'\usepackage{amsthm}'. |
|
'\usepackage{amscd}'. |
'\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n". |
'\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}'."\n". |
'\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n". |
'\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}'."\n". |
'\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}'."\n". |
'\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}'."\n". |
Line 1632 ENDPART
|
Line 1666 ENDPART
|
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') or |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') or # BUGBUG |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') or # BUGBUG |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences')) { |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'select_sequences') |
|
) { |
|
|
|
|
#-- produce an output string |
#-- produce an output string |
Line 1640 ENDPART
|
Line 1675 ENDPART
|
$selectionmade = 2; |
$selectionmade = 2; |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') { |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') { |
$selectionmade = 3; |
$selectionmade = 3; |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') { |
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') |
|
) { |
$selectionmade = 4; |
$selectionmade = 4; |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') { #BUGBUG |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') { #BUGBUG |
$selectionmade = 4; |
$selectionmade = 4; |
Line 1744 ENDPART
|
Line 1780 ENDPART
|
if (($selectionmade == 4) and ($assignment ne $prevassignment)) { |
if (($selectionmade == 4) and ($assignment ne $prevassignment)) { |
my $name = &get_name(); |
my $name = &get_name(); |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
|
$prevassignment=$assignment; |
$prevassignment=$assignment; |
my $header_text = $parmhash{'print_header_format'}; |
my $header_text = $parmhash{'print_header_format'}; |
$header_text = &format_page_header($textwidth, $header_text, |
$header_text = &format_page_header($textwidth, $header_text, |
Line 1795 ENDPART
|
Line 1830 ENDPART
|
} |
} |
$result .= '\end{document}'; |
$result .= '\end{document}'; |
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || |
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || |
|
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') || |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){ |
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students')){ |
|
|
|
|
#-- prints assignments for whole class or for selected students |
#-- prints assignments for whole class or for selected students |
my $type; |
my $type; |
if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') { |
if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_students') || |
|
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems_students') ) { |
$selectionmade=5; |
$selectionmade=5; |
$type='problems'; |
$type='problems'; |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') { |
} elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_students') { |
Line 2086 ENDPART
|
Line 2123 ENDPART
|
} |
} |
} |
} |
|
|
|
|
# If there's been an unrecoverable SSI error, report it to the user |
|
# otherwise, we can write the tex file. |
|
# |
|
|
|
if ($ssi_error) { |
|
|
|
my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk'); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
$r->print(' |
|
<br /> |
|
<h2>'.&mt('An unrecoverable error occured:').'</h2> |
|
<p> |
|
'.&mt('One of the resources ([_1]) you chose to print could not be rendered due to an unrecoverable error when communicating with a server:',$ssi_last_error_resource).' |
|
<br /> |
|
'.$ssi_last_error.' |
|
</p> |
|
<p>'. |
|
&mt('It is recommended that you try printing again later, as this error may mean the server was just temporarily unavailable, or is down for maintenance.').'<br />'. |
|
&mt('If the error persists, please contact the [_1] for assistance.',$helpurl). |
|
'</p><p>'. |
|
&mt('We apologize for the inconvenience.'). |
|
'</p>'. |
|
$end_page); |
|
} else { |
|
|
|
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
my $identifier = &Apache::loncommon::get_cgi_id(); |
my $identifier = &Apache::loncommon::get_cgi_id(); |
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_$identifier.tex"; |
my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_$identifier.tex"; |
if (!($#print_array>0)) { |
if (!($#print_array>0)) { |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
$r->log_error("Couldn't open $filename for output $!"); |
$r->log_error("Couldn't open $filename for output $!"); |
return SERVER_ERROR; |
return SERVER_ERROR; |
} |
} |
print $temp_file $result; |
print $temp_file $result; |
my $begin=index($result,'\begin{document}',0); |
my $begin=index($result,'\begin{document}',0); |
my $inc=substr($result,0,$begin+16); |
my $inc=substr($result,0,$begin+16); |
} else { |
} else { |
my $begin=index($result,'\begin{document}',0); |
my $begin=index($result,'\begin{document}',0); |
my $inc=substr($result,0,$begin+16); |
my $inc=substr($result,0,$begin+16); |
for (my $i=0;$i<=$#print_array;$i++) { |
for (my $i=0;$i<=$#print_array;$i++) { |
if ($i==0) { |
if ($i==0) { |
$print_array[$i]=$result; |
$print_array[$i]=$result; |
} else { |
} else { |
$print_array[$i].='\end{document}'; |
$print_array[$i].='\end{document}'; |
$print_array[$i] = |
$print_array[$i] = |
&latex_corrections($number_of_columns,$print_array[$i], |
&latex_corrections($number_of_columns,$print_array[$i], |
$selectionmade, |
$selectionmade, |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
$helper->{'VARS'}->{'ANSWER_TYPE'}); |
|
|
my $anobegin=index($print_array[$i],'\setcounter{page}',0); |
|
substr($print_array[$i],0,$anobegin)=''; |
|
$print_array[$i]=$inc.$print_array[$i]; |
|
} |
|
my $temp_file; |
|
my $newfilename=$filename; |
|
my $num=$i+1; |
|
$newfilename =~s/\.tex$//; |
|
$newfilename=sprintf("%s_%03d.tex",$newfilename, $num); |
|
unless ($temp_file = Apache::File->new('>'.$newfilename)) { |
|
$r->log_error("Couldn't open $newfilename for output $!"); |
|
return SERVER_ERROR; |
|
} |
|
print $temp_file $print_array[$i]; |
|
} |
|
|
|
|
my $anobegin=index($print_array[$i],'\setcounter{page}',0); |
|
substr($print_array[$i],0,$anobegin)=''; |
|
$print_array[$i]=$inc.$print_array[$i]; |
|
} |
|
my $temp_file; |
|
my $newfilename=$filename; |
|
my $num=$i+1; |
|
$newfilename =~s/\.tex$//; |
|
$newfilename=sprintf("%s_%03d.tex",$newfilename, $num); |
|
unless ($temp_file = Apache::File->new('>'.$newfilename)) { |
|
$r->log_error("Couldn't open $newfilename for output $!"); |
|
return SERVER_ERROR; |
|
} |
|
print $temp_file $print_array[$i]; |
|
} |
|
} |
|
my $student_names=''; |
|
if ($#print_array>0) { |
|
for (my $i=0;$i<=$#print_array;$i++) { |
|
$student_names.=$student_names[$i].'_ENDPERSON_'; |
} |
} |
my $student_names=''; |
} else { |
if ($#print_array>0) { |
if ($#student_names>-1) { |
for (my $i=0;$i<=$#print_array;$i++) { |
$student_names=$student_names[0].'_ENDPERSON_'; |
$student_names.=$student_names[$i].'_ENDPERSON_'; |
|
} |
|
} else { |
} else { |
if ($#student_names>-1) { |
my $fullname = &get_name($env{'user.name'},$env{'user.domain'}); |
$student_names=$student_names[0].'_ENDPERSON_'; |
$student_names=join(':',$env{'user.name'},$env{'user.domain'}, |
} else { |
|
my $fullname = &get_name($env{'user.name'},$env{'user.domain'}); |
|
$student_names=join(':',$env{'user.name'},$env{'user.domain'}, |
|
$env{'request.course.sec'},$fullname). |
$env{'request.course.sec'},$fullname). |
'_ENDPERSON_'.'_END_'; |
'_ENDPERSON_'.'_END_'; |
} |
|
} |
} |
|
} |
|
|
# logic for now is too complex to trace if this has been defined |
# logic for now is too complex to trace if this has been defined |
# yet. |
# yet. |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
&Apache::lonnet::appenv({'cgi.'.$identifier.'.file' => $filename, |
&Apache::lonnet::appenv({'cgi.'.$identifier.'.file' => $filename, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.layout' => $laystyle, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
'cgi.'.$identifier.'.numcol' => $numberofcolumns, |
'cgi.'.$identifier.'.paper' => $papersize, |
'cgi.'.$identifier.'.paper' => $papersize, |
Line 2185 $end_page);
|
Line 2195 $end_page);
|
'cgi.'.$identifier.'.numberoffiles' => $#print_array, |
'cgi.'.$identifier.'.numberoffiles' => $#print_array, |
'cgi.'.$identifier.'.studentnames' => $student_names, |
'cgi.'.$identifier.'.studentnames' => $student_names, |
'cgi.'.$identifier.'.backref' => $URLback,}); |
'cgi.'.$identifier.'.backref' => $URLback,}); |
&Apache::lonnet::appenv({"cgi.$identifier.user" => $env{'user.name'}, |
&Apache::lonnet::appenv({"cgi.$identifier.user" => $env{'user.name'}, |
"cgi.$identifier.domain" => $env{'user.domain'}, |
"cgi.$identifier.domain" => $env{'user.domain'}, |
"cgi.$identifier.courseid" => $cnum, |
"cgi.$identifier.courseid" => $cnum, |
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.coursedom" => $cdom, |
"cgi.$identifier.resources" => $resources_printed}); |
"cgi.$identifier.resources" => $resources_printed}); |
|
|
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
|
my $continue_text = &mt('Continue'); |
|
# If there's been an unrecoverable SSI error, report it to the user |
|
if ($ssi_error) { |
|
my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk'); |
|
$r->print('<br /><h2>'.&mt('An unrecoverable network error occurred:').'</h2><p> '. |
|
&mt('At least one of the resources you chose to print could not be rendered due to an unrecoverable error when communicating with a server:'). |
|
'<br />'.$ssi_last_error_resource.'<br />'.$ssi_last_error. |
|
'</p><p>'.&mt('You can continue using the link provided below, but make sure to carefully inspect your output file! The errors will be marked in the file.').'<br />'. |
|
&mt('You may be able to reprint the individual resources for which this error occurred, as the issue may be temporary.'). |
|
'<br />'.&mt('If the error persists, please contact the [_1] for assistance.',$helpurl).'</p><p>'. |
|
&mt('We apologize for the inconvenience.').'</p>'. |
|
'<a href="/cgi-bin/printout.pl?'.$identifier.'">'.$continue_text.'</a>'.$end_page); |
|
} else { |
$r->print(<<FINALEND); |
$r->print(<<FINALEND); |
<br /> |
<br /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" /> |
<a href="/cgi-bin/printout.pl?$identifier">Continue</a> |
<a href="/cgi-bin/printout.pl?$identifier">$continue_text</a> |
$end_page |
$end_page |
FINALEND |
FINALEND |
} # endif ssi errors. |
} # endif ssi errors. |
} |
} |
|
|
|
|
Line 2271 sub print_resources {
|
Line 2294 sub print_resources {
|
|
|
&Apache::lonxml::remember_problem_counter(); |
&Apache::lonxml::remember_problem_counter(); |
|
|
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
|
|
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || |
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { |
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) { |
Line 2313 sub print_resources {
|
Line 2336 sub print_resources {
|
$current_output .= $rendered; |
$current_output .= $rendered; |
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { |
$printed .= $curresline.':'; |
$printed .= $curresline.':'; |
my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
my $rendered = &get_student_view_with_retries($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); |
if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { |
if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') { |
my $url = &Apache::lonnet::clutter($res_url); |
my $url = &Apache::lonnet::clutter($res_url); |
my $annotation = &annotate($url); |
my $annotation = &annotate($url); |
Line 2341 sub print_resources {
|
Line 2364 sub print_resources {
|
if (&Apache::loncommon::connection_aborted($r)) { last; } |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
} |
} |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
|
if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} |
|
my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); |
my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); |
my $header_line = |
my $header_line = |
&format_page_header($LaTeXwidth, $parmhash{'print_header_format'}, |
&format_page_header($LaTeXwidth, $parmhash{'print_header_format'}, |
$currentassignment, $courseidinfo, $fullname); |
$currentassignment, $courseidinfo, $fullname, $usersection); |
my $header_start = ($columns_in_format == 1) ? '\lhead' |
my $header_start = ($columns_in_format == 1) ? '\lhead' |
: '\fancyhead[LO]'; |
: '\fancyhead[LO]'; |
$header_line = $header_start.'{'.$header_line.'}'; |
$header_line = $header_start.'{'.$header_line.'}'; |
Line 2681 HELPERFRAGMENT
|
Line 2702 HELPERFRAGMENT
|
|
|
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES']; |
push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES']; |
|
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b> for <b>selected people</b>'), 'all_problems_students', 'ALL_PROBLEMS_STUDENTS']; |
&Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS); |
&Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS); |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
<resource variable="RESOURCES" toponly='0' multichoice="1" |
<resource variable="RESOURCES" toponly='0' multichoice="1" |
Line 2701 HELPERFRAGMENT
|
Line 2723 HELPERFRAGMENT
|
$start_new_option |
$start_new_option |
</resource> |
</resource> |
</state> |
</state> |
|
<state name="ALL_PROBLEMS_STUDENTS" title="Select Problem(s) to print"> |
|
<resource variable="RESOURCES" toponly='0' multichoice="1" |
|
suppressEmptySequences='0' addstatus="1" closeallpages="1"> |
|
<nextstate>STUDENTS1</nextstate> |
|
<filterfunc>return $isProblemOrMap;</filterfunc> |
|
<choicefunc>return $isNotMap;</choicefunc> |
|
<valuefunc>return $symbFilter;</valuefunc> |
|
$start_new_option |
|
</resource> |
|
</state> |
|
<state name="STUDENTS1" title="Select People"> |
|
<message><b>Select sorting order of printout</b> </message> |
|
<choices variable='student_sort'> |
|
<choice computer='0'>Sort by section then student</choice> |
|
<choice computer='1'>Sort by students across sections.</choice> |
|
</choices> |
|
<message><br /><hr /><br /> </message> |
|
<student multichoice='1' variable="STUDENTS" nextstate="PRINT_FORMATTING" coursepersonnel="1"/> |
|
</state> |
|
|
ALL_PROBLEMS |
ALL_PROBLEMS |
|
|
if ($helper->{VARS}->{'assignment'}) { |
if ($helper->{VARS}->{'assignment'}) { |