version 1.54, 2001/12/07 23:59:08
|
version 1.62, 2002/05/03 19:32:57
|
Line 32
|
Line 32
|
package Apache::response; |
package Apache::response; |
use strict; |
use strict; |
|
|
sub BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::response',('responseparam','caparesponse','numericalresponse','formularesponse','stringresponse','radiobuttonresponse','optionresponse','imageresponse','essayresponse','dataresponse')); |
&Apache::lonxml::register('Apache::response',('responseparam','parameter','caparesponse','numericalresponse','formularesponse','stringresponse','radiobuttonresponse','optionresponse','imageresponse','essayresponse','dataresponse','externalresponse')); |
} |
} |
|
|
sub start_response { |
sub start_response { |
Line 62 sub start_hintresponse {
|
Line 62 sub start_hintresponse {
|
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
push (@Apache::inputtags::response,$id); |
push (@Apache::inputtags::response,$id); |
|
push (@Apache::inputtags::paramstack,[%Apache::inputtags::params]); |
return $id; |
return $id; |
} |
} |
|
|
sub end_hintresponse { |
sub end_hintresponse { |
pop @Apache::inputtags::response; |
pop @Apache::inputtags::response; |
|
%Apache::inputtags::params=@{pop(@Apache::inputtags::paramstack)}; |
return ''; |
return ''; |
} |
} |
|
|
Line 78 sub setrandomnumber {
|
Line 80 sub setrandomnumber {
|
$rndseed=$ENV{'form.rndseed'}; |
$rndseed=$ENV{'form.rndseed'}; |
if (!$rndseed) { $rndseed=time; } |
if (!$rndseed) { $rndseed=time; } |
} else { |
} else { |
$rndseed=&Apache::lonnet::rndseed(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
|
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
} |
} |
&Apache::lonxml::debug("randseed $rndseed"); |
&Apache::lonxml::debug("randseed $rndseed"); |
# $rndseed=unpack("%32i",$rndseed); |
# $rndseed=unpack("%32i",$rndseed); |
Line 262 sub start_essayresponse {
|
Line 265 sub start_essayresponse {
|
return &Apache::essayresponse::start_essayresponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style); |
return &Apache::essayresponse::start_essayresponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style); |
} |
} |
|
|
|
sub start_externalresponse { |
|
require Apache::externalresponse; |
|
import Apache::externalresponse; |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
return &Apache::externalresponse::start_externalresponse($target,$token,$tagstack,$parstack,$parser,$safeeval,$style); |
|
} |
|
|
sub view_or_modify { |
sub view_or_modify { |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
my $myself=0; |
my $myself=0; |
Line 333 sub start_responseparam {
|
Line 343 sub start_responseparam {
|
$token->[2]->{'default'}, |
$token->[2]->{'default'}, |
$token->[2]->{'description'}); |
$token->[2]->{'description'}); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::tag_start($target,$token, |
$result.=&Apache::edit::tag_start($target,$token); |
&Apache::lonxml::description($token)); |
|
$result.=&Apache::edit::text_arg('Name:','name',$token). |
$result.=&Apache::edit::text_arg('Name:','name',$token). |
&Apache::edit::text_arg('Type:','type',$token). |
&Apache::edit::text_arg('Type:','type',$token). |
&Apache::edit::text_arg('Description:','description',$token). |
&Apache::edit::text_arg('Description:','description',$token). |
Line 349 sub start_responseparam {
|
Line 358 sub start_responseparam {
|
$result = &Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::handle_insert(); |
$result.=&Apache::edit::handle_insert(); |
} |
} |
} elsif ($target eq 'grade') { |
} elsif ($target eq 'grade' || $target eq 'answer' || |
|
$target eq 'web' || $target eq 'tex') { |
if ($ENV{'request.state'} eq 'construct') { |
if ($ENV{'request.state'} eq 'construct') { |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); |
my $default = &Apache::lonxml::get_param('default',$parstack,$safeeval); |
my $default = &Apache::lonxml::get_param('default',$parstack,$safeeval); |
$Apache::inputtags::params{$name}=$default; |
if ($name) {$Apache::inputtags::params{$name}=$default;} |
} |
} |
} |
} |
return $result; |
return $result; |
Line 365 sub end_responseparam {
|
Line 375 sub end_responseparam {
|
return ''; |
return ''; |
} |
} |
|
|
|
sub start_parameter { |
|
my $result = &start_responseparam(@_); |
|
return $result; |
|
} |
|
|
|
sub end_parameter { |
|
my $result = &end_responseparam(@_); |
|
return $result; |
|
} |
|
|
sub setup_params { |
sub setup_params { |
my ($tag) = @_; |
my ($tag) = @_; |
|
|
if ($ENV{'request.state'} eq 'construct') { return; } |
if ($ENV{'request.state'} eq 'construct') { return; } |
@Apache::inputtags::params=(); |
%Apache::inputtags::params=(); |
my %paramlist=(); |
my %paramlist=(); |
foreach my $key (keys(%Apache::lonnet::packagetab)) { |
foreach my $key (keys(%Apache::lonnet::packagetab)) { |
if ($key =~ /^$tag/) { |
if ($key =~ /^$tag/) { |
Line 431 sub answer_footer {
|
Line 451 sub answer_footer {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub showallfoils { |
|
my $return=0; |
|
if (defined($ENV{'form.showallfoils'}) && |
|
$ENV{'request.state'} eq 'construct') { |
|
$return=1; |
|
} |
|
return $return; |
|
} |
1; |
1; |
__END__ |
__END__ |
|
|