[LON-CAPA-cvs] cvs: loncom /homework optionresponse.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 26 Aug 2002 18:15:22 -0000


sakharuk		Mon Aug 26 14:15:22 2002 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
   Corrected printing for answered problems: both correct and uncorrect answers are possible.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.45 loncom/homework/optionresponse.pm:1.46
--- loncom/homework/optionresponse.pm:1.45	Mon Aug  5 11:55:39 2002
+++ loncom/homework/optionresponse.pm	Mon Aug 26 14:15:22 2002
@@ -1,7 +1,7 @@
-# The LearningOnline Network with CAPA
+# LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.45 2002/08/05 15:55:39 albertel Exp $
+# $Id: optionresponse.pm,v 1.46 2002/08/26 18:15:22 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -281,9 +281,16 @@
     foreach $name (@whichopt) {
       if ($target eq 'web') {
 	  $result.="<br />";
+      } elsif ($target eq 'tex') {
+	  $result.='\vskip 0 mm ';
+      }
+      if ($target ne 'tex') {
+	  $result .=$Apache::response::foilgroup{$name.'.value'}.
+	      ":".$Apache::response::foilgroup{$name.'.text'}."\n";
+      } else {
+ 	  $result .='\item '.$Apache::response::foilgroup{$name.'.value'}.
+	      ":".$Apache::response::foilgroup{$name.'.text'}."\n";
       }
-      $result .=$Apache::response::foilgroup{$name.'.value'}.
-	  ":".$Apache::response::foilgroup{$name.'.text'}."\n";
     }
   } else {
     my $temp=1;
@@ -309,15 +316,24 @@
               my $texoptionlist = $optionlist;
 	      $texoptionlist =~ s/<option><\/option>/\\item \[\] The possible answers are:/;
 	      $texoptionlist =~ s/<option>/{\\bf /g;
+	      $texoptionlist =~ s/<option selected="on">/{\\bf /g;
 	      $texoptionlist =~ s/<\/option>/},/g;
 	      $texoptionlist =~ s/,$/\./g;
 	      $texoptionlist =~ s/>/\$>\$/g;
 	      $texoptionlist =~ s/</\$<\$/g;
 	      $texoptionlist =~ s/=/\$=\$/g;
-	      $result.= $texoptionlist.'\item '.$Apache::response::foilgroup{$name.'.text'};
+	      if ($Apache::response::foilgroup{$name.'.text'}=~m/\\item /) {
+		  $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};
+	      } else {
+		  $result.= $texoptionlist.'\item '.$Apache::response::foilgroup{$name.'.text'};
+	      }
 	      $displayoptionintex=1;
 	  } else {
-	      $result.= '\item '.$Apache::response::foilgroup{$name.'.text'};
+	      if ($Apache::response::foilgroup{$name.'.text'}=~m/\\item /) {
+		  $result.= $Apache::response::foilgroup{$name.'.text'};
+	      } else {
+		  $result.= '\item '.$Apache::response::foilgroup{$name.'.text'};
+	      }
 	  }
       } 
     }
@@ -434,15 +450,15 @@
 	   && !&Apache::response::showallfoils() ) {
 	push @{ $Apache::response::conceptgroup{'names'} }, $name;
 	$Apache::response::conceptgroup{"$name.value"} = $value;
-	$Apache::response::conceptgroup{"$name.text"} = $text;	
+	$Apache::response::conceptgroup{"$name.text"} = $text;
       } else {
 	push @{ $Apache::response::foilgroup{'names'} }, $name;
         if ($target eq 'tex') {
-	    $Apache::response::foilgroup{"$name.value"} = '\item '.$value;
+	    $Apache::response::foilgroup{"$name.text"} = '\item '.$text;
 	} else {
 	    $Apache::response::foilgroup{"$name.value"} = $value;
+	    $Apache::response::foilgroup{"$name.text"} = $text;
 	}
-	$Apache::response::foilgroup{"$name.text"} = $text;
       }
     }
   }