Diff for /loncom/homework/inputtags.pm between versions 1.271.2.7 and 1.271.2.8

version 1.271.2.7, 2011/05/16 01:02:57 version 1.271.2.8, 2011/10/08 20:44:20
Line 844  sub finalizeawards { Line 844  sub finalizeawards {
 }  }
   
 sub decideoutput {  sub decideoutput {
     my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_;      my ($award,$awarded,$awardmsg,$solved,$previous,$target,$nocorrect)=@_;
   
     my $message='';      my $message='';
     my $button=0;      my $button=0;
Line 862  sub decideoutput { Line 862  sub decideoutput {
     my $part = $Apache::inputtags::part;      my $part = $Apache::inputtags::part;
     my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade");      my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade");
     my $handgrade = ('yes' eq lc($tohandgrade));       my $handgrade = ('yes' eq lc($tohandgrade)); 
        
     my $computer = ($handgrade)? ''  #
   # Should "Computer's Answer" be displayed?
   # Should not be displayed if still answerable,
   # if the problem is handgraded,
   # or if the problem does not give a correct answer
   #
       my $computer = ($handgrade || $nocorrect)? ''
                        : " ".&mt("Computer's answer now shown above.");                         : " ".&mt("Computer's answer now shown above.");
     &Apache::lonxml::debug("handgrade has :$handgrade:");      &Apache::lonxml::debug("handgrade has :$handgrade:");
   
Line 879  sub decideoutput { Line 885  sub decideoutput {
     $message=&mt('Incorrect.');      $message=&mt('Incorrect.');
     $css_class=$possible_class{'charged_try'};      $css_class=$possible_class{'charged_try'};
  }   }
  if ($env{'request.filename'} =~    if ($handgrade || 
     m|/res/lib/templates/examupload.problem$|) {              ($env{'request.filename'}=~ m{/res/lib/templates/(examupload|DropBox)\.problem$}) {
     $message = &mt("A score has been assigned.");      $message = &mt("A score has been assigned.");
     $added_computer_text=1;      $added_computer_text=1;
  } else {   } else {
Line 1404  sub grade { Line 1410  sub grade {
 }  }
   
 sub get_grade_messages {  sub get_grade_messages {
     my ($id,$prefix,$target,$status) = @_;      my ($id,$prefix,$target,$status,$nocorrect) = @_;
   # nocorrect suppresses "Computer's answer now shown above"
     my ($message,$latemessage,$trystr,$previousmsg);      my ($message,$latemessage,$trystr,$previousmsg);
     my $showbutton = 1;      my $showbutton = 1;
   
Line 1419  sub get_grade_messages { Line 1425  sub get_grade_messages {
  &Apache::lonxml::debug('Getting message');   &Apache::lonxml::debug('Getting message');
  ($showbutton,my $css_class,$message,$previousmsg) =   ($showbutton,my $css_class,$message,$previousmsg) =
     &decideoutput($award,$awarded,$awardmsg,$solved,$previous,      &decideoutput($award,$awarded,$awardmsg,$solved,$previous,
   $target);    $target,(($status eq 'CAN_ANSWER') || $nocorrect));
  if ($target eq 'tex') {   if ($target eq 'tex') {
     $message='\vskip 2 mm '.$message.' ';      $message='\vskip 2 mm '.$message.' ';
  } else {   } else {
Line 1437  sub get_grade_messages { Line 1443  sub get_grade_messages {
     if ( $tries eq '' ) { $tries = '0'; }      if ( $tries eq '' ) { $tries = '0'; }
     if ( $maxtries eq '' ) { $maxtries = '2'; }       if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; }       if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } 
     my $tries_text= &get_tries_text();;      my $tries_text= &get_tries_text();
     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'   && $Apache::lonhomework::type ne 'exam'
  && $env{'form.suppress_tries'} ne 'yes') {   && $env{'form.suppress_tries'} ne 'yes') {
  $trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '.                  $trystr ='{\vskip 1 mm \small '
     $tries.'/'.$maxtries.'} \vskip 2 mm ';                          .&mt('[_1]'.$tries_text.'[_2] [_3]'
                                   ,'\textit{','}',$tries.'/'.$maxtries )
                           .'} \vskip 2 mm';
     } else {      } else {
  $trystr = '\vskip 0 mm ';   $trystr = '\vskip 0 mm ';
     }      }
  } else {   } else {
     $trystr = '<td><span class="LC_nobreak">'.&mt($tries_text)." $tries";              my $trial = $tries;
     if ($Apache::lonhomework::parsing_a_task) {      if ($Apache::lonhomework::parsing_a_task) {
     } elsif($env{'request.state'} ne 'construct') {      } elsif($env{'request.state'} ne 'construct') {
  $trystr.="/$maxtries";   $trial.="/$maxtries";
     } else {      } else {
  if (defined($Apache::inputtags::params{'maxtries'})) {   if (defined($Apache::inputtags::params{'maxtries'})) {
     $trystr.="/".$Apache::inputtags::params{'maxtries'};      $trial.="/".$Apache::inputtags::params{'maxtries'};
  }   }
     }      }
     $trystr.="</span></td>";      $trystr.='<td><span class="LC_nobreak">'.&mt("$tries_text [_1]",$trial).'</span></td>';
  }   }
     }      }
   
Line 1580  sub previous_tries { Line 1588  sub previous_tries {
                              {$1 <strong>$txt_correct</strong>. $3}s;                               {$1 <strong>$txt_correct</strong>. $3}s;
     }      }
             my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")";              my $trystr = "(".&mt('Try [_1]',$Apache::lonhomework::history{"$prefix.tries"}).")";
             if ($curr_rndseed || $lastrndseed) {              if (($curr_rndseed || $lastrndseed) && ($i > 1)) {
                 if ($curr_rndseed ne $lastrndseed) {                  if ($curr_rndseed ne $lastrndseed) {
                     $trystr .= '<br /><span style="color: green; white-space: nowrap; font-style: italic; font-weight: bold; font-size: 80%;">'.&mt('New problem variation this try.').'</span>';                      $trystr .= '<br /><span style="color: green; white-space: nowrap; font-style: italic; font-weight: bold; font-size: 80%;">'.&mt('New problem variation this try.').'</span>';
                 }                  }

Removed from v.1.271.2.7  
changed lines
  Added in v.1.271.2.8


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