--- loncom/homework/inputtags.pm 2002/08/01 15:18:58 1.59 +++ loncom/homework/inputtags.pm 2002/10/02 18:13:47 1.64 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.59 2002/08/01 15:18:58 ng Exp $ +# $Id: inputtags.pm,v 1.64 2002/10/02 18:13:47 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,43 +79,64 @@ sub start_textfield { my $resid=$Apache::inputtags::response[-1]; if ($target eq 'web') { $Apache::lonxml::evaluate--; - my $partid=$Apache::inputtags::part; - my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"}); - my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); - if ( $cols eq '') { $cols = 80; } - my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval); - if ( $rows eq '') { $rows = 10; } if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { - $result= '"; } + } elsif ($target eq 'edit') { + $result=&Apache::edit::end_table(); } &end_input; - return ''; + return $result; } sub start_textline { @@ -123,16 +144,18 @@ sub start_textline { my $result = ""; if ($target eq 'web') { $Apache::lonxml::evaluate--; - my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); - if ($size eq '') { $size=20; } - my $partid=$Apache::inputtags::part; - my $id=$Apache::inputtags::response[-1]; - my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"}); if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { + my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval); + if ($size eq '') { $size=20; } + my $partid=$Apache::inputtags::part; + my $id=$Apache::inputtags::response[-1]; + my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"}); $result= ''; } else { - $result=''.$oldresponse.''; + #right or wrong don't show what was last typed in. + #$result=''.$oldresponse.''; + $result=''; } } elsif ($target eq 'edit') { $result=&Apache::edit::tag_start($target,$token); @@ -359,7 +382,7 @@ sub setgradedata { foreach my $key (keys(%Apache::lonhomework::results)) { if (($key =~ /^resource\.$id\./) && ($key !~ /\.collaborators$/)) { &Apache::lonxml::debug("Removing $key"); - delete($Apache::lonhomework::results{$key}); + delete($Apache::lonhomework::results{$key}); } } #and since they didn't do anything we were never here @@ -401,7 +424,7 @@ sub grade { } sub gradestatus { - my ($id) = @_; + my ($id,$target) = @_; my $showbutton = 1; my $message = ''; my $latemessage = ''; @@ -420,9 +443,13 @@ sub gradestatus { &Apache::lonxml::debug('Getting message'); ($showbutton,$message,$previousmsg) = &decideoutput($award,$solved,$previous); - $message="$message"; - if ($previousmsg) { - $previousmsg="$previousmsg"; + if ($target eq 'tex') { + $message=' '.$message.' '; + } else { + $message="$message"; + if ($previousmsg) { + $previousmsg="$previousmsg"; + } } } my $tries = $Apache::lonhomework::history{"resource.$id.tries"}; @@ -432,22 +459,36 @@ sub gradestatus { if ( $maxtries eq '' ) { $maxtries = '2'; } if ( $maxtries eq 'con_lost' ) { $maxtries = '0'; } if ( $showbutton ) { - $trystr = "Tries $tries/$maxtries"; + if ($target eq 'tex') { + $trystr = ' Tries '.$tries.'/'.$maxtries.' '; + } else { + $trystr = "Tries $tries/$maxtries"; + } } if ( $status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {$showbutton = 0;} if ( $showbutton ) { - $button = '
'; + if ($target ne 'tex') { + $button = '
'; + } } if ($Apache::lonhomework::history{"resource.$id.afterduedate"}) { #last submissions was after due date - $latemessage="The last submission was after the Due Date"; + if ($target eq 'tex') { + $latemessage=' The last submission was after the Due Date '; + } else { + $latemessage="The last submission was after the Due Date"; + } } } my $output= $previousmsg.$latemessage.$message.$trystr; if ($output =~ /^\s*$/) { return $button; } else { - return $button.''.$output.'
'; + if ($target eq 'tex') { + return $button.' \vskip 0 mm '.$output.' '; + } else { + return $button.''.$output.'
'; + } } } 1;