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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 16 Oct 2003 18:30:46 -0000


albertel		Thu Oct 16 14:30:46 2003 EDT

  Modified files:              
    /loncom/homework	chemresponse.pm 
  Log:
  - add answers to organic/reaction responses
  - Fix stupidietis related to editing options to JME applet
  
  
Index: loncom/homework/chemresponse.pm
diff -u loncom/homework/chemresponse.pm:1.14 loncom/homework/chemresponse.pm:1.15
--- loncom/homework/chemresponse.pm:1.14	Thu Oct 16 10:56:27 2003
+++ loncom/homework/chemresponse.pm	Thu Oct 16 14:30:46 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # chemical equation style response
 #
-# $Id: chemresponse.pm,v 1.14 2003/10/16 14:56:27 albertel Exp $
+# $Id: chemresponse.pm,v 1.15 2003/10/16 18:30:46 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,14 +113,9 @@
 	    $molecule=&Apache::lonxml::get_param('molecule',$parstack,
 						 $safeeval);
 	}
-	my $multipart=&Apache::lonxml::get_param('multipart',$parstack,
-						 $safeeval);
-	if ($multipart eq 'yes') {
-	    $multipart = 'multipart';
-	} else {
-	    $multipart ='';
-        }
-	$result=&seperate_jme_window("HWVAL_$id","MOLECULE_$id",$molecule,$multipart);
+	my $options=&Apache::lonxml::get_param('options',$parstack,
+					       $safeeval);
+	$result=&seperate_jme_window("HWVAL_$id","MOLECULE_$id",$molecule,$options);
 	$result.= '<input type="hidden" name="MOLECULE_'.$id.'" value="" />';
     } elsif ($target eq 'edit') {
 	$result .=&Apache::edit::tag_start($target,$token);
@@ -194,6 +189,14 @@
 	}
     } elsif ($target eq "edit") {
 	$result.= &Apache::edit::tag_end($target,$token,'');
+    } elsif ($target eq 'answer') {
+	my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,
+						     $safeeval);
+	$result.=&Apache::response::answer_header('organicresponse');
+	foreach my $answer (@answers) {
+	    $result.=&Apache::response::answer_part('organicresponse',$answer);
+	}
+	$result.=&Apache::response::answer_footer('organicresponse');
     }
     &Apache::response::end_response;
     return $result;
@@ -310,7 +313,7 @@
 	if ( $response =~ /[^\s]/) {
 	    my $partid = $Apache::inputtags::part;
 	    my $id = $Apache::inputtags::response['-1'];
-	    my (@answers)=&Apache::lonxml::get_param('answer',$parstack,$safeeval);
+	    my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
 	    my %previous = &Apache::response::check_for_previous($response,$partid,$id);
 	    $Apache::lonhomework::results{"resource.$partid.$id.submission"}=$response;
 	    my $ad;
@@ -327,6 +330,15 @@
 	}
     }  elsif ($target eq "edit") {
 	$result.= &Apache::edit::tag_end($target,$token,'');
+    } elsif ($target eq 'answer') {
+	my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,
+						     $safeeval);
+	$result.=&Apache::response::answer_header('reactionresponse');
+	foreach my $answer (@answers) {
+	    $result.=&Apache::response::answer_part('reactionresponse',
+						    $answer);
+	}
+	$result.=&Apache::response::answer_footer('reactionresponse');
     }
     &Apache::response::end_response;
     return $result;