--- loncom/homework/essayresponse.pm 2003/04/08 02:40:56 1.26 +++ loncom/homework/essayresponse.pm 2003/04/18 07:12:13 1.27 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # essay (ungraded) style responses # -# $Id: essayresponse.pm,v 1.26 2003/04/08 02:40:56 albertel Exp $ +# $Id: essayresponse.pm,v 1.27 2003/04/18 07:12:13 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -89,6 +89,7 @@ sub end_essayresponse { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $part = $Apache::inputtags::part; my $id = $Apache::inputtags::response[-1]; + my $increment = 1; my $result; if ( $target eq 'grade' ) { my $collaborators = $ENV{'form.HWCOL'.$part.'_'.$id}; @@ -97,7 +98,11 @@ sub end_essayresponse { $Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators if ($collaborators ne $previous_list); } - if ( defined $ENV{'form.submitted'}) { + if ( defined($ENV{'form.submitted'}) && + $ENV{'form.submitted'}='scantron' ) { + my $repetition=&Apache::response::repetition(); + $increment=$repetition; + } elsif ( defined($ENV{'form.submitted'}) ) { my $response = $ENV{'form.HWVAL_'.$id}; my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'}; if (( $response =~ /[^\s]/) || ($filename =~ /[^\s]/)) { @@ -132,19 +137,19 @@ sub end_essayresponse { $result.=&Apache::edit::end_table(); } elsif ($target eq 'tex') { if ($Apache::lonhomework::type eq 'exam') { - my $id = $Apache::inputtags::part; - my $weight = &Apache::lonnet::EXT("resource.$id.weight"); - my $repetition = int $weight/9; - if ($weight % 9 != 0) {$repetition++;} + my $repetition=&Apache::response::repetition(); $result.='\begin{enumerate}'; for (my $i=0;$i<$repetition;$i++) { - $result.='\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; - &Apache::lonxml::increment_counter(); + $result.='\item[\textbf{'.($Apache::lonxml::counter+$i). + '}.]\textit{Leave blank on scoring form}\vskip 0 mm'; } $result.= '\end{enumerate}'; } } - + if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || + $target eq 'tex' || $target eq 'analyze') { + &Apache::lonxml::increment_counter($increment); + } &Apache::response::end_response; return $result; }