--- loncom/homework/optionresponse.pm 2002/11/10 15:51:31 1.59
+++ loncom/homework/optionresponse.pm 2002/11/11 15:58:51 1.60
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.59 2002/11/10 15:51:31 albertel Exp $
+# $Id: optionresponse.pm,v 1.60 2002/11/11 15:58:51 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -375,14 +375,20 @@ sub displayfoils {
}
$temp++;
} else {
+ my $texoptionlist = &optionlist_correction($optionlist);
if ($displayoptionintex == 0) {
- my $texoptionlist = &optionlist_correction($optionlist);
- if ($Apache::lonhomework::type eq 'exam') {$texoptionlist='';}
+ if ($Apache::lonhomework::type eq 'exam') {$texoptionlist='';} #if exam we do not need to show optionlist
if ($Apache::response::foilgroup{$name.'.text'}=~m/\\item /) {
- if ($Apache::lonhomework::type eq 'exam') {
- $Apache::response::foilgroup{$name.'.text'}=~s/\\item/\\item[\\textbf{$Apache::lonxml::counter}\.]/;
- }
- $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};
+ if ($Apache::lonhomework::type eq 'exam') {
+ $Apache::response::foilgroup{$name.'.text'}=~s/\\item/\\item[\\textbf{$Apache::lonxml::counter}\.]/;
+ }
+ if ($Apache::response::foilgroup{$name.'.text'}=~//) {
+ $texoptionlist = &texoptionlist_correction($texoptionlist);
+ $Apache::response::foilgroup{$name.'.text'}=~s||$texoptionlist|;
+ $result.= $Apache::response::foilgroup{$name.'.text'};
+ } else {
+ $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'};
@@ -399,7 +405,11 @@ sub displayfoils {
if ($Apache::lonhomework::type eq 'exam') {
$Apache::response::foilgroup{$name.'.text'}=~s/\\item/\\item[\\textbf{$Apache::lonxml::counter}\.]/;
}
- $result.= $Apache::response::foilgroup{$name.'.text'};
+ if ($Apache::response::foilgroup{$name.'.text'}=~//) {
+ $texoptionlist = &texoptionlist_correction($texoptionlist);
+ $Apache::response::foilgroup{$name.'.text'}=~s||$texoptionlist|;
+ }
+ $result.= $Apache::response::foilgroup{$name.'.text'};
} else {
if ($Apache::lonhomework::type eq 'exam') {
$result.= '\item[\textbf{'.$Apache::lonxml::counter.'}.]'.$Apache::response::foilgroup{$name.'.text'};
@@ -437,6 +447,14 @@ sub optionlist_correction {
return $texoptionlist;
}
+
+sub texoptionlist_correction {
+ my $texoptionlist = shift;
+ $texoptionlist =~ s/\\item \[\] Possible answers are:\s*/\\fbox\{/;
+ $texoptionlist =~ s/\.$/}/;
+ return $texoptionlist;
+}
+
sub webbubbles {