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

sakharuk lon-capa-cvs@mail.lon-capa.org
Fri, 25 Jul 2003 18:46:20 -0000


sakharuk		Fri Jul 25 14:46:20 2003 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
  An attempt tofix bug 1744 (Need a way of supressing the list of optionresponse choices from the printout). Subject to Guy's approval.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.79 loncom/homework/optionresponse.pm:1.80
--- loncom/homework/optionresponse.pm:1.79	Tue Jul  1 16:12:55 2003
+++ loncom/homework/optionresponse.pm	Fri Jul 25 14:46:19 2003
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.79 2003/07/01 20:12:55 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.80 2003/07/25 18:46:19 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -152,9 +152,11 @@
   
   my $result;
   if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') {
+    my $tex_option_switch=&Apache::lonxml::get_param('texout',$parstack,$safeeval);
     my $name;
     my @opt;
     eval '@opt ='.&Apache::lonxml::get_param('options',$parstack,$safeeval);
+    if ($target eq 'tex' && $tex_option_switch eq 'nooptions') {@opt=();}
     &Apache::lonxml::debug("Options are $#opt");
     my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
     my $randomize = &Apache::lonxml::get_param('randomize',$parstack,
@@ -434,15 +436,19 @@
 sub optionlist_correction {
 
     my $texoptionlist = shift;
-    $texoptionlist =~ s/<option><\/option>/\\item \[\] 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;
-    $texoptionlist =~ s/\^(\d+)/<m>\$$1\$<\/m>/g;
+    if ($texoptionlist=~/<option selected/) {
+	$texoptionlist =~ s/<option><\/option>/\\item \[\] 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;
+	$texoptionlist =~ s/\^(\d+)/<m>\$$1\$<\/m>/g;
+    } else {
+	$texoptionlist =~ s/<option><\/option>/\\item \[\] \\vskip -5 mm/;
+    }
     return $texoptionlist;
 }