--- loncom/homework/structuretags.pm 2003/11/26 19:35:28 1.227 +++ loncom/homework/structuretags.pm 2004/02/06 22:38:24 1.227.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.227 2003/11/26 19:35:28 albertel Exp $ +# $Id: structuretags.pm,v 1.227.2.2 2004/02/06 22:38:24 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -454,7 +454,7 @@ sub start_problem { my @packages = split /,/,$packages; my $allow_print_points = 0; foreach my $partial_key (@packages) { - if ($partial_key=~m/part_0/) { + if ($partial_key=~m/^part_0$/) { $allow_print_points=1; } } @@ -517,7 +517,7 @@ sub end_problem { if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex') { if ( $target eq 'grade' && $Apache::inputtags::part eq '0' && - $status eq 'CAN_ANSWER' ) { + ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode)) { # if part is zero, no s existed, so we need to the grading &Apache::inputtags::grade; } elsif ( ($target eq 'web' || $target eq 'tex') && @@ -969,11 +969,11 @@ sub start_part { $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent'; } my $weight = &Apache::lonnet::EXT("resource.$id.weight"); - my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'keys'); + my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages'); my @allkeys = split /,/,$allkeys; my $allow_print_points = 0; foreach my $partial_key (@allkeys) { - if ($partial_key=~m/\_(\d*)\_weight/) { + if ($partial_key=~m/^part_(.*)$/) { if ($1 ne '0') {$allow_print_points=1;} } } @@ -1009,7 +1009,9 @@ sub end_part { my $result=''; if ( $target eq 'meta' ) { $result=''; - } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER' && !$hidden) { + } elsif ($target eq 'grade' && + ($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && + !$hidden) { $result=&Apache::inputtags::grade; } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,