--- loncom/homework/inputtags.pm 2002/07/25 20:55:13 1.58 +++ loncom/homework/inputtags.pm 2002/08/07 16:23:05 1.60 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.58 2002/07/25 20:55:13 ng Exp $ +# $Id: inputtags.pm,v 1.60 2002/08/07 16:23:05 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -95,27 +95,44 @@ sub start_textfield { #get rid of any startup text if the user has already responded &Apache::lonxml::get_all_text("/textfield",$$parser[-1]); } - } - if ($target eq 'grade') { + } elsif ($target eq 'grade') { my $seedtext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]); if ($seedtext eq $ENV{'form.HWVAL'.$resid}) { # if the seed text is still there it wasn't a real submission $ENV{'form.HWVAL'.$resid}=''; } + } elsif ($target eq 'edit') { + $result.=&Apache::edit::tag_start($target,$token); + $result.=&Apache::edit::text_arg('Rows:','rows',$token,4); + $result.=&Apache::edit::text_arg('Columns:','cols',$token,4); + my $bodytext=&Apache::lonxml::get_all_text("/textfield",$$parser[-1]); + $result.=&Apache::edit::editfield($token->[1],$bodytext,'Text you want to appear by default:',50,2); + } elsif ($target eq 'modified') { + my $constructtag=&Apache::edit::get_new_args($token,$parstack, + $safeeval,'rows','cols'); + if ($constructtag) { + $result = &Apache::edit::rebuild_tag($token); + } else { + $result=$token->[4]; + } + $result.=&Apache::edit::modifiedfield(); } return $result; } sub end_textfield { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; + my $result; if ($target eq 'web') { $Apache::lonxml::evaluate++; if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { return ""; } + } elsif ($target eq 'edit') { + $result=&Apache::edit::end_table(); } &end_input; - return ''; + return $result; } sub start_textline { @@ -232,6 +249,9 @@ sub finalizeawards { foreach $award (@_) { if ($award eq 'INCORRECT') {$result=$award; last;} } } if ($result eq '' ) { + foreach $award (@_) { if ($award eq 'DRAFT') {$result=$award; last;} } + } + if ($result eq '' ) { foreach $award (@_) { if ($award eq 'SUBMITTED') {$result=$award; last;} } } if ($result eq '' ) { @@ -298,6 +318,9 @@ sub decideoutput { } elsif ($award eq 'SUBMITTED') { $message = "Your submission has been recorded."; $button=1; + } elsif ($award eq 'DRAFT') { + $message = "A draft copy has been saved."; + $button=1; } else { $message = "Unknown message: $award"; $button=1; @@ -327,12 +350,14 @@ sub setgradedata { $Apache::lonhomework::results{"resource.$id.tries"} = $Apache::lonhomework::history{"resource.$id.tries"} + 1; $Apache::lonhomework::results{"resource.$id.solved"} = - 'incorrect_attempted'; + 'incorrect_attempted' } elsif ( $award eq 'SUBMITTED' ) { $Apache::lonhomework::results{"resource.$id.tries"} = $Apache::lonhomework::history{"resource.$id.tries"} + 1; $Apache::lonhomework::results{"resource.$id.solved"} = 'ungraded_attempted'; + } elsif ( $award eq 'DRAFT' ) { + $Apache::lonhomework::results{"resource.$id.solved"} = ''; } elsif ( $award eq 'NO_RESPONSE' ) { return ''; } else {