--- loncom/homework/essayresponse.pm 2003/01/24 19:49:48 1.22
+++ loncom/homework/essayresponse.pm 2003/04/19 09:00:54 1.30
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.22 2003/01/24 19:49:48 www Exp $
+# $Id: essayresponse.pm,v 1.30 2003/04/19 09:00:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,7 +74,7 @@ sub start_essayresponse {
"'multipart/form-data'".';" />
Allowed filetypes: '.$uploadedfiletypes.'
';
if ($uploadedfile) {
$result.='Currently submitted: '.$uploadedfile.'';
+ &Apache::lonnet::tokenwrapper($Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}).'"> '.$uploadedfile.'';
} else {
$result.='(Hand in a file you have prepared on your computer)';
}
@@ -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,8 +98,21 @@ sub end_essayresponse {
$Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators
if ($collaborators ne $previous_list);
}
- if ( defined $ENV{'form.submitted'}) {
- my $response = $ENV{'form.HWVAL'.$id};
+ if ( defined($ENV{'form.submitted'}) &&
+ $ENV{'form.submitted'} eq 'scantron' ) {
+ my $repetition=&Apache::response::repetition();
+ $increment=$repetition;
+ my $score=0;
+ for (my $i=0;$i<$repetition;$i++) {
+ my $increase=&Apache::response::getresponse($i+1);
+ if ($increase ne '') { $score+=$increase+1; }
+ }
+ my $weight = &Apache::lonnet::EXT("resource.$part.weight");
+ my $pcr=$score/$weight;
+ $Apache::lonhomewok::results{"resource.$part.$id.awarded"}=$pcr;
+ $Apache::lonhomewok::results{"resource.$part.$id.awarddetail"}='ASSIGNED_SCORE';
+ } elsif ( defined($ENV{'form.submitted'}) ) {
+ my $response = $ENV{'form.HWVAL_'.$id};
my $filename= $ENV{'form.HWFILE'.$part.'_'.$id.'.filename'};
if (( $response =~ /[^\s]/) || ($filename =~ /[^\s]/)) {
my $award;
@@ -132,13 +146,19 @@ sub end_essayresponse {
$result.=&Apache::edit::end_table();
} elsif ($target eq 'tex') {
if ($Apache::lonhomework::type eq 'exam') {
- $result.='\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Live blank on scoring form}\vskip 0 mm';
- &Apache::lonxml::increment_counter();
- $result.= '\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm \end{enumerate}';
- &Apache::lonxml::increment_counter();
+ my $repetition=&Apache::response::repetition();
+ $result.='\begin{enumerate}';
+ for (my $i=0;$i<$repetition;$i++) {
+ $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;
}