--- loncom/homework/caparesponse/caparesponse.pm 2011/02/26 01:45:02 1.236.12.2
+++ loncom/homework/caparesponse/caparesponse.pm 2010/02/28 23:45:43 1.237
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.236.12.2 2011/02/26 01:45:02 raeburn Exp $
+# $Id: caparesponse.pm,v 1.237 2010/02/28 23:45:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -305,7 +305,7 @@ sub start_numericalresponse {
my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit');
&Apache::lonxml::debug("Got unit $hideunit for $partid $id");
#no way to enter units, with radio buttons
- if ((lc($hideunit) eq "yes") && ($Apache::lonhomework::type ne 'exam')) {
+ if (lc($hideunit) eq "yes") {
my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
$safeeval);
if ($unit =~ /\S/) { $result.=" (in $unit) "; }
@@ -533,11 +533,18 @@ sub end_numericalresponse {
$Apache::inputtags::params{'sig'});
}
&Apache::lonxml::debug("\n
result:$result:$Apache::lonxml::curdepth
\n");
- if ($Apache::lonhomework::type eq 'survey' &&
- ($ad eq 'INCORRECT' || $ad eq 'APPROX_ANS' ||
- $ad eq 'EXACT_ANS')) {
- $ad='SUBMITTED';
- }
+ if (($ad eq 'INCORRECT' || $ad eq 'APPROX_ANS' ||
+ $ad eq 'EXACT_ANS')) {
+ if ($Apache::lonhomework::type eq 'survey') {
+ $ad='SUBMITTED';
+ } elsif ($Apache::lonhomework::type eq 'surveycred') {
+ $ad='SUBMITTED_CREDIT';
+ } elsif ($Apache::lonhomework::type eq 'anonsurvey') {
+ $ad='ANONYMOUS';
+ } elsif ($Apache::lonhomework::type eq 'anonsurveycred') {
+ $ad='ANONYMOUS_CREDIT';
+ }
+ }
&Apache::response::handle_previous(\%previous,$ad);
$Apache::lonhomework::results{"resource.$partid.$id.awarddetail"}=$ad;
$Apache::lonhomework::results{"resource.$partid.$id.awardmsg"}=$msg;
@@ -1079,7 +1086,6 @@ sub start_stringresponse {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
my $id = &Apache::response::start_response($parstack,$safeeval);
- undef(%answer);
if ($target eq 'meta') {
$result=&Apache::response::meta_package_write('stringresponse');
} elsif ($target eq 'edit') {
@@ -1187,11 +1193,18 @@ sub end_stringresponse {
\@final_msgs,
\@names,1);
}
- if ($Apache::lonhomework::type eq 'survey' &&
- ($ad eq 'INCORRECT' || $ad eq 'APPROX_ANS' ||
- $ad eq 'EXACT_ANS')) {
- $ad='SUBMITTED';
- }
+ if (($ad eq 'INCORRECT' || $ad eq 'APPROX_ANS' ||
+ $ad eq 'EXACT_ANS')) {
+ if ($Apache::lonhomework::type eq 'survey') {
+ $ad='SUBMITTED';
+ } elsif ($Apache::lonhomework::type eq 'surveycred') {
+ $ad='SUBMITTED_CREDIT';
+ } elsif ($Apache::lonhomework::type eq 'anonsurvey') {
+ $ad='ANONYMOUS';
+ } elsif ($Apache::lonhomework::type eq 'anonsurveycred') {
+ $ad='ANONYMOUS_CREDIT';
+ }
+ }
&Apache::response::handle_previous(\%previous,$ad);
$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
$Apache::lonhomework::results{"resource.$part.$id.awardmsg"}=$msg;