Diff for /loncom/homework/optionresponse.pm between versions 1.200 and 1.204

version 1.200, 2015/04/28 13:12:52 version 1.204, 2025/02/21 20:55:17
Line 106  sub start_foilgroup { Line 106  sub start_foilgroup {
   $Apache::optionresponse::conceptgroup=0;    $Apache::optionresponse::conceptgroup=0;
   &Apache::response::pushrandomnumber(undef,$target);    &Apache::response::pushrandomnumber(undef,$target);
   if ($target eq 'edit') {    if ($target eq 'edit') {
     my $optionlist="<option></option>\n";      my $optionlist="<option value=\"\"></option>\n";
     my $option;      my $option;
     my @opt;      my @opt;
     my @raw_options = &Apache::lonxml::get_param('options', $parstack, $safeeval, 0,  0, 1);      my @raw_options = &Apache::lonxml::get_param('options', $parstack, $safeeval, 0,  0, 1);
Line 736  sub displayfoils { Line 736  sub displayfoils {
                  &mt('Select all that are [_1].','<b>'.$checkboxopt.'</b>');                   &mt('Select all that are [_1].','<b>'.$checkboxopt.'</b>');
     }      }
     foreach $name (@whichopt) {      foreach $name (@whichopt) {
         if ($target eq 'web') {
             $result.= '<div class="LC_optionfoil">';
         }
       my $text=$Apache::response::foilgroup{$name.'.text'};        my $text=$Apache::response::foilgroup{$name.'.text'};
       if ($text!~/^\s*$/) {        if ($text!~/^\s*$/) {
   if ($target eq 'tex') {    if ($target eq 'tex') {
       $break='\vskip 0 mm ';        $break='\vskip 0 mm ';
   } elsif ($target eq 'web') {  
       $break='<br />';  
   }    }
       }        }
       my $lastopt=$lastresponse{$name};        my $lastopt=$lastresponse{$name};
       my $optionlist="<option></option>\n";        my $optionlist="<option value=\"\"></option>\n";
   
       if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes'        if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes'
          && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {           && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
Line 793  sub displayfoils { Line 794  sub displayfoils {
 # lastopt is what the user submitted before  # lastopt is what the user submitted before
 # defopt is what the field is going to start out with: either previous choice or altopt  # defopt is what the field is going to start out with: either previous choice or altopt
 # fieldname is this input field's name after HWVAL_  # fieldname is this input field's name after HWVAL_
                   $optionlist='<input type="hidden" name="HWVAL_'.$fieldname.'" value="'.$escdefopt.'" />'.                    $optionlist='<input type="hidden" name="HWVAL_'.$fieldname.'" value="'.$escdefopt.'" /><label>'.
                   '<input type="checkbox" name="HWCHK_'.$fieldname.'" onclick="javascript:if (this.form.elements[\'HWCHK_'.                    '<input type="checkbox" name="HWCHK_'.$fieldname.'" onclick="javascript:if (this.form.elements[\'HWCHK_'.
                   $fieldname.'\'].checked) { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$esccheckboxopt.'\'; } else { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$escaltopt.'\'; };setSubmittedPart(\''.$part.'\');"'.($defopt eq $checkboxopt?' checked="checked"':'')." />\n";                    $fieldname.'\'].checked) { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$esccheckboxopt.'\'; } else { this.form.elements[\'HWVAL_'.$fieldname.'\'].value=\''.$escaltopt.'\'; };javascript:setSubmittedPart(\''.$part.'\');"'.($defopt eq $checkboxopt?' checked="checked"':'')." />\n";
               } else {                } else {
 # classic selection list  # classic selection list
           $optionlist='<select onchange="javascript:setSubmittedPart(\''.            $optionlist='<label><select onchange="javascript:setSubmittedPart(\''.
   $part.'\');" name="HWVAL_'.    $part.'\');" name="HWVAL_'.
   $Apache::inputtags::response['-1'].':'.$temp.'">'.    $Apache::inputtags::response['-1'].':'.$temp.'">'.
   $optionlist."</select>\n";    $optionlist."</select>\n";
Line 820  sub displayfoils { Line 821  sub displayfoils {
   $result.=$break.$text."\n";    $result.=$break.$text."\n";
   if ($Apache::lonhomework::type eq 'exam') {    if ($Apache::lonhomework::type eq 'exam') {
       $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);        $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
     } else {
         $result.= '</label>';
   }    }
   $temp++;    $temp++;
       } else {        } else {
Line 879  sub displayfoils { Line 882  sub displayfoils {
           }            }
   $displayoptionintex=0;    $displayoptionintex=0;
       }        }
         if ($target eq 'web') {
             $result.= '</div>';
         }
     }      }
   }    }
   
Line 929  sub webbubbles { Line 935  sub webbubbles {
     my @alphabet=@$ralphabet;      my @alphabet=@$ralphabet;
     my $result='';      my $result='';
     my $number_of_bubbles = $#opt + 1;      my $number_of_bubbles = $#opt + 1;
     $result.= '<table border="1"><tr>';      $result.= '<fieldset class="LC_webbubbles">'.
                 '<legend class="LC_visually_hidden">'.&mt('Choose one').'</legend>'.
                 '<ul class="LC_webbubbles">';
     for (my $ind=0;$ind<$number_of_bubbles;$ind++) {      for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
  my $checked='';   my $checked='';
  if ($lastopt eq $opt[$ind]) {   if ($lastopt eq $opt[$ind]) {
     $checked=' checked="on" ';      $checked=' checked="on" ';
  }   }
  $result.='<td><input type="radio" name="HWVAL_'.   $result.='<li><label><input type="radio" name="HWVAL_'.
     $Apache::inputtags::response['-1'].':'.$temp.      $Apache::inputtags::response['-1'].':'.$temp.
     '" value="'.$opt[$ind].'" '.$checked.' />';      '" value="'.$opt[$ind].'" '.$checked.' />';
  if ($alphabet[$ind]) {   if ($alphabet[$ind]) {
     $result.=$alphabet[$ind].': ';      $result.=$alphabet[$ind].': ';
  }   }
  $result.=$opt[$ind].'</td>';   $result.=$opt[$ind].'</label></li>';
     }      }
     $result.='</tr></table>';      $result.='</ul></fieldset>';
     return $result;      return $result;
 }  }
   

Removed from v.1.200  
changed lines
  Added in v.1.204


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