[LON-CAPA-cvs] cvs: loncom /homework grades.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 24 Mar 2008 18:45:06 -0000


raeburn		Mon Mar 24 14:45:06 2008 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - use consistent calling style to pass %form hash (third argument) to &ssi_with_retries() 
  - fix typo
  - fix names of globals referred to in documentation for ssi_with_retries
  - &mt() the error message generated in case of ssi_error
  - change wording of error message for consistency with message displayed in case of 
    ssi_error when generating printouts (see lonprintout.pm 1.522).  
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.515 loncom/homework/grades.pm:1.516
--- loncom/homework/grades.pm:1.515	Mon Mar 17 16:39:50 2008
+++ loncom/homework/grades.pm	Mon Mar 24 14:45:04 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.515 2008/03/17 20:39:50 raeburn Exp $
+# $Id: grades.pm,v 1.516 2008/03/24 18:45:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -73,7 +73,7 @@
 #                      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
@@ -89,13 +89,13 @@
 #   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_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
+#    ssi_error_message   - The error string fetched from the ssi response
 #                               in the event of an error.
 #
 sub ssi_with_retries {
@@ -116,11 +116,20 @@
 
 sub ssi_print_error {
     my ($r) = @_;
-    $r->print('<h2>Unrecoverable network error</h2>');
-    $r->print('<p>Unable to perform a resource fetch from a server: <br />');
-    $r->print("Resource: $ssi_error_resource <br />");
-    $r->print("Error: $ssi_error_message <br /> Try again later.");
-    $r->print('If errors persist, contact LonCAPA support for assistance</p>');
+    my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk');
+    $r->print('
+<br />
+<h2>'.&mt('An unrecoverable network error occurred:').'</h2>
+<p>
+'.&mt('Unable to retrieve a resource from a server:').'<br />
+'.&mt('Resource:').' '.$ssi_error_resource.'<br />
+'.&mt('Error:').' '.$ssi_error_message.'
+</p>
+<p>'.
+&mt('It is recommended that you try 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>');
+    return;
 }
 
 #
@@ -276,12 +285,12 @@
 	my (undef,undef,$url)=&Apache::lonnet::decode_symb($symb);
 	$url=&Apache::lonnet::clutter($url);
 	my $subresult=&ssi_with_retries($url, $ssi_retries,
-					   ('grade_target' => 'analyze'),
-					   ('grade_domain' => $udom),
-					   ('grade_symb' => $symb),
-					   ('grade_courseid' => 
-					    $env{'request.course.id'}),
-					   ('grade_username' => $uname));
+					   ('grade_target' => 'analyze',
+					    'grade_domain' => $udom,
+					    'grade_symb' => $symb,
+					    'grade_courseid' => 
+					    $env{'request.course.id'},
+					    'grade_username' => $uname));
 	(undef,$subresult)=split(/_HASH_REF__/,$subresult,2);
 	my %analyze=&Apache::lonnet::str2hash($subresult);
 	return $analyze_cache{$key} = \%analyze;
@@ -7247,11 +7256,11 @@
             }
         }
 	my $result=&ssi_with_retries($resource->src(), $ssi_retries,
-					('symb' => $symb),
-					('grade_target' => 'analyze'),
-					('grade_courseid' => $cid),
-					('grade_domain' => $udom),
-					('grade_username' => $uname));
+					('symb' => $symb,
+					 'grade_target' => 'analyze',
+					 'grade_courseid' => $cid,
+					 'grade_domain' => $udom,
+					 'grade_username' => $uname));
 	my (undef, $an) =
 	    split(/_HASH_REF__/,$result, 2);