Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.82 and 1.84

version 1.82, 2003/03/13 16:20:47 version 1.84, 2003/03/21 15:33:46
Line 215  sub end_numericalresponse { Line 215  sub end_numericalresponse {
       my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);        my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
  my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);   my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
  my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);   my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval);
  if (defined $unit and $Apache::lonhomework::type eq 'exam') {  
   $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} ';  
         }  
  my $number_of_bubbles = 8; #default values for number of bubbles   my $number_of_bubbles = 8; #default values for number of bubbles
  my @bubbles_values = ();    my @bubbles_values = (); 
  my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors   my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors
Line 235  sub end_numericalresponse { Line 232  sub end_numericalresponse {
  for ($ind=0;$ind<$number_of_bubbles;$ind++) {   for ($ind=0;$ind<$number_of_bubbles;$ind++) {
     $bubbles_values[$ind] = $answers[0]*($factor**($power-$powers[$#powers-$ind]));      $bubbles_values[$ind] = $answers[0]*($factor**($power-$powers[$#powers-$ind]));
  }   }
  my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',   my @alphabet=('A'..'Z');
  'Q','R','S','T','U','V','W','X','Y','Z');  
         if ($target eq 'web') {          if ($target eq 'web') {
   if ($$tagstack[-1] eq 'numericalresponse') {    if ($$tagstack[-1] eq 'numericalresponse') {
     my $id=$Apache::inputtags::response[-1];      my $id=$Apache::inputtags::response[-1];
       $result.=' (<i>in '.$unit.'</i>)<br /><br />';
     $result.= '<table border="1"><tr>';      $result.= '<table border="1"><tr>';
     for ($ind=0;$ind<$number_of_bubbles;$ind++) {      for ($ind=0;$ind<$number_of_bubbles;$ind++) {
  my $ans;   my $ans;
Line 265  sub end_numericalresponse { Line 262  sub end_numericalresponse {
     $result.= '<br /><br /><font color="red"> Formula have to be entered here! </font><br /><br />';      $result.= '<br /><br /><font color="red"> Formula have to be entered here! </font><br /><br />';
   }    }
  } elsif ($target eq 'tex') {   } elsif ($target eq 'tex') {
    if (defined $unit and $Apache::lonhomework::type eq 'exam') {
      $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} ';
            }
  if ($$tagstack[-1] eq 'numericalresponse') {   if ($$tagstack[-1] eq 'numericalresponse') {
      my $max_val = 0;       my $max_val = 0;
      if ($formats[0]=~m/^(\d+)E([^\d]*)(\d*)$/) {       if ($formats[0]=~m/^(\d+)E([^\d]*)(\d*)$/) {

Removed from v.1.82  
changed lines
  Added in v.1.84


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