version 1.41, 2002/05/03 20:13:14
|
version 1.44, 2002/08/05 14:59:24
|
Line 29
|
Line 29
|
|
|
package Apache::radiobuttonresponse; |
package Apache::radiobuttonresponse; |
use strict; |
use strict; |
|
use HTML::Entities(); |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse')); |
&Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse')); |
Line 73 sub end_radiobuttonresponse {
|
Line 74 sub end_radiobuttonresponse {
|
return $result; |
return $result; |
} |
} |
|
|
%Apache::response::foilgroup={}; |
%Apache::response::foilgroup=(); |
sub start_foilgroup { |
sub start_foilgroup { |
%Apache::response::foilgroup={}; |
%Apache::response::foilgroup=(); |
$Apache::radiobuttonresponse::conceptgroup=0; |
$Apache::radiobuttonresponse::conceptgroup=0; |
&Apache::response::setrandomnumber(); |
&Apache::response::setrandomnumber(); |
return ''; |
return ''; |
Line 217 sub whichfoils {
|
Line 218 sub whichfoils {
|
push (@falselist,$name); |
push (@falselist,$name); |
} elsif ($Apache::response::foilgroup{$name.'.value'} eq 'unused') { |
} elsif ($Apache::response::foilgroup{$name.'.value'} eq 'unused') { |
} else { |
} else { |
&Apache::lonxml::error(&HTML::Entites::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>")); |
&Apache::lonxml::error(&HTML::Entities::encode("No valid value assigned ($Apache::response::foilgroup{$name.'.value'}) for foil $name in <foilgroup>")); |
} |
} |
} |
} |
my $whichtrue = int(rand($#truelist+1)); |
my $whichtrue = int(rand($#truelist+1)); |
Line 245 sub displayfoils {
|
Line 246 sub displayfoils {
|
foreach my $name (@whichfoils) { |
foreach my $name (@whichfoils) { |
if ($target ne 'tex') { |
if ($target ne 'tex') { |
$result.="<br />"; |
$result.="<br />"; |
|
} else { |
|
$result.='\vskip 0 mm '; |
} |
} |
if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { |
if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { |
$result.='Correct'; |
$result.='Correct'; |
Line 265 sub displayfoils {
|
Line 268 sub displayfoils {
|
if (defined($lastresponse{$name})) { $result .= 'checked="on"'; } |
if (defined($lastresponse{$name})) { $result .= 'checked="on"'; } |
$result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n"; |
$result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n"; |
} else { |
} else { |
$result .= $Apache::response::foilgroup{$name.'.text'}; |
$result .= '\item '.$Apache::response::foilgroup{$name.'.text'}; |
} |
} |
$temp++; |
$temp++; |
} |
} |
} |
} |
if ($target ne 'tex') { $result.="<br />"; } |
if ($target ne 'tex') { $result.="<br />"; } else { $result.='\vskip 0 mm '; } |
return $result; |
return $result; |
} |
} |
|
|
Line 289 sub displayanswers {
|
Line 292 sub displayanswers {
|
sub start_conceptgroup { |
sub start_conceptgroup { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
$Apache::radiobuttonresponse::conceptgroup=1; |
$Apache::radiobuttonresponse::conceptgroup=1; |
%Apache::response::conceptgroup={}; |
%Apache::response::conceptgroup=(); |
my $result; |
my $result; |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::tag_start($target,$token); |
Line 335 sub start_foil {
|
Line 338 sub start_foil {
|
my $result=''; |
my $result=''; |
if ($target eq 'web' || $target eq 'tex') { |
if ($target eq 'web' || $target eq 'tex') { |
&Apache::lonxml::startredirection; |
&Apache::lonxml::startredirection; |
if ($target eq 'tex') { |
|
$result .= '\item '; |
|
} |
|
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result=&Apache::edit::tag_start($target,$token); |
$result=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::text_arg('Name:','name',$token); |
$result.=&Apache::edit::text_arg('Name:','name',$token); |
$result.=&Apache::edit::select_arg('Correct Option:','value', |
$result.=&Apache::edit::select_or_text_arg('Correct Option:','value', |
['unused','true','false'],$token); |
['unused','true','false'],$token); |
$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |