--- loncom/homework/response.pm 2009/05/24 13:08:18 1.216 +++ loncom/homework/response.pm 2010/10/14 19:54:56 1.219 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.216 2009/05/24 13:08:18 www Exp $ +# $Id: response.pm,v 1.219 2010/10/14 19:54:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,7 +30,7 @@ =head1 NAME -Apache::resonse.pm +Apache::response.pm =head1 SYNOPSIS @@ -280,7 +280,7 @@ sub meta_response_order { } sub check_for_previous { - my ($curresponse,$partid,$id,$last) = @_; + my ($curresponse,$partid,$id,$last,$type) = @_; my %previous; $previous{'used'} = 0; foreach my $key (sort(keys(%Apache::lonhomework::history))) { @@ -305,7 +305,15 @@ sub check_for_previous { if (! $previous{'award'} ) { $previous{'award'} = 'UNKNOWN'; } if ($previous{'award'} eq 'INTERNAL_ERROR') { $previous{'used'}=0; } &Apache::lonxml::debug("got a match :$previous{'award'}:$previous{'used'}:"); - } + } elsif ($type eq 'ci') { + if (lc($pastresponse) eq lc($curresponse)) { + if ($key =~ /^(\d+):/) { + push (@{$previous{'versionci'}},$1); + $previous{'awardci'} = $Apache::lonhomework::history{"resource.$partid.$id.awarddetail"}; + $previous{'usedci'} = 1; + } + } + } } } &Apache::lonhomework::showhash(%previous); @@ -318,7 +326,10 @@ sub handle_previous { if ($$previous{'last'}) { push(@Apache::inputtags::previous,'PREVIOUSLY_LAST'); push(@Apache::inputtags::previous_version,$$previous{'version'}); - } elsif ($Apache::lonhomework::type ne 'survey') { + } elsif (($Apache::lonhomework::type ne 'survey') && + ($Apache::lonhomework::type ne 'surveycred') && + ($Apache::lonhomework::type ne 'anonsurvey') && + ($Apache::lonhomework::type ne 'anonsurveycred')) { push(@Apache::inputtags::previous,'PREVIOUSLY_USED'); push(@Apache::inputtags::previous_version,$$previous{'version'}); } @@ -907,6 +918,10 @@ sub showallfoils { } } if ($Apache::lonhomework::type eq 'survey') { return 1; } + if ($Apache::lonhomework::type eq 'surveycred') { return 1; } + if ($Apache::lonhomework::type eq 'anonsurvey') { return 1; } + if ($Apache::lonhomework::type eq 'anonsurveycred') { return 1; } + return 0; }