--- loncom/homework/caparesponse/caparesponse.pm 2008/03/06 16:28:22 1.223 +++ loncom/homework/caparesponse/caparesponse.pm 2008/07/26 15:06:43 1.227 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.223 2008/03/06 16:28:22 www Exp $ +# $Id: caparesponse.pm,v 1.227 2008/07/26 15:06:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -310,6 +310,10 @@ sub start_numericalresponse { $safeeval); if ($unit =~ /\S/) { $result.=" (in $unit) "; } } + if (($token->[1] eq 'formularesponse') && + ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')) { + $result.=&edit_formula_button($id,"HWVAL_$id"); + } if ( &Apache::response::show_answer() ) { &set_answertext($tag_internal_answer_name,$target,$token,$tagstack, $parstack,$parser,$safeeval,-1); @@ -318,6 +322,22 @@ sub start_numericalresponse { return $result; } +sub edit_formula_button { + my ($id,$field)=@_; + my $button=&mt('Edit Answer'); + my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor'); + return(< +function edit_${id}_${field} (textarea) { + thenumber = textarea; + thedata = document.forms['lonhomework'].elements[textarea].value; + newwin = window.open("/adm/dragmath/applet/MaximaPopup.html","","width=565,height=400,resizable"); +} + +$helplink +ENDFORMULABUTTON +} + sub set_answertext { my ($name,$target,$token,$tagstack,$parstack,$parser,$safeeval, $response_level) = @_; @@ -678,12 +698,12 @@ sub end_numericalresponse { #} } if ($high && $tag eq 'numericalresponse') { - $element.=': ['.$low.','.$high.']'; + $element.='; ['.$low.'; '.$high.']'; $tolline .= "[$low, $high]"; } if (defined($sighigh) && $tag eq 'numericalresponse') { if ($env{'form.answer_output_mode'} eq 'tex') { - $element.= ": Sig $siglow - $sighigh"; + $element.= "; Sig $siglow - $sighigh"; } else { $element.= " Sig $siglow - $sighigh"; $sigline .= "[$siglow, $sighigh]";