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

albertel lon-capa-cvs@mail.lon-capa.org
Sun, 10 Nov 2002 15:51:31 -0000


albertel		Sun Nov 10 10:51:31 2002 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
  - Implements BUG#40
  
  - <drawoptionlist /> inside of a foil will be where the drop list is placed.
  
  
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.58 loncom/homework/optionresponse.pm:1.59
--- loncom/homework/optionresponse.pm:1.58	Thu Nov  7 11:45:55 2002
+++ loncom/homework/optionresponse.pm	Sun Nov 10 10:51:31 2002
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.58 2002/11/07 16:45:55 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.59 2002/11/10 15:51:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -327,8 +327,12 @@
 	  $result.='\vskip 0 mm ';
       }
       if ($target ne 'tex') {
-	  $result .=$Apache::response::foilgroup{$name.'.value'}.
-	      ":".$Apache::response::foilgroup{$name.'.text'}."\n";
+	  my $text=$Apache::response::foilgroup{$name.'.text'};
+	  my $value=$Apache::response::foilgroup{$name.'.value'};
+	  if (!($text=~s|<drawoptionlist\s*/>|$value|)) {
+	      $text=$value.': '.$text;
+	  }
+	  $result.=$text."\n";
       } else {
 	  $Apache::response::foilgroup{$name.'.text'}=~s/\\item//;
  	  $result .='\item \textit{'.$Apache::response::foilgroup{$name.'.value'}.'}'.
@@ -358,9 +362,14 @@
 	}
       }
       if ($target ne 'tex') {
-	  $result.="<br /><select name=\"HWVAL_$Apache::inputtags::response['-1']:$temp\">"
-	      .$optionlist
-		  ."</select>\n".$Apache::response::foilgroup{$name.'.text'}."\n";
+	  $optionlist='<select name="HWVAL_'.
+	      $Apache::inputtags::response['-1'].':'.$temp.'">'.
+		  $optionlist."</select>\n";
+	  my $text=$Apache::response::foilgroup{$name.'.text'};
+	  if (!($text=~s|<drawoptionlist\s*/>|$optionlist|)) {
+	      $text=$optionlist.$text;
+	  }
+	  $result.="<br />".$text."\n";
 	  if ($Apache::lonhomework::type eq 'exam') {
 	    $result.=&webbubbles(\@opt,\@alphabet);
 	  }