--- loncom/homework/matchresponse.pm 2003/11/15 06:28:02 1.31 +++ loncom/homework/matchresponse.pm 2004/02/09 19:38:00 1.33 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Full matching style response # -# $Id: matchresponse.pm,v 1.31 2003/11/15 06:28:02 albertel Exp $ +# $Id: matchresponse.pm,v 1.33 2004/02/09 19:38:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -306,7 +306,7 @@ sub grade_response { if (!defined($ENV{'form.submitted'})) { return; } my %responsehash; my %grade; - my ($temp,$right,$wrong,$ignored)=(0,0,0,0); + my ($temp,$right,$wrong,$ignored)=(1,0,0,0); my %letter_name_map; if (defined(%{ $Apache::response::itemgroup{'letter_name_map'} })) { %letter_name_map= @@ -320,7 +320,7 @@ sub grade_response { my $value=$Apache::response::foilgroup{$name.'.value'}; if ( $response =~ /[^\s]/) { $responsehash{$name}=$responsename; - &Apache::lonxml::debug("submitted a $response for $value
\n"); + &Apache::lonxml::debug("submitted a $response($responsename) for $value
\n"); if ($value eq $responsename) { $grade{$name}='1'; $right++; } else { @@ -465,11 +465,19 @@ sub displayfoils { } elsif ($result=&itemdisplay('bottom')) { $result=$question.$result; } elsif ($result=&itemdisplay('right')) { - $result='
'.$question.''.$result. - '
'; + if ($target ne 'tex') { + $result='
'.$question.''.$result. + '
'; + } else { + $result='\begin{tabular}{p{\textwidth/2}p{\textwidth/2}}\begin{minipage}{\textwidth/2}'.$question.'\end{minipage}&\begin{minipage}{\textwidth/2}'.$result.'\end{minipage}\end{tabular}'; + } } elsif ($result=&itemdisplay('left')) { - $result='
'.$result.''.$question. - '
'; + if ($target ne 'tex') { + $result='
'.$result.''.$question. + '
'; + } else { + $result='\begin{tabular}{p{\textwidth/2}p{\textwidth/2}}\begin{minipage}{\textwidth/2}'.$result.'\end{minipage}&\begin{minipage}{\textwidth/2}'.$question.'\end{minipage}\end{tabular}'; + } } if ($target ne 'tex') {$result.="
";} else {$result.=' \\\\ ';} return $result;