Diff for /loncom/homework/optionresponse.pm between versions 1.171 and 1.172

version 1.171, 2010/09/01 21:29:51 version 1.172, 2010/09/05 20:46:58
Line 137  ENDTABLE Line 137  ENDTABLE
        }         }
        $result.='>'.$option.'</option>';         $result.='>'.$option.'</option>';
     }      }
     $result.='</select></label>';        $result.='</select></label>';
       $result.=&Apache::edit::checked_arg('Checkbox options:','checkboxoptions',
                                            [ ['nochoice','Don\'t show option list'] ]
                                            ,$token).'</td>';
     $result.= &Apache::edit::end_row();      $result.= &Apache::edit::end_row();
     $result.= &Apache::edit::start_spanning_row();      $result.= &Apache::edit::start_spanning_row();
     $result.= $insertlist.'<br />';      $result.= $insertlist.'<br />';
Line 162  ENDTABLE Line 165  ENDTABLE
       $optchanged=1;        $optchanged=1;
     }      }
     my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,      my $rebuildtag = &Apache::edit::get_new_args($token,$parstack,$safeeval,
  'texoptions','checkboxvalue');   'texoptions','checkboxvalue','checkboxoptions');
     if ($optchanged || $rebuildtag ) {      if ($optchanged || $rebuildtag ) {
       $result = "<foilgroup options=\"(";        $result = "<foilgroup options=\"(";
       foreach my $option (@options) {        foreach my $option (@options) {
Line 173  ENDTABLE Line 176  ENDTABLE
       chop $result;        chop $result;
       $result.=')" ';        $result.=')" ';
       $result .= 'texoptions="'.$token->[2]{'texoptions'}.'" ';        $result .= 'texoptions="'.$token->[2]{'texoptions'}.'" ';
         $result .= 'checkboxoptions="'.$token->[2]{'checkboxoptions'}.'" ';
       $result .= 'checkboxvalue="'.$token->[2]{'checkboxvalue'}.'"';        $result .= 'checkboxvalue="'.$token->[2]{'checkboxvalue'}.'"';
       $result .= '>';        $result .= '>';
     } # else nothing changed so just use the default mechanism      } # else nothing changed so just use the default mechanism
Line 202  sub end_foilgroup { Line 206  sub end_foilgroup {
     my $TeXlayout=&Apache::lonxml::get_param('TeXlayout',$parstack,$safeeval,      my $TeXlayout=&Apache::lonxml::get_param('TeXlayout',$parstack,$safeeval,
      -2,0);       -2,0);
     my $checkboxvalue=&Apache::lonxml::get_param('checkboxvalue',$parstack,$safeeval);      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=();}      if ($target eq 'tex' && $tex_option_switch eq 'nochoice') {@opt=();}
     &Apache::lonxml::debug("Options are $#opt");      &Apache::lonxml::debug("Options are $#opt");
     my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');      my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
     my $randomize = &Apache::lonxml::get_param('randomize',$parstack,      my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
        $safeeval,'-2');         $safeeval,'-2');
     if ($target eq 'web' || $target eq 'tex') {      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;        $Apache::lonxml::post_evaluate=0;
     } elsif ( $target eq 'answer') {      } elsif ( $target eq 'answer') {
       $result.=&displayanswers($max,$randomize,@opt);        $result.=&displayanswers($max,$randomize,@opt);
Line 414  sub check_for_invalid { Line 419  sub check_for_invalid {
 }  }
   
 sub displayfoils {  sub displayfoils {
   my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,@opt)=@_;    my ($target,$max,$randomize,$TeXlayout,$checkboxvalue,$checkboxchoices,@opt)=@_;
   if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}    if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names = @{ $Apache::response::foilgroup{'names'} };
   my @truelist;    my @truelist;
Line 468  sub displayfoils { Line 473  sub displayfoils {
     my $internal_counter=$Apache::lonxml::counter;      my $internal_counter=$Apache::lonxml::counter;
     my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);      my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);
     if ($checkboxopt) {      if ($checkboxopt) {
        $result.='<br />'.&mt('Choices: ').'<b>'.$opt[0].','.$opt[1].'</b>. '.         $result.='<br />'.
                   ($checkboxchoices?&mt('Choices: ').'<b>'.$opt[0].','.$opt[1].'</b>. ':'').
                  &mt('Select all that are <b>[_1]</b>.',$checkboxopt);                   &mt('Select all that are <b>[_1]</b>.',$checkboxopt);
     }      }
     foreach $name (@whichopt) {      foreach $name (@whichopt) {

Removed from v.1.171  
changed lines
  Added in v.1.172


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>