--- loncom/homework/response.pm 2014/02/13 12:43:50 1.235 +++ loncom/homework/response.pm 2014/09/24 18:14:27 1.237 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.235 2014/02/13 12:43:50 bisitz Exp $ +# $Id: response.pm,v 1.237 2014/09/24 18:14:27 damieng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -578,10 +578,15 @@ sub start_mathresponse { sub edit_mathresponse_button { my ($id,$field)=@_; - my $button=&mt('Edit Answer'); -# my $helplink=&Apache::loncommon::help_open_topic('Formula_Editor'); - my $iconpath=$Apache::lonnet::perlvar{'lonIconsURL'}; - return(< function edit_${id}_${field} (textarea) { thenumber = textarea; @@ -591,6 +596,27 @@ function edit_${id}_${field} (textarea) $button ENDFORMULABUTTON + + } else { + # LON-CAPA math equation editor + return(< + var field = document.getElementById('${field}'); + field.className += ' math'; // note the space + var LCMATH_started; + if (typeof LCMATH_started === 'undefined') { + LCMATH_started = true; + var script = document.createElement("script"); + script.type = "text/javascript"; + script.src = "/adm/LC_math_editor/LC_math_editor.min.js"; + document.body.appendChild(script); + window.addEventListener('load', function(e) { + LCMATH.initEditors(); + }, false); + } + +EQ_EDITOR_SCRIPT + } } sub end_mathresponse { @@ -1379,7 +1405,7 @@ sub check_status { if (!defined($id)) { $id=$Apache::inputtags::part; } my $curtime=&Apache::lonnet::EXT('system.time'); my $opendate=&Apache::lonnet::EXT("resource.$id.opendate"); - my $duedate=&Apache::lonnet::EXT("resource.$id.duedate"); + my $duedate=&Apache::lonhomework::due_date($id); my $answerdate=&Apache::lonnet::EXT("resource.$id.answerdate"); if ( $opendate && $curtime > $opendate && $duedate && $curtime > $duedate &&