--- loncom/homework/inputtags.pm 2011/05/16 01:02:57 1.271.2.7 +++ loncom/homework/inputtags.pm 2011/10/08 20:44:20 1.271.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.271.2.7 2011/05/16 01:02:57 raeburn Exp $ +# $Id: inputtags.pm,v 1.271.2.8 2011/10/08 20:44:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -844,7 +844,7 @@ sub finalizeawards { } sub decideoutput { - my ($award,$awarded,$awardmsg,$solved,$previous,$target)=@_; + my ($award,$awarded,$awardmsg,$solved,$previous,$target,$nocorrect)=@_; my $message=''; my $button=0; @@ -862,8 +862,14 @@ sub decideoutput { my $part = $Apache::inputtags::part; my $tohandgrade = &Apache::lonnet::EXT("resource.$part.handgrade"); 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."); &Apache::lonxml::debug("handgrade has :$handgrade:"); @@ -879,8 +885,8 @@ sub decideoutput { $message=&mt('Incorrect.'); $css_class=$possible_class{'charged_try'}; } - if ($env{'request.filename'} =~ - m|/res/lib/templates/examupload.problem$|) { + if ($handgrade || + ($env{'request.filename'}=~ m{/res/lib/templates/(examupload|DropBox)\.problem$}) { $message = &mt("A score has been assigned."); $added_computer_text=1; } else { @@ -1404,8 +1410,8 @@ sub grade { } 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 $showbutton = 1; @@ -1419,7 +1425,7 @@ sub get_grade_messages { &Apache::lonxml::debug('Getting message'); ($showbutton,my $css_class,$message,$previousmsg) = &decideoutput($award,$awarded,$awardmsg,$solved,$previous, - $target); + $target,(($status eq 'CAN_ANSWER') || $nocorrect)); if ($target eq 'tex') { $message='\vskip 2 mm '.$message.' '; } else { @@ -1437,28 +1443,30 @@ sub get_grade_messages { if ( $tries eq '' ) { $tries = '0'; } if ( $maxtries eq '' ) { $maxtries = '2'; } if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } - my $tries_text= &get_tries_text();; + my $tries_text= &get_tries_text(); if ($showbutton) { if ($target eq 'tex') { if ($env{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam' && $env{'form.suppress_tries'} ne 'yes') { - $trystr = ' {\vskip 1 mm \small \textit{'.$tries_text.'} '. - $tries.'/'.$maxtries.'} \vskip 2 mm '; + $trystr ='{\vskip 1 mm \small ' + .&mt('[_1]'.$tries_text.'[_2] [_3]' + ,'\textit{','}',$tries.'/'.$maxtries ) + .'} \vskip 2 mm'; } else { $trystr = '\vskip 0 mm '; } } else { - $trystr = ''.&mt($tries_text)." $tries"; + my $trial = $tries; if ($Apache::lonhomework::parsing_a_task) { } elsif($env{'request.state'} ne 'construct') { - $trystr.="/$maxtries"; + $trial.="/$maxtries"; } else { if (defined($Apache::inputtags::params{'maxtries'})) { - $trystr.="/".$Apache::inputtags::params{'maxtries'}; + $trial.="/".$Apache::inputtags::params{'maxtries'}; } } - $trystr.=""; + $trystr.=''.&mt("$tries_text [_1]",$trial).''; } } @@ -1580,7 +1588,7 @@ sub previous_tries { {$1 $txt_correct. $3}s; } 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) { $trystr .= '
'.&mt('New problem variation this try.').''; }