--- loncom/homework/optionresponse.pm 2002/11/13 16:53:11 1.63
+++ loncom/homework/optionresponse.pm 2003/01/19 08:10:22 1.67
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.63 2002/11/13 16:53:11 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.67 2003/01/19 08:10:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -248,6 +248,7 @@ sub whichfoils {
my ($max,$randomize)=@_;
$max = &getfoilcounts($max);
&Apache::lonxml::debug("randomize $randomize");
+ if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
my @names = @{ $Apache::response::foilgroup{'names'} };
my @whichopt =();
my (%top,@toplist,%bottom,@bottomlist);
@@ -294,6 +295,7 @@ sub whichfoils {
sub displayanswers {
my ($max,$randomize,@opt)=@_;
+ if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
my @names = @{ $Apache::response::foilgroup{'names'} };
my @whichopt = &whichfoils($max,$randomize);
my $result=&Apache::response::answer_header('optionresponse');
@@ -307,6 +309,7 @@ sub displayanswers {
sub displayfoils {
my ($target,$max,$randomize,@opt)=@_;
+ if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
my @names = @{ $Apache::response::foilgroup{'names'} };
my @truelist;
my @falselist;
@@ -319,8 +322,11 @@ sub displayfoils {
my $part=$Apache::inputtags::part;
my $id=$Apache::inputtags::response[-1];
my $break;
- if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/) || ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER')) {
- my $temp=1; ####
+ my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
+ my $status=$Apache::inputtags::status[-1];
+ if (
+ ($target ne 'tex') &&
+ (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) {
foreach $name (@whichopt) {
my $text=$Apache::response::foilgroup{$name.'.text'};
if ($text!~/^\s*$/) {
@@ -353,7 +359,6 @@ sub displayfoils {
$result.=&bubbles(\@alphabet,\@opt);
}
}
- $temp++;
}
} else {
my $temp=1;
@@ -401,7 +406,7 @@ sub displayfoils {
if ($Apache::response::foilgroup{$name.'.text'}=~//) {
$Apache::response::foilgroup{$name.'.text'}=~s|| \\makebox\[0\.3in\]\[b\]\{\\hrulefill\} |;
}
- $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};
+ $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};
} else {
if ($Apache::lonhomework::type eq 'exam') {
$result.= $texoptionlist.'\vspace*{-2 mm}\item[\textbf{'.$Apache::lonxml::counter.'}.]'.$Apache::response::foilgroup{$name.'.text'};
@@ -411,6 +416,7 @@ sub displayfoils {
}
if ($Apache::lonhomework::type eq 'exam') {
$result.=&bubbles(\@alphabet,\@opt);
+ $result.='\vskip 2 mm ';
}
$displayoptionintex=1;
} else {
@@ -431,6 +437,7 @@ sub displayfoils {
}
if ($Apache::lonhomework::type eq 'exam') {
$result.=&bubbles(\@alphabet,\@opt);
+ $result.='\vskip 2 mm ';
}
}
}
@@ -455,6 +462,7 @@ sub optionlist_correction {
$texoptionlist =~ s/>/\$>\$/g;
$texoptionlist =~ s/\$<\$/g;
$texoptionlist =~ s/=/\$=\$/g;
+ $texoptionlist =~ s/\^(\d+)/\$$1\$<\/m>/g;
return $texoptionlist;
}