version 1.27, 2001/01/15 21:44:21
|
version 1.33, 2001/07/10 22:06:42
|
Line 10 sub BEGIN {
|
Line 10 sub BEGIN {
|
} |
} |
|
|
sub start_caparesponse { |
sub start_caparesponse { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $id = &Apache::response::start_response($parstack,$safeeval); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
return ''; |
return ''; |
} |
} |
|
|
sub end_caparesponse { |
sub end_caparesponse { |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result = ''; |
my $result = ''; |
if ( $target eq 'grade' ) { |
if ( $target eq 'grade' ) { |
if ( defined $ENV{'form.submitted'}) { |
if ( defined $ENV{'form.submitted'}) { |
Line 44 sub end_caparesponse {
|
Line 44 sub end_caparesponse {
|
} |
} |
} |
} |
} |
} |
} else { |
} elsif ($target eq 'web') { |
#$result .= "The correct answer is ".&Apache::run::run("{$$parstack['-1'];".'return $answer}',$safeeval)."\n"; |
#$result .= "The correct answer is ".&Apache::run::run("{$$parstack['-1'];".'return $answer}',$safeeval)."\n"; |
} |
} |
#Apache::lonxml::debug("\n<br>\nreal end caparesponse<br>\n"); |
#Apache::lonxml::debug("\n<br>\nreal end caparesponse<br>\n"); |
Line 53 sub end_caparesponse {
|
Line 53 sub end_caparesponse {
|
} |
} |
|
|
sub start_numericalresponse { |
sub start_numericalresponse { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $id = &Apache::response::start_response($parstack,$safeeval); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
return ''; |
my $result; |
|
if ($target eq 'edit') { |
|
$result.=&Apache::edit::tag_start($target,$token,&Apache::lonxml::description($token)); |
|
$result.=&Apache::edit::text_arg('Answer:','answer',$token). |
|
&Apache::edit::text_arg('Unit:','unit',$token).'</td></tr><tr><td colspan="3">'; |
|
} elsif ($target eq 'modified') { |
|
my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval, |
|
'answer','unit'); |
|
if ($constructtag) { |
|
$result = &Apache::edit::rebuild_tag($token); |
|
$result.=&Apache::edit::handle_insert(); |
|
} |
|
} |
|
return $result; |
} |
} |
|
|
sub end_numericalresponse { |
sub end_numericalresponse { |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result = ''; |
my $result = ''; |
if ( $target eq 'grade' ) { |
if ( $target eq 'grade' ) { |
if ( defined $ENV{'form.submitted'}) { |
if ( defined $ENV{'form.submitted'}) { |
Line 74 sub end_numericalresponse {
|
Line 87 sub end_numericalresponse {
|
$Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$response; |
$Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$response; |
&Apache::lonxml::debug("submitted a $response<br>\n"); |
&Apache::lonxml::debug("submitted a $response<br>\n"); |
&Apache::lonxml::debug($$parstack[$#$parstack] . "\n<br>"); |
&Apache::lonxml::debug($$parstack[$#$parstack] . "\n<br>"); |
|
$response =~ s/\\/\\\\/g; |
|
$response =~ s/\'/\\\'/g; |
|
&Apache::lonxml::debug("current $response"); |
my $expression="&caparesponse_check_list('".$response."','". |
my $expression="&caparesponse_check_list('".$response."','". |
$$parstack[$#$parstack]. |
$$parstack[$#$parstack]. |
';my $tol="'.$Apache::inputtags::params{'tol'}.'"'. |
';my $tol="'.$Apache::inputtags::params{'tol'}.'"'. |
Line 91 sub end_numericalresponse {
|
Line 107 sub end_numericalresponse {
|
} |
} |
} elsif ($target eq 'web') { |
} elsif ($target eq 'web') { |
my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
if ($award =~ /^correct/) { |
my $status = $Apache::inputtags::status['-1']; |
|
if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" ) { |
my $answervar=&Apache::run::run("{$$parstack['-1'];".'return $answer}',$safeeval); |
my $answervar=&Apache::run::run("{$$parstack['-1'];".'return $answer}',$safeeval); |
my (@answers)=&Apache::run::run("$answervar",$safeeval); |
my (@answers)=&Apache::run::run("$answervar",$safeeval); |
my $unit=&Apache::run::run("{$$parstack['-1'];".'return $unit}',$safeeval); |
my $unit=&Apache::run::run("{$$parstack['-1'];".'return $unit}',$safeeval); |
Line 102 sub end_numericalresponse {
|
Line 119 sub end_numericalresponse {
|
chop $result; |
chop $result; |
$result.=" $unit.<br></br>"; |
$result.=" $unit.<br></br>"; |
} |
} |
|
} elsif ($target eq 'edit') { |
|
$result.='</td></tr>'.&Apache::edit::end_table; |
} |
} |
&Apache::response::end_response; |
&Apache::response::end_response; |
return $result; |
return $result; |