--- loncom/homework/structuretags.pm 2015/03/11 14:50:10 1.512.2.9 +++ loncom/homework/structuretags.pm 2020/06/03 18:40:33 1.512.2.13.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.512.2.9 2015/03/11 14:50:10 raeburn Exp $ +# $Id: structuretags.pm,v 1.512.2.13.2.2 2020/06/03 18:40:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -270,6 +270,7 @@ sub homework_js { $jstimeout = 1000 * $timeout; } return &Apache::loncommon::resize_textarea_js(). + &Apache::loncommon::colorfuleditor_js(). &setmode_javascript(). <<"JS"; @@ -416,9 +417,13 @@ sub page_start { $extra_head .= &homework_js(). &Apache::lonhtmlcommon::dragmath_js("EditMathPopup"); if (&Apache::lonhtmlcommon::htmlareabrowser()) { - my %textarea_args = ( + my %textarea_args; + if (($env{'request.state'} ne 'construct') || + ($env{'environment.nocodemirror'})) { + %textarea_args = ( dragmath => 'math', ); + } $extra_head .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args); } my $is_task = ($env{'request.uri'} =~ /\.task$/); @@ -751,53 +756,82 @@ sub problem_edit_action_button { sub problem_edit_buttons { my ($mode)=@_; +# Buttons that save + my $result = '
';
+
+ ' . &Apache::lonxml::message_location();
+ $return .= '
+ ';
+
+ $return .= '
+
+
+ '.&mt('Problem Editing').$mode.&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').'
+
'. "\n\n".&Apache::loncommon::end_page(); @@ -1361,6 +1395,7 @@ sub init_problem_globals { @Apache::inputtags::importlist = (); @Apache::inputtags::previous=(); @Apache::inputtags::previous_version=(); + $Apache::inputtags::leniency=''; $Apache::structuretags::printanswer='No'; @Apache::structuretags::whileconds=(); @Apache::structuretags::whilebody=(); @@ -1376,6 +1411,7 @@ sub reset_problem_globals { undef(%Apache::lonhomework::history); undef(%Apache::lonhomework::results); undef($Apache::inputtags::part); + undef($Apache::inputtags::leniency); if ($type eq 'Task') { undef($Apache::inputtags::slot_name); } elsif ($type eq 'problem') { @@ -1487,7 +1523,8 @@ sub start_problem { $target eq 'tex') { if ($env{'form.markaccess'}) { my @interval=&Apache::lonnet::EXT("resource.0.interval"); - &Apache::lonnet::set_first_access($interval[1],$interval[0]); + my ($timelimit) = ($interval[0] =~ /^(\d+)/); + &Apache::lonnet::set_first_access($interval[1],$timelimit); } ($status,$accessmsg,$slot_name,$slot) = @@ -2579,6 +2616,7 @@ sub start_part { my $id= &Apache::lonxml::get_id($parstack,$safeeval); $Apache::inputtags::part=$id; push(@Apache::inputtags::partlist,$id); + $Apache::inputtags::leniency=''; @Apache::inputtags::response=(); @Apache::inputtags::previous=(); @Apache::inputtags::previous_version=(); @@ -2744,6 +2782,7 @@ sub end_part { } pop @Apache::inputtags::status; $Apache::inputtags::part=''; + $Apache::inputtags::leniency=''; $Apache::lonhomework::type = $Apache::lonhomework::default_type; return $result; } @@ -2894,13 +2933,18 @@ sub end_startouttext { if ($target eq 'edit') { my $areaid = 'homework_edit_'.$Apache::lonxml::curdepth; $text=&Apache::lonxml::get_all_text("endouttext",$parser,$style); - $result.=&Apache::edit::start_table($token)." | ||||
".&mt('Text Block')." | " + $result.=&Apache::edit::start_table($token)."||||
".&Apache::loncommon::insert_folding_button() + ." ".&mt('Text Block')." | " .''.&mt('Delete?').' ' .&Apache::edit::deletelist($target,$token) .' | ' - .'' - .&Apache::lonhtmlcommon::dragmath_button($areaid,1) - .' | ' + .''; + if ($env{'environment.nocodemirror'}) { + $result.=&Apache::lonhtmlcommon::dragmath_button($areaid,1); + } else { + $result.=' '; + } + $result.=' | ' .'' .&Apache::edit::insertlist($target,$token) .' | '