Diff for /loncom/homework/inputtags.pm between versions 1.325 and 1.326

version 1.325, 2014/09/14 15:21:43 version 1.326, 2014/09/15 17:45:35
Line 235  sub start_textfield { Line 235  sub start_textfield {
     my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);      my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
     $result='';      $result='';
     my $tagident = 'HWVAL_' . $resid;      my $tagident = 'HWVAL_' . $resid;
               my $itemid = 'HWVAL_'.$partid.'_'.$resid;
     if ($addchars) {      if ($addchars) {
  $result.=&addchars($tagident, $addchars);   $result.=&addchars($tagident, $addchars);
     }      }
Line 243  sub start_textfield { Line 244  sub start_textfield {
                                                     'externalresponse')) {                                                      'externalresponse')) {
                 $textareaclass = 'class="LC_richDetectHtml spellchecked"';                  $textareaclass = 'class="LC_richDetectHtml spellchecked"';
             }              }
     $result.= '<textarea wrap="hard" name="'.$tagident.'" id="'.$tagident.'" ' .      $result.= '<textarea wrap="hard" name="'.$tagident.'" id="'.$itemid.'" ' .
       'rows="'.$rows.'" cols="'.$cols.'" '.$textareaclass        'rows="'.$rows.'" cols="'.$cols.'" '.$textareaclass
       .'>'.        .'>'.
                       &HTML::Entities::encode($oldresponse,'<>&"');                        &HTML::Entities::encode($oldresponse,'<>&"');
Line 325  sub end_textfield { Line 326  sub end_textfield {
  my $spellcheck = &Apache::lonxml::get_param('spellcheck', $parstack, $safeeval);   my $spellcheck = &Apache::lonxml::get_param('spellcheck', $parstack, $safeeval);
  $Apache::lonxml::evaluate++;   $Apache::lonxml::evaluate++;
  if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {   if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
               my $partid=$Apache::inputtags::part;
     my $resid = $Apache::inputtags::response[-1];      my $resid = $Apache::inputtags::response[-1];
     my $tagident = 'HWVAL_' . $resid;      my $itemid = 'HWVAL_' . $partid . '_' . $resid;
     my $result =  "</textarea>";      my $result =  "</textarea>";
     $result .= &spellcheck_onblur($tagident, $spellcheck);      $result .= &spellcheck_onblur($itemid, $spellcheck);
     return $result;      return $result;
  }   }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
Line 457  sub start_textline { Line 459  sub start_textline {
     $readonly='';      $readonly='';
  }   }
  my $name = 'HWVAL_'.$id;   my $name = 'HWVAL_'.$id;
                   my $itemid = 'HWVAL_'.$partid.'_'.$id;
  if ($Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') {   if ($Apache::inputtags::status[-1] eq 'CANNOT_ANSWER') {
     $name = "none";      $name = "none";
  }   }
  $result.= '<input onkeydown="javascript:setSubmittedPart(\''.$partid.'\');"'   $result.= '<input onkeydown="javascript:setSubmittedPart(\''.$partid.'\');"'
      . ' type="text" '       . ' type="text" '
      . $readonly.' name="'. $name . '"'       . $readonly.' name="'. $name . '"'
      . ' id="' . $name . '"'       . ' id="' . $itemid . '"'
      . ' value="'.  $oldresponse.'"'       . ' value="'.  $oldresponse.'"'
      . ' class="spellchecked"  size="'.$size.'"'.$maxlength       . ' class="LC_textline spellchecked"  size="'.$size.'"'.$maxlength
      . '/>';       . '/>';
   
  $result .= &spellcheck_onblur($name, $spellcheck);   $result .= &spellcheck_onblur($itemid, $spellcheck);
     }      }
     if ($Apache::lonhomework::type eq 'exam'      if ($Apache::lonhomework::type eq 'exam'
  && &needs_exam_box($tagstack)) {   && &needs_exam_box($tagstack)) {

Removed from v.1.325  
changed lines
  Added in v.1.326


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