--- loncom/homework/matchresponse.pm 2003/08/19 15:24:52 1.21 +++ loncom/homework/matchresponse.pm 2003/10/15 19:40:42 1.27 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Full matching style response # -# $Id: matchresponse.pm,v 1.21 2003/08/19 15:24:52 sakharuk Exp $ +# $Id: matchresponse.pm,v 1.27 2003/10/15 19:40:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -144,7 +144,7 @@ sub end_itemgroup { $table.=''; $Apache::matchresponse::itemtable{'display'}=$table; } elsif ($target eq 'tex') { - my $table=' \\\\\\\\ \begin{description} '; + my $table=' \begin{description} '; my $i=0; foreach my $name (@names) { $Apache::response::itemgroup{$name.'.text'}=~s/\$\$/\$/g; @@ -152,7 +152,7 @@ sub end_itemgroup { $Apache::response::itemgroup{$name.'.text'}; $i++; } - $table.=' \end{description} \strut \\\\ '; + $table.=' \end{description} \strut '; $Apache::matchresponse::itemtable{'display'}=$table; } return $result; @@ -294,7 +294,7 @@ sub grade_response { %{ $Apache::response::itemgroup{'letter_name_map'} }; } foreach my $name (@whichfoils) { - my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"}; + my $response = &Apache::response::getresponse($temp); my $responsename = $letter_name_map{$response}; $responsehash{$name}=$responsename; my $value=$Apache::response::foilgroup{$name.'.value'}; @@ -358,7 +358,6 @@ sub displayfoils { \%Apache::response::foilgroup); my $part=$Apache::inputtags::part; my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; - my $status=$Apache::inputtags::status[-1]; my %letter_name_map; if (defined(%{ $Apache::response::itemgroup{'letter_name_map'} })) { %letter_name_map= @@ -369,7 +368,7 @@ sub displayfoils { %name_letter_map= %{ $Apache::response::itemgroup{'name_letter_map'} }; } - if (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) { + if ( &Apache::response::show_answer() && ($target ne 'tex')) { foreach my $name (@whichfoils) { my $text=$Apache::response::foilgroup{$name.'.text'}; my $value=$Apache::response::foilgroup{$name.'.value'}; @@ -422,7 +421,7 @@ sub displayfoils { $question.='
'.$text."\n"; } if ($Apache::lonhomework::type eq 'exam') { - $question.=&Apache::optionresponse::webbubbles(\@used_letters,\@used_letters,$temp); + $question.=&Apache::optionresponse::webbubbles(\@used_letters,\@used_letters,$temp,$last_letter); } } else { if ($Apache::lonhomework::type eq 'exam') { @@ -432,7 +431,7 @@ sub displayfoils { $question.='\vskip -2 mm\parbox{\textwidth}{\begin{enumerate}\item[\textbf{'.$internal_counter.'}.]\parbox{\textwidth - 5 mm}{'.&Apache::optionresponse::bubbles(\@used_letters,\@emptyItems).'}\end{enumerate}} \vskip -10 mm \strut '; $internal_counter++; } else { - $question.=' \\\\ '.$optionlist.$text."\n"; + $question.=' '.$optionlist.$text.'\strut\\\\\strut '."\n"; } } $temp++; @@ -590,7 +589,7 @@ sub end_foil { } } else { if ($target eq 'tex') { - $Apache::response::foilgroup{"$name.text"} = ' $\triangleright$ '.$text; + $Apache::response::foilgroup{"$name.text"} = $text; } else { $Apache::response::foilgroup{"$name.text"} = $text; }