--- loncom/homework/grades.pm 2009/04/15 17:02:35 1.561
+++ loncom/homework/grades.pm 2010/04/01 01:00:28 1.574.2.9
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.561 2009/04/15 17:02:35 bisitz Exp $
+# $Id: grades.pm,v 1.574.2.9 2010/04/01 01:00:28 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -97,9 +97,15 @@ sub ssi_print_error {
#
# --- Retrieve the parts from the metadata file.---
sub getpartlist {
- my ($symb) = @_;
+ my ($symb,$errorref) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
+ unless (ref($navmap)) {
+ if (ref($errorref)) {
+ $$errorref = 'navmap';
+ return;
+ }
+ }
my $res = $navmap->getBySymb($symb);
my $partlist = $res->parts();
my $url = $res->src();
@@ -144,9 +150,15 @@ sub nameUserString {
#--- Get the partlist and the response type for a given problem. ---
#--- Indicate if a response type is coded handgraded or not. ---
sub response_type {
- my ($symb) = shift;
+ my ($symb,$response_error) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
+ unless (ref($navmap)) {
+ if (ref($response_error)) {
+ $$response_error = 1;
+ }
+ return;
+ }
my $res = $navmap->getBySymb($symb);
my $partlist = $res->parts();
my %vPart =
@@ -193,12 +205,17 @@ sub get_display_part {
#--- Show resource title
#--- and parts and response type
sub showResourceInfo {
- my ($symb,$probTitle,$checkboxes) = @_;
+ my ($symb,$probTitle,$checkboxes,$res_error) = @_;
my $col=3;
if ($checkboxes) { $col=4; }
my $result = '
'.&mt('Current Resource').': '.$probTitle.'
'."\n";
+ my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error);
+ if (ref($res_error)) {
+ if ($$res_error) {
+ return;
+ }
+ }
$result .='
';
- my ($partlist,$handgrade,$responseType) = &response_type($symb);
my %resptype = ();
my $hdgrade='no';
my %partsseen;
@@ -766,7 +783,13 @@ sub verifyreceipt {
if ($env{"course.$courseid.receiptalg"} eq 'receipt2' ||
$env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; }
my $parts=['0'];
- if ($receiptparts) { ($parts)=&response_type($symb); }
+ if ($receiptparts) {
+ my $res_error;
+ ($parts)=&response_type($symb,\$res_error);
+ if ($res_error) {
+ return &navmap_errormsg();
+ }
+ }
my $header =
&Apache::loncommon::start_data_table().
@@ -1044,7 +1067,7 @@ LISTJAVASCRIPT
$gradeTable.= &Apache::loncommon::start_data_table_row();
}
$gradeTable.='