--- loncom/homework/inputtags.pm 2003/04/21 20:59:02 1.93 +++ loncom/homework/inputtags.pm 2003/05/09 22:24:05 1.101 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.93 2003/04/21 20:59:02 albertel Exp $ +# $Id: inputtags.pm,v 1.101 2003/05/09 22:24:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,7 +33,7 @@ use strict; use Apache::loncommon; BEGIN { - &Apache::lonxml::register('Apache::inputtags',('textfield','textline')); + &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); } @@ -124,11 +124,17 @@ sub start_textfield { } $result.=&Apache::edit::modifiedfield(); } 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') { - my $number_of_lines= &Apache::lonxml::get_param('rows',$parstack,$safeeval); $result = '\fbox{\fbox{\parbox{\textwidth-5mm}{'; - for (my $i=0;$i'; + } + } + } elsif ($target eq 'edit') { + $result=&Apache::edit::tag_start($target,$token); + $result.=&Apache::edit::end_table; + } + return $result; +} + +sub end_hiddenline { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + if ($target eq 'web') { $Apache::lonxml::evaluate++; } + elsif ($target eq 'edit') { return ('','no'); } + return ""; +} + sub finalizeawards { my $result=''; my $award; @@ -344,8 +378,8 @@ sub decideoutput { } else { $message = "Unknown message: $award"; $button=1; - } - if (lc($Apache::lonhomework::problemstatus) ne 'yes') { + } + if (lc($Apache::lonhomework::problemstatus) eq 'no') { $message = "Answer Submitted"; $button=1; } @@ -370,7 +404,8 @@ sub setgradedata { $Apache::lonhomework::results{"resource.$id.afterduedate"}=$award; return ''; } elsif ( $Apache::lonhomework::history{"resource.$id.solved"} !~ - /^correct/ || $Apache::lonhomework::scantronmode) { + /^correct/ || $Apache::lonhomework::scantronmode || + lc($Apache::lonhomework::problemstatus) eq 'no') { #handle assignment of tries and solved status my $solvemsg; if ($Apache::lonhomework::scantronmode) { @@ -422,13 +457,19 @@ sub setgradedata { } else { $Apache::lonhomework::results{"resource.$id.solved"} = 'incorrect_attempted'; + if (lc($Apache::lonhomework::problemstatus) eq 'no') { + $Apache::lonhomework::results{"resource.$id.tries"} = + $Apache::lonhomework::history{"resource.$id.tries"} + 1; + } } # check if this was a previous submission if it was delete the # unneeded data and update the previously_used attribute if ( $previously_used eq 'PREVIOUSLY_USED') { - delete($Apache::lonhomework::results{"resource.$id.tries"}); - $Apache::lonhomework::results{"resource.$id.previous"} = '1'; + if (lc($Apache::lonhomework::problemstatus) ne 'no') { + delete($Apache::lonhomework::results{"resource.$id.tries"}); + $Apache::lonhomework::results{"resource.$id.previous"} = '1'; + } } elsif ( $previously_used eq 'PREVIOUSLY_LAST') { #delete all data as they student didn't do anything, but save #the list of collaborators. @@ -524,8 +565,8 @@ sub gradestatus { if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } if ( $showbutton ) { if ($target eq 'tex') { - if ($ENV{'request.state'} ne "construct") { - $trystr = ' {\small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 0 mm '; + if ($ENV{'request.state'} ne "construct" && $Apache::lonhomework::type ne 'exam') { + $trystr = ' {\vskip 1 mm \small \textit{Tries} '.$tries.'/'.$maxtries.'} \vskip 2 mm '; } else { $trystr = '\vskip 0 mm '; }