--- loncom/homework/grades.pm 2008/03/24 19:14:07 1.513.2.2 +++ loncom/homework/grades.pm 2008/03/12 02:46:52 1.514 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.513.2.2 2008/03/24 19:14:07 raeburn Exp $ +# $Id: grades.pm,v 1.514 2008/03/12 02:46:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -73,7 +73,7 @@ my $ssi_error_message; # 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 occurred. +# to indicate to the caller an SSI error occured. # 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 @@ my $ssi_error_message; # 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 occurred this becomes true. +# ssi_error - If an unrecoverable error occured this becomes true. # It is up to the caller to initialize this to false # if desired. -# ssi_error_resource - If an unrecoverable error occurred, this is the value +# ssi_last_error_resource - If an unrecoverable error occured, this is the value # of the resource that could not be rendered by the ssi # call. -# ssi_error_message - The error string fetched from the ssi response +# ssi_last_error - The error string fetched from the ssi response # in the event of an error. # sub ssi_with_retries { @@ -116,20 +116,11 @@ sub ssi_with_retries { sub ssi_print_error { my ($r) = @_; - my $helpurl = &Apache::loncommon::top_nav_help('Helpdesk'); - $r->print(' -
-

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

-

-'.&mt('Unable to retrieve a resource from a server:').'
-'.&mt('Resource:').' '.$ssi_error_resource.'
-'.&mt('Error:').' '.$ssi_error_message.' -

-

'. -&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.').'
'. -&mt('If the error persists, please contact the [_1] for assistance.',$helpurl). -'

'); - return; + $r->print('

Unrecoverable network error

'); + $r->print('

Unable to perform a resource fetch from a server:
'); + $r->print("Resource: $ssi_error_resource
"); + $r->print("Error: $ssi_error_message
Try again later."); + $r->print('If errors persist, contact LonCAPA support for assistance

'); } # @@ -285,12 +276,12 @@ sub reset_caches { 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; @@ -1842,9 +1833,9 @@ sub download_all_link { join("\n",&Apache::loncommon::get_env_multiple('form.vPart')); my $identifier = &Apache::loncommon::get_cgi_id(); - &Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students, - 'cgi.'.$identifier.'.symb' => $symb, - 'cgi.'.$identifier.'.parts' => $parts,); + &Apache::lonnet::appenv({'cgi.'.$identifier.'.students' => $all_students, + 'cgi.'.$identifier.'.symb' => $symb, + 'cgi.'.$identifier.'.parts' => $parts,}); $r->print(''. &mt('Download All Submitted Documents').''); return @@ -7240,27 +7231,24 @@ sub scantron_get_maxbubble { my $response_number = 0; my $bubble_line = 0; foreach my $resource (@resources) { - my $symb = $resource->symb(); # Need to retrieve part IDs and response IDs because essayresponse, # reactionresponse and organicresponse items are not included in # $analysis{'parts'} from lonnet::ssi. my %possible_part_ids; if (ref($resource->parts()) eq 'ARRAY') { foreach my $part (@{$resource->parts()}) { - if (!&Apache::loncommon::check_if_partid_hidden($part,$symb,$udom,$uname)) { - my @resp_ids = $resource->responseIds($part); - foreach my $id (@resp_ids) { - $possible_part_ids{$part.'.'.$id} = 1; - } + my @resp_ids = $resource->responseIds($part); + foreach my $id (@resp_ids) { + $possible_part_ids{$part.'.'.$id} = 1; } } } my $result=&ssi_with_retries($resource->src(), $ssi_retries, - ('symb' => $symb, - 'grade_target' => 'analyze', - 'grade_courseid' => $cid, - 'grade_domain' => $udom, - 'grade_username' => $uname)); + ('symb' => $resource->symb()), + ('grade_target' => 'analyze'), + ('grade_courseid' => $cid), + ('grade_domain' => $udom), + ('grade_username' => $uname)); my (undef, $an) = split(/_HASH_REF__/,$result, 2); @@ -7269,12 +7257,7 @@ sub scantron_get_maxbubble { my %analysis = &Apache::lonnet::str2hash($an); if (ref($analysis{'parts'}) eq 'ARRAY') { - foreach my $part (@{$analysis{'parts'}}) { - my ($id,$respid) = split(/\./,$part); - if (!&Apache::loncommon::check_if_partid_hidden($id,$symb,$udom,$uname)) { - push(@parts,$part); - } - } + @parts = @{$analysis{'parts'}}; } # Add part_ids for any essayresponse items. foreach my $part_id (keys(%possible_part_ids)) { @@ -7509,7 +7492,7 @@ SCANTRONFORM ($uname,$udom)=split(/:/,$uname); &Apache::lonxml::clear_problem_counter(); - &Apache::lonnet::appenv(%$scan_record); + &Apache::lonnet::appenv($scan_record); if (&scantron_clear_skip($scanlines,$scan_data,$i)) { &scantron_putfile($scanlines,$scan_data);