Annotation of loncom/homework/radiobuttonresponse.pm, revision 1.2
1.1 albertel 1: # The LearningOnline Network with CAPA
2: # mutliple choice style responses
3:
4: # 11/23,11/24,11/28 Gerd Kortemeyer
5:
6: package Apache::radiobuttonresponse;
7: use strict;
8:
9: sub BEGIN {
10: &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse','foilgroup','foil'));
11: }
12:
13: sub start_radiobuttonresponse {
14: }
15:
16: sub end_radiobuttonresponse {
17: }
18:
19: %Apache::response::foilgroup={};
20: sub start_foilgroup {
21: %Apache::response::foilgroup={};
22: }
23:
24: sub end_foilgroup {
25: my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
26: my $name;
27: my $result;
28: foreach $name ($Apache::response::foilgroup{'names'}) {
1.2 ! albertel 29: $result.="<br><b>$name</b> is <i> $Apache::response::foilgroup{$name.'.value'} </i>";
1.1 albertel 30: }
31: return $result;
32: }
33:
34: sub start_foil {
35: $Apache::lonxml::redirection++;
36: }
37:
38: sub end_foil {
39: my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
40: my $args ='';
41: if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
42: my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
43: push @{ $Apache::response::foilgroup{'names'} }, $name;
44: my $value = &Apache::run::run("{$args;".'return $value}',$safeeval);
45: $Apache::response::foilgroup{"$name.value"} = $value;
46: $Apache::response::foilgroup{"$name.text"} = $Apache::lonxml::outputstack;
47: $Apache::lonxml::redirection--;
48: return '';
49: }
50:
51: 1;
52: __END__
53:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>