--- loncom/homework/response.pm 2006/12/04 21:23:01 1.152 +++ loncom/homework/response.pm 2006/12/15 21:10:13 1.155 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.152 2006/12/04 21:23:01 albertel Exp $ +# $Id: response.pm,v 1.155 2006/12/15 21:10:13 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,6 +30,7 @@ package Apache::response; use strict; use Apache::lonlocal; use Apache::lonnet; +use Apache::lonmaxima(); BEGIN { &Apache::lonxml::register('Apache::response',('responseparam','parameter','dataresponse','customresponse','mathresponse')); @@ -474,15 +475,13 @@ sub start_mathresponse { '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; $constructtag=&Apache::edit::get_new_args($token,$parstack, - $safeeval,'answerdisplay'); + $safeeval,'answerdisplay','cas','args'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); $result.=&Apache::edit::handle_insert(); @@ -511,10 +510,12 @@ sub end_mathresponse { $Apache::lonhomework::results{"resource.$part.$id.submission"}= $response; my $error; - ${$safeeval->varglob('LONCAPA::mathresponse_submission')}= - $response; - - my $award = &Apache::run::run('{ my $submission=$LONCAPA::mathresponse_submission;'.$Apache::response::custom_answer.'}',$safeeval); + my $award; + my $cas = &Apache::lonxml::get_param('cas',$parstack,$safeeval); + if ($cas eq 'maxima') { + my $args = [&Apache::lonxml::get_param_var('args',$parstack,$safeeval)]; + $award=&Apache::lonmaxima::maxima_run($Apache::response::custom_answer,$response,$args); + } if (!&Apache::inputtags::valid_award($award)) { $error = $award; $award = 'ERROR';