Diff for /loncom/homework/inputtags.pm between versions 1.91 and 1.97

version 1.91, 2003/04/08 15:18:45 version 1.97, 2003/04/30 13:44:30
Line 124  sub start_textfield { Line 124  sub start_textfield {
     }      }
     $result.=&Apache::edit::modifiedfield();      $result.=&Apache::edit::modifiedfield();
   } elsif ($target eq 'tex') {    } elsif ($target eq 'tex') {
         my $number_of_lines = &Apache::lonxml::get_param('rows',$parstack,$safeeval);
         my $width_of_box = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
       if ($$tagstack[-2] eq 'essayresponse' and $Apache::lonhomework::type eq 'exam') {        if ($$tagstack[-2] eq 'essayresponse' and $Apache::lonhomework::type eq 'exam') {
   my $number_of_lines= &Apache::lonxml::get_param('rows',$parstack,$safeeval);  
   $result = '\fbox{\fbox{\parbox{\textwidth-5mm}{';    $result = '\fbox{\fbox{\parbox{\textwidth-5mm}{';
  for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}    for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
  $result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';    $result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';
         } else {
     my $TeXwidth=$width_of_box/80;
     $result = '\vskip 1 mm \fbox{\fbox{\parbox{'.$TeXwidth.'\textwidth-5mm}{';
     for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
     $result.='}}}\vskip 2 mm ';
       }        }
   }    }
   return $result;    return $result;
Line 252  sub finalizeawards { Line 258  sub finalizeawards {
     foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} }      foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} }
   }    }
   if ($result eq '' ) {    if ($result eq '' ) {
       foreach $award (@_) { if ($award eq 'ASSIGNED_SCORE') {$result=$award; last;} }
     }
     if ($result eq '' ) {
     foreach $award (@_) { if ($award eq 'APPROX_ANS') {$result=$award; last;} }      foreach $award (@_) { if ($award eq 'APPROX_ANS') {$result=$award; last;} }
   }    }
   if ($result eq '' ) { $result='EXACT_ANS'; }    if ($result eq '' ) { $result='EXACT_ANS'; }
Line 267  sub decideoutput { Line 276  sub decideoutput {
   if ($previous) { $previousmsg='You have entered that answer before'; }    if ($previous) { $previousmsg='You have entered that answer before'; }
   
   if      ($solved =~ /^correct/) {    if      ($solved =~ /^correct/) {
       if ($target eq 'tex') {        if ($award eq 'ASSIGNED_SCORE') {
   $message = '\textbf{You are correct}. Your receipt is '.    $message = "A score has been assigned.";
            &Apache::lonnet::receipt;  
       } else {        } else {
   $message = "<b>You are correct.</b> Your receipt is ".    if ($target eq 'tex') {
    &Apache::lonnet::receipt;        $message = '\textbf{You are correct}.';
     } else {
         $message = "<b>You are correct.</b>";
     }
     $message=' Your receipt is '.&Apache::lonnet::receipt;
       }        }
       $button=0;        $button=0;
       $previousmsg='';        $previousmsg='';
Line 332  sub decideoutput { Line 344  sub decideoutput {
   } elsif ($award eq 'DRAFT') {    } elsif ($award eq 'DRAFT') {
       $message = "A draft copy has been saved.";        $message = "A draft copy has been saved.";
       $button=1;        $button=1;
     } elsif ($award eq 'ASSIGNED_SCORE') {
         $message = "A score has been assigned.";
         $button=0;
   } else {    } else {
       $message = "Unknown message: $award";        $message = "Unknown message: $award";
       $button=1;        $button=1;
Line 361  sub setgradedata { Line 376  sub setgradedata {
     $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;      $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award;
     return '';      return '';
   } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~    } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~
        /^correct/ ) {         /^correct/ || $Apache::lonhomework::scantronmode) {
     #handle assignment of tries and solved status      #handle assignment of tries and solved status
       my $solvemsg;
       if ($Apache::lonhomework::scantronmode) {
    $solvemsg='correct_by_scantron';
       } else {
    $solvemsg='correct_by_student';
       }
     if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {      if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) {
       $Apache::lonhomework::results{"resource.$id.afterduedate"}='';        $Apache::lonhomework::results{"resource.$id.afterduedate"}='';
     }      }
     if ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {      if ( $award eq 'ASSIGNED_SCORE') {
    $Apache::lonhomework::results{"resource.$id.tries"} =
       $Apache::lonhomework::history{"resource.$id.tries"} + 1;
    $Apache::lonhomework::results{"resource.$id.solved"} =
       $solvemsg;
    my $numawards=scalar(@Apache::inputtags::responselist);
    &Apache::lonxml::debug("Whaaa!");
    $Apache::lonhomework::results{"resource.$id.awarded"} = 0;
    foreach my $res (@Apache::inputtags::responselist) {
       $Apache::lonhomework::results{"resource.$id.awarded"}+=
          $Apache::lonhomework::results{"resource.$id.$res.awarded"};
    }
    if ($numawards > 0) {
       $Apache::lonhomework::results{"resource.$id.awarded"}/=
    $numawards;
    }
       } elsif ( $award eq 'APPROX_ANS' || $award eq 'EXACT_ANS' ) {
       $Apache::lonhomework::results{"resource.$id.tries"} =        $Apache::lonhomework::results{"resource.$id.tries"} =
  $Apache::lonhomework::history{"resource.$id.tries"} + 1;   $Apache::lonhomework::history{"resource.$id.tries"} + 1;
       $Apache::lonhomework::results{"resource.$id.solved"} =        $Apache::lonhomework::results{"resource.$id.solved"} =
  'correct_by_student';   $solvemsg;
       $Apache::lonhomework::results{"resource.$id.awarded"} = '1';        $Apache::lonhomework::results{"resource.$id.awarded"} = '1';
     } elsif ( $award eq 'INCORRECT' ) {      } elsif ( $award eq 'INCORRECT' ) {
       $Apache::lonhomework::results{"resource.$id.tries"} =        $Apache::lonhomework::results{"resource.$id.tries"} =
Line 493  sub gradestatus { Line 530  sub gradestatus {
     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; }       if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
     if ( $showbutton ) {      if ( $showbutton ) {
       if ($target eq 'tex') {        if ($target eq 'tex') {
   if ($ENV{'request.state'} ne "construct") {    if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam') {
       $trystr = ' {\small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 0 mm ';        $trystr = ' {\vskip 1 mm \small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 2 mm ';
   } else {    } else {
       $trystr = '\vskip 0 mm ';        $trystr = '\vskip 0 mm ';
   }    }

Removed from v.1.91  
changed lines
  Added in v.1.97


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