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

sakharuk lon-capa-cvs@mail.lon-capa.org
Wed, 02 Apr 2003 18:07:11 -0000


sakharuk		Wed Apr  2 13:07:11 2003 EDT

  Modified files:              
    /loncom/homework	optionresponse.pm 
  Log:
   First steps to implement radiobuttonresponse inside of optionresponse for the exam mode.
  
  
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.71 loncom/homework/optionresponse.pm:1.72
--- loncom/homework/optionresponse.pm:1.71	Thu Mar 27 09:58:56 2003
+++ loncom/homework/optionresponse.pm	Wed Apr  2 13:07:10 2003
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.71 2003/03/27 14:58:56 sakharuk Exp $
+# $Id: optionresponse.pm,v 1.72 2003/04/02 18:07:10 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -316,8 +316,7 @@
   my $result;
   my $name;
   my $displayoptionintex=0;
-  my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
-		  'Q','R','S','T','U','V','W','X','Y','Z');
+  my @alphabet = ('A'..'Z');
   my @whichopt = &whichfoils($max,$randomize);
   my $part=$Apache::inputtags::part;
   my $id=$Apache::inputtags::response[-1];
@@ -383,11 +382,13 @@
 	}
       }
       if ($target ne 'tex') {
-	  $optionlist='<select name="HWVAL_'.
+	  if ($Apache::lonhomework::type ne 'exam') {
+	    $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|)) {
+	  if (!($text=~s|<drawoptionlist\s*/>|$optionlist|) && $Apache::lonhomework::type ne 'exam') {
 	      $text=$optionlist.$text;
 	  }
 	  $result.=$break.$text."\n";
@@ -474,7 +475,8 @@
 	my $number_of_bubbles = $#opt + 1;
 	$result.= '<table border="1"><tr>';
 	for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
-	   $result.='<td>'.$alphabet[$ind].': '.$opt[$ind].'</td>';
+	   $result.='<td><input type="radio" name="HWVAL'.$Apache::inputtags::response['-1'].
+                    '" value='.$opt[$ind].'>'.$alphabet[$ind].': '.$opt[$ind].'</td>';
 	}
 	$result.='</tr></table>';
 	return $result;