Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.92 and 1.94

version 1.92, 2003/04/08 04:17:13 version 1.94, 2003/04/21 17:51:46
Line 147  sub end_numericalresponse { Line 147  sub end_numericalresponse {
      $safeeval);       $safeeval);
  my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};   my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
  my $status = $Apache::inputtags::status['-1'];   my $status = $Apache::inputtags::status['-1'];
  if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" ) {   if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
     my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,      my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
  $safeeval);   $safeeval);
     my $unit=&Apache::lonxml::get_param_var('unit',$parstack,      my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
Line 155  sub end_numericalresponse { Line 155  sub end_numericalresponse {
     if ($target eq 'web') {      if ($target eq 'web') {
  $result="<br />The correct answer is ";   $result="<br />The correct answer is ";
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  #$result='\vskip 0 mm The correct answer is \\texttt{';   if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
       $result='\vskip 0 mm The correct answer is \\texttt{ ';
    }
     }      }
     for (my $i=0; $i <= $#answers; $i++) {      for (my $i=0; $i <= $#answers; $i++) {
  my $answer=$answers[$i];   my $answer=$answers[$i];
Line 173  sub end_numericalresponse { Line 175  sub end_numericalresponse {
     &Apache::lonxml::debug("no format answer :$answer:");      &Apache::lonxml::debug("no format answer :$answer:");
     $formatted="$answer,";      $formatted="$answer,";
  }   }
    if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
       $result.=$formatted;
    }
  if ($target eq 'tex') {   if ($target eq 'tex') {
     $formatted='';      $formatted='';
     #$formatted=&Apache::lonxml::latex_special_symbols($formatted);      #$formatted=&Apache::lonxml::latex_special_symbols($formatted);
Line 183  sub end_numericalresponse { Line 187  sub end_numericalresponse {
     chop $result;      chop $result;
     if ($target eq 'web') {      if ($target eq 'web') {
  $result.=" $unit.<br />";   $result.=" $unit.<br />";
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  #$result.=&Apache::lonxml::latex_special_symbols($unit);   if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
  #$result.="}. \\vskip 0 mm ";      $result.=&Apache::lonxml::latex_special_symbols($unit);
       $result.="}. \\vskip 0 mm ";
    }
     }      }
  }   }
  if ($Apache::lonhomework::type eq 'exam') {   if ($Apache::lonhomework::type eq 'exam') {
Line 242  sub end_numericalresponse { Line 248  sub end_numericalresponse {
     $result.='\end{enumerate}';      $result.='\end{enumerate}';
  } else {   } else {
     $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';      $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}';
     my $id = $Apache::inputtags::part;      my $repetition = &Apache::response::repetition();
     my $weight = &Apache::lonnet::EXT("resource.$id.weight");  
     my $repetition = int $weight/9;  
     if ($weight % 9 != 0) {$repetition++;}  
     $result.='\begin{enumerate}';      $result.='\begin{enumerate}';
     for (my $i=0;$i<$repetition;$i++) {      for (my $i=0;$i<$repetition;$i++) {
  $result.='\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm';   $result.='\item[\textbf{'.($Apache::lonxml::counter+$i).'}.]\textit{Leave blank on scoring form}\vskip 0 mm';
     }      }
     $increment=$repetition;      $increment=$repetition;
     $result.= '\end{enumerate}';      $result.= '\end{enumerate}';

Removed from v.1.92  
changed lines
  Added in v.1.94


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