--- loncom/homework/inputtags.pm 2002/10/23 17:05:25 1.66 +++ loncom/homework/inputtags.pm 2002/11/06 22:40:29 1.72 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.66 2002/10/23 17:05:25 sakharuk Exp $ +# $Id: inputtags.pm,v 1.72 2002/11/06 22:40:29 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -146,12 +146,15 @@ sub start_textline { $Apache::lonxml::evaluate--; if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); - if ($size eq '') { $size=20; } + my $maxlength; + if ($size eq '') { $size=20; } else { + if ($size < 20) { $maxlength=$size; } + } my $partid=$Apache::inputtags::part; my $id=$Apache::inputtags::response[-1]; my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"}); $result= ''; + $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />'; } else { #right or wrong don't show what was last typed in. #$result=''.$oldresponse.''; @@ -234,7 +237,7 @@ sub finalizeawards { } sub decideoutput { - my ($award,$solved,$previous)=@_; + my ($award,$solved,$previous,$target)=@_; my $message=''; my $button=0; my $previousmsg; @@ -242,8 +245,13 @@ sub decideoutput { if ($previous) { $previousmsg='You have entered that answer before'; } if ($solved =~ /^correct/) { - $message = "You are correct. Your receipt is ". + if ($target eq 'tex') { + $message = '\textbf{You are correct}. Your receipt is '. &Apache::lonnet::receipt; + } else { + $message = "You are correct. Your receipt is ". + &Apache::lonnet::receipt; + } $button=0; $previousmsg=''; } elsif ($solved =~ /^excused/) { @@ -303,7 +311,8 @@ sub decideoutput { sub setgradedata { my ($award,$id,$previously_used) = @_; # if the student already has it correct, don't modify the status - if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER') { + if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' && + $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER') { $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award; return ''; } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~ @@ -408,7 +417,7 @@ sub gradestatus { if ( $award ne '' ) { &Apache::lonxml::debug('Getting message'); ($showbutton,$message,$previousmsg) = - &decideoutput($award,$solved,$previous); + &decideoutput($award,$solved,$previous,$target); if ($target eq 'tex') { $message=' '.$message.' '; } else { @@ -426,7 +435,9 @@ sub gradestatus { if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } if ( $showbutton ) { if ($target eq 'tex') { - $trystr = ' {\small Tries '.$tries.'/'.$maxtries.'} '; + if ($ENV{'request.state'} ne "construct") { + $trystr = ' {\small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 0 mm '; + } } else { $trystr = "Tries $tries/$maxtries"; }