[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonprintout.pm
www
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 28 Mar 2008 21:05:30 -0000
www Fri Mar 28 17:05:30 2008 EDT
Modified files:
/loncom/interface loncommon.pm lonprintout.pm
Log:
Bug #5631: detect errors in printouts for students.
Allow users to use the damaged output with marked error positions
(printing may take more than an hour, and 99% of the student printouts
may be fine)
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.650 loncom/interface/loncommon.pm:1.651
--- loncom/interface/loncommon.pm:1.650 Fri Mar 28 10:52:52 2008
+++ loncom/interface/loncommon.pm Fri Mar 28 17:05:28 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.650 2008/03/28 14:52:52 www Exp $
+# $Id: loncommon.pm,v 1.651 2008/03/28 21:05:28 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3179,7 +3179,11 @@
if (!$ok) {
$content = ''; # On error return an empty content.
}
- return ($content, $response);
+ if (wantarray) {
+ return ($content, $response);
+ } else {
+ return $content;
+ }
}
=pod
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.525 loncom/interface/lonprintout.pm:1.526
--- loncom/interface/lonprintout.pm:1.525 Fri Mar 28 11:22:48 2008
+++ loncom/interface/lonprintout.pm Fri Mar 28 17:05:29 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.525 2008/03/28 15:22:48 www Exp $
+# $Id: lonprintout.pm,v 1.526 2008/03/28 21:05:29 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -164,12 +164,11 @@
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;
+ $ssi_last_error_resource = $curresline.' for user '.$username.':'.$userdomain;
$ssi_last_error = $response->code . " " . $response->message;
$content='\section*{!!! An error occured !!!}';
- &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error");
+ &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error User: $username:$userdomain");
}
-
return $content;
}
@@ -2186,13 +2185,13 @@
my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');
my $end_page = &Apache::loncommon::end_page();
$r->print('<br /><h2>'.&mt('An unrecoverable network error occurred:').'</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('Make sure to carefully inspect your output file! The errors will be marked in the file.').'<br />'.
+ &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 occured, 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</a>'.$end_page);
+ '<a href="/cgi-bin/printout.pl?'.$identifier.'">Continue</a>'.$end_page);
} else {
$r->print(<<FINALEND);
<br />
@@ -2273,7 +2272,7 @@
&Apache::lonxml::remember_problem_counter();
- my $rendered = &Apache::loncommon::get_student_view_with_retries($curresline,$ssi_retry_count,$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') ||
($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {
@@ -2315,7 +2314,7 @@
$current_output .= $rendered;
} elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$printed .= $curresline.':';
- my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
+ my $rendered = &get_student_view($curresline,$ssi_retry_count,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv);
if ($helper->{'VARS'}->{'PRINT_ANNOTATIONS'} eq 'yes') {
my $url = &Apache::lonnet::clutter($res_url);
my $annotation = &annotate($url);