--- loncom/homework/optionresponse.pm 2010/09/01 21:29:51 1.171
+++ loncom/homework/optionresponse.pm 2010/09/05 20:46:58 1.172
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.171 2010/09/01 21:29:51 raeburn Exp $
+# $Id: optionresponse.pm,v 1.172 2010/09/05 20:46:58 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,7 +137,10 @@ ENDTABLE
}
$result.='>'.$option.'';
}
- $result.='';
+ $result.='';
+ $result.=&Apache::edit::checked_arg('Checkbox options:','checkboxoptions',
+ [ ['nochoice','Don\'t show option list'] ]
+ ,$token).'';
$result.= &Apache::edit::end_row();
$result.= &Apache::edit::start_spanning_row();
$result.= $insertlist.'
';
@@ -162,7 +165,7 @@ ENDTABLE
$optchanged=1;
}
my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,
- 'texoptions','checkboxvalue');
+ 'texoptions','checkboxvalue','checkboxoptions');
if ($optchanged || $rebuildtag ) {
$result = "[2]{'texoptions'}.'" ';
+ $result .= 'checkboxoptions="'.$token->[2]{'checkboxoptions'}.'" ';
$result .= 'checkboxvalue="'.$token->[2]{'checkboxvalue'}.'"';
$result .= '>';
} # else nothing changed so just use the default mechanism
@@ -202,13 +206,14 @@ sub end_foilgroup {
my $TeXlayout=&Apache::lonxml::get_param('TeXlayout',$parstack,$safeeval,
-2,0);
my $checkboxvalue=&Apache::lonxml::get_param('checkboxvalue',$parstack,$safeeval);
+ my $checkboxchoices=(&Apache::lonxml::get_param('checkboxoptions',$parstack,$safeeval) ne 'nochoice');
if ($target eq 'tex' && $tex_option_switch eq 'nochoice') {@opt=();}
&Apache::lonxml::debug("Options are $#opt");
my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
$safeeval,'-2');
if ($target eq 'web' || $target eq 'tex') {
- $result.=&displayfoils($target,$max,$randomize,$TeXlayout,$checkboxvalue,@opt);
+ $result.=&displayfoils($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,@opt);
$Apache::lonxml::post_evaluate=0;
} elsif ( $target eq 'answer') {
$result.=&displayanswers($max,$randomize,@opt);
@@ -414,7 +419,7 @@ sub check_for_invalid {
}
sub displayfoils {
- my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,@opt)=@_;
+ my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,@opt)=@_;
if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
my @names = @{ $Apache::response::foilgroup{'names'} };
my @truelist;
@@ -468,7 +473,8 @@ sub displayfoils {
my $internal_counter=$Apache::lonxml::counter;
my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);
if ($checkboxopt) {
- $result.='
'.&mt('Choices: ').''.$opt[0].','.$opt[1].'. '.
+ $result.='
'.
+ ($checkboxchoices?&mt('Choices: ').''.$opt[0].','.$opt[1].'. ':'').
&mt('Select all that are [_1].',$checkboxopt);
}
foreach $name (@whichopt) {