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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 06 Jul 2004 14:53:01 -0000


sakharuk		Tue Jul  6 10:53:01 2004 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
  Bug about <drawoptionlist /> is fixed.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.111 loncom/homework/optionresponse.pm:1.112
--- loncom/homework/optionresponse.pm:1.111	Fri Jul  2 04:21:39 2004
+++ loncom/homework/optionresponse.pm	Tue Jul  6 10:53:00 2004
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.111 2004/07/02 08:21:39 albertel Exp $
+# $Id: optionresponse.pm,v 1.112 2004/07/06 14:53:00 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,7 +38,7 @@
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   my $result='';
   #when in a option response use these
-  &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
+  &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist'));
   push (@Apache::lonxml::namespace,'optionresponse');
   my $id = &Apache::response::start_response($parstack,$safeeval);
   %Apache::hint::option=();
@@ -78,7 +78,7 @@
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   &Apache::response::end_response;
   pop @Apache::lonxml::namespace;
-  &Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
+  &Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist'));
   my $result;
   if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
   undef(%Apache::response::foilnames);
@@ -338,7 +338,7 @@
 	my $lastopt=$lastresponse{$name};
 	if ($text!~/^\s*$/) { $break='<br />'; }
 	$result.=$break;
-	if ($target eq 'web') {
+	if ($target eq 'web' || $target eq 'tex') {
 	    my $value=$Apache::response::foilgroup{$name.'.value'};
 	    if (!($text=~s|<drawoptionlist\s*/>|$value|)) {
 		if ($text=~/^\s*$/) {
@@ -350,7 +350,7 @@
 		$text='&#149;'.$text;
 	    }
 	    $result.=$text."\n";
-      }
+	}
       if ($Apache::lonhomework::type eq 'exam') {
 	  $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
       }
@@ -603,7 +603,6 @@
   my $result = '';
   if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { 
       $text=&Apache::lonxml::endredirection;
-      $text=~/(\w)/;
       if (($target eq 'tex') and ($Apache::lonhomework::type ne 'exam') and ($text=~/\S/)) {$text = '\vspace*{-2 mm}\item '.$text;} 
   }
   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' 
@@ -647,6 +646,16 @@
   return $result;
 }
 
+sub start_drawoptionlist {
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+    return $token->[4];
+}
+
+sub end_drawoptionlist {
+    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+    return $token->[2];
+}
+
 sub insert_foil {
   return '
 <foil name="" value="unused">