--- loncom/homework/caparesponse/caparesponse.pm 2000/12/08 20:53:45 1.18
+++ loncom/homework/caparesponse/caparesponse.pm 2000/12/11 23:47:36 1.19
@@ -12,18 +12,8 @@ sub BEGIN {
$Apache::caparesponse::result='';
sub start_caparesponse {
my ($target,$token,$parstack,$parser,$safeeval)=@_;
- my $args ='';
- if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
- my $id = &Apache::run::run("{$args;".'return $id}',$safeeval);
- if ($id eq '') { $id = $Apache::lonxml::curdepth; }
- push (@Apache::inputtags::response,$id);
- push (@Apache::inputtags::responselist,$id);
+ my $id = &Apache::response::start_response($parstack,$safeeval);
return '';
- #my $envkey;
- #foreach $envkey (sort keys %ENV) {
- # Apache::lonxml::debug("$envkey ---- $ENV{$envkey}
");
- #}
- #Apache::lonxml::debug("\n
\nreal caparesponse
\n");
}
sub end_caparesponse {
@@ -33,8 +23,9 @@ sub end_caparesponse {
if ( defined $ENV{'form.submit'}) {
$Apache::caparesponse::result='';
$safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
- my $response = $ENV{'form.HWVAL'.$Apache::inputtags::curvalue};
+ my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']};
if ( $response =~ /[^\s]/) {
+ #check_for_previous($response,$id,$response);
$Apache::lonhomework::results{"resource.submission.$Apache::inputtags::part.$Apache::inputtags::response['-1']"}=$response;
&Apache::lonxml::debug("submitted a $response
\n");
&Apache::lonxml::debug($$parstack[$#$parstack] . "\n
");
@@ -54,7 +45,7 @@ sub end_caparesponse {
#$result .= "The correct answer is ".&Apache::run::run("{$$parstack['-1'];".'return $answer}',$safeeval)."\n";
}
#Apache::lonxml::debug("\n
\nreal end caparesponse
\n");
- pop @Apache::inputtags::response;
+ &Apache::response::end_response;
return $result;
}