--- loncom/homework/response.pm	2006/10/17 17:09:44	1.148
+++ loncom/homework/response.pm	2006/12/04 21:23:01	1.152
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.148 2006/10/17 17:09:44 albertel Exp $
+# $Id: response.pm,v 1.152 2006/12/04 21:23:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -306,7 +306,7 @@ sub handle_previous {
 }
 
 sub view_or_modify {
-    my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
+    my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser();
     my $myself=0;
     if ( ($name eq $env{'user.name'}) && ($domain eq $env{'user.domain'}) ) {
 	$myself=1;
@@ -340,7 +340,7 @@ sub end_dataresponse {
     if ( $target eq 'web' ) {
     } elsif ($target eq 'grade' ) {
 	if ( defined $env{'form.submitted'}) {
-	    my ($symb,$courseid,$domain,$name)=&Apache::lonxml::whichuser();
+	    my ($symb,$courseid,$domain,$name)=&Apache::lonnet::whichuser();
 	    my $allowed=&Apache::lonnet::allowed('mgr',$courseid);
 	    if ($allowed) {
 		&Apache::response::setup_params('dataresponse',$safeeval);
@@ -373,7 +373,7 @@ sub start_customresponse {
   	if (  &Apache::response::show_answer() ) {
 	    my $answer = &Apache::lonxml::get_param('answerdisplay',$parstack,
 						   $safeeval);
-	    $Apache::inputtags::answertxt{$id}=$answer;
+	    $Apache::inputtags::answertxt{$id}=[$answer];
 	}
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::tag_start($target,$token);
@@ -464,12 +464,20 @@ sub start_mathresponse {
   	if (  &Apache::response::show_answer() ) {
 	    my $answer = &Apache::lonxml::get_param('answerdisplay',$parstack,
 						   $safeeval);
-	    $Apache::inputtags::answertxt{$id}=$answer;
+	    $Apache::inputtags::answertxt{$id}=[$answer];
 	}
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::tag_start($target,$token);
 	$result.=&Apache::edit::text_arg('String to display for answer:',
 					 'answerdisplay',$token);
+	$result.=&Apache::edit::select_arg('Algebra System:',
+					   'cas',
+					   ['maxima'],
+					   $token);
+	$result.=&Apache::edit::text_arg('Algebra System:',
+					 'cas',$token);
+	$result.=&Apache::edit::text_arg('Argument Array:',
+					 'args',$token);
 	$result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {
 	my $constructtag;
@@ -494,8 +502,7 @@ sub end_mathresponse {
     my $id=$Apache::inputtags::response[-1];
     if ( $target eq 'grade' && &Apache::response::submitted() ) {
 	my $response = &Apache::response::getresponse();
-	if ( $response =~ /[^\s]/ && 
-	     $Apache::response::custom_answer_type eq 'loncapa/perl') {
+	if ( $response =~ /[^\s]/ ) {
 	    if (!$Apache::lonxml::default_homework_loaded) {
 		&Apache::lonxml::default_homework_load($safeeval);
 	    }
@@ -776,7 +783,7 @@ sub answer_footer {
 
 sub showallfoils {
     if (defined($env{'form.showallfoils'})) {
-	my ($symb)=&Apache::lonxml::whichuser();
+	my ($symb)=&Apache::lonnet::whichuser();
 	if (($env{'request.state'} eq 'construct') || 
 	    ($env{'user.adv'} && $symb eq '')      ||
             ($Apache::lonhomework::viewgrades) ) {
@@ -998,7 +1005,7 @@ sub submitted {
 }
 
 sub add_to_gradingqueue {
-    my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
+    my ($symb,$courseid,$domain,$name) = &Apache::lonnet::whichuser();
     if (   $courseid eq ''
 	|| $symb eq ''
 	|| $env{'request.state'} eq 'construct'