version 1.17, 2001/01/08 21:52:04
|
version 1.26, 2001/05/04 21:19:37
|
Line 7 package Apache::response;
|
Line 7 package Apache::response;
|
use strict; |
use strict; |
|
|
sub BEGIN { |
sub BEGIN { |
&Apache::lonxml::register('Apache::response',('responseparam','caparesponse','numericalresponse','radiobuttonresponse')); |
&Apache::lonxml::register('Apache::response',('responseparam','caparesponse','numericalresponse','radiobuttonresponse','optionresponse','imageresponse','essayresponse')); |
} |
} |
|
|
sub start_response { |
sub start_response { |
Line 28 sub end_response {
|
Line 28 sub end_response {
|
return ''; |
return ''; |
} |
} |
|
|
|
# used by response to set the non-safe space random number generator to something |
|
# that is stable and unique based on the part number and response number |
|
sub setrandomnumber { |
|
my $rndseed=&Apache::lonnet::rndseed(); |
|
&Apache::lonxml::debug("randseed $rndseed"); |
|
# $rndseed=unpack("%32i",$rndseed); |
|
$rndseed=$rndseed |
|
+(&Apache::lonnet::numval($Apache::inputtags::part) << 10) |
|
+&Apache::lonnet::numval($Apache::inputtags::response['-1']); |
|
srand($rndseed); |
|
&Apache::lonxml::debug("randseed $rndseed"); |
|
return ''; |
|
} |
|
|
sub meta_parameter_write { |
sub meta_parameter_write { |
my ($name,$type,$default,$display)=@_; |
my ($name,$type,$default,$display)=@_; |
return '<parameter part="'.$Apache::inputtags::part. |
return '<parameter part="'.$Apache::inputtags::part. |
Line 71 sub mandatory_part_meta {
|
Line 85 sub mandatory_part_meta {
|
&meta_stores_write('solved','string', |
&meta_stores_write('solved','string', |
'Problem Status'). |
'Problem Status'). |
&meta_stores_write('tries','int_zeropos', |
&meta_stores_write('tries','int_zeropos', |
'Number of Unsuccessful Tries'). |
'Number of Attempts'). |
&meta_stores_write('awarded','float', |
&meta_stores_write('awarded','float', |
'Partial Credit Factor'); |
'Partial Credit Factor'); |
# |
# |
Line 88 sub start_numericalresponse {
|
Line 102 sub start_numericalresponse {
|
require Apache::caparesponse; |
require Apache::caparesponse; |
import Apache::caparesponse; |
import Apache::caparesponse; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
Apache::caparesponse::start_numericalresponse($target,$token,$parstack,$parser,$safeeval,$style);; |
return &Apache::caparesponse::start_numericalresponse($target,$token,$parstack,$parser,$safeeval,$style); |
return ""; |
|
} |
} |
|
|
sub start_caparesponse { |
sub start_caparesponse { |
require Apache::caparesponse; |
require Apache::caparesponse; |
import Apache::caparesponse; |
import Apache::caparesponse; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
# print "\n<br>\nsimple caparesponse\n"; |
# print "\n<br />\nsimple caparesponse\n"; |
Apache::caparesponse::start_caparesponse($target,$token,$parstack,$parser,$safeeval,$style);; |
return &Apache::caparesponse::start_caparesponse($target,$token,$parstack,$parser,$safeeval,$style); |
return ""; |
|
} |
} |
|
|
sub start_radiobuttonresponse { |
sub start_radiobuttonresponse { |
require Apache::radiobuttonresponse; |
require Apache::radiobuttonresponse; |
import Apache::radiobuttonresponse; |
import Apache::radiobuttonresponse; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
Apache::radiobuttonresponse::start_radiobuttonresponse($target,$token,$parstack,$parser,$safeeval,$style);; |
return &Apache::radiobuttonresponse::start_radiobuttonresponse($target,$token,$parstack,$parser,$safeeval,$style); |
return ""; |
} |
|
|
|
sub start_optionresponse { |
|
require Apache::optionresponse; |
|
import Apache::optionresponse; |
|
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
|
return &Apache::optionresponse::start_optionresponse($target,$token,$parstack,$parser,$safeeval,$style); |
|
} |
|
|
|
sub start_imageresponse { |
|
require Apache::imageresponse; |
|
import Apache::imageresponse; |
|
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
|
return &Apache::imageresponse::start_imageresponse($target,$token,$parstack,$parser,$safeeval,$style); |
|
} |
|
|
|
sub start_essayresponse { |
|
require Apache::essayresponse; |
|
import Apache::essayresponse; |
|
my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; |
|
return &Apache::essayresponse::start_essayresponse($target,$token,$parstack,$parser,$safeeval,$style); |
} |
} |
|
|
sub start_responseparam { |
sub start_responseparam { |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'grade') { |
if ($target eq 'grade' || $target eq 'web') { |
my $args=''; |
my $args=''; |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } |
my $default = &Apache::run::run("{$args;".'return $default}',$safeeval); |
my $default = &Apache::run::run("{$args;".'return $default}',$safeeval); |
Line 119 sub start_responseparam {
|
Line 151 sub start_responseparam {
|
&Apache::lonxml::debug("looking for resource.$Apache::inputtags::part.$name"); |
&Apache::lonxml::debug("looking for resource.$Apache::inputtags::part.$name"); |
my $value = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.$name"); |
my $value = &Apache::lonnet::EXT("resource.$Apache::inputtags::part.$name"); |
&Apache::lonxml::debug("$name has value :$value: and default :$default:"); |
&Apache::lonxml::debug("$name has value :$value: and default :$default:"); |
if ($value eq '') { |
if ($value eq '' || $value eq 'con_lost') { |
&Apache::lonxml::debug("defaullting"); |
&Apache::lonxml::debug("defaulting"); |
$Apache::inputtags::params{$name}=$default; |
$Apache::inputtags::params{$name}=$default; |
} else { |
} else { |
&Apache::lonxml::debug("using value"); |
&Apache::lonxml::debug("using value"); |
Line 138 sub start_responseparam {
|
Line 170 sub start_responseparam {
|
} |
} |
|
|
sub end_responseparam { |
sub end_responseparam { |
|
return ''; |
} |
} |
|
|
1; |
1; |