--- loncom/interface/lonprintout.pm 2008/03/23 19:48:49 1.522 +++ loncom/interface/lonprintout.pm 2008/03/28 14:52:52 1.524 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.522 2008/03/23 19:48:49 raeburn Exp $ +# $Id: lonprintout.pm,v 1.524 2008/03/28 14:52:52 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -116,7 +116,7 @@ sub annotate { # the number of times requested by the caller. # If we still have a proble, no text is appended to the # 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 # in LonCAPA BZ 5631 see: # http://bugs.lon-capa.org/show_bug.cgi?id=5631 @@ -132,10 +132,10 @@ sub annotate { # On success, returns the rendered resource identified by the resource parameter. # Side Effects: # 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 # 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 # call. # ssi_last_error - The error string fetched from the ssi response @@ -158,6 +158,22 @@ 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; + $ssi_last_error = $response->code . " " . $response->message; + + &Apache::lonnet::logthis("Error in SSI (student view) resource: $curresline Error: $ssi_last_error"); + } + + return $content; + +} + # # printf_style_subst item format_string repl # @@ -2097,7 +2113,7 @@ ENDPART my $end_page = &Apache::loncommon::end_page(); $r->print('
-

'.&mt('An unrecoverable error occured:').'

+

'.&mt('An unrecoverable network error occurred:').'

'.&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).'
@@ -2271,7 +2287,7 @@ sub print_resources { &Apache::lonxml::remember_problem_counter(); - my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); + my $rendered = &Apache::loncommon::get_student_view_with_retries($curresline,3,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) {