--- loncom/homework/structuretags.pm 2023/07/05 20:57:30 1.512.2.24.2.3 +++ loncom/homework/structuretags.pm 2023/09/06 22:46:09 1.512.2.24.2.4 @@ -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.24.2.3 2023/07/05 20:57:30 raeburn Exp $ +# $Id: structuretags.pm,v 1.512.2.24.2.4 2023/09/06 22:46:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -600,7 +600,9 @@ sub page_start { my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser(); my ($path,$multiresp) = &Apache::loncommon::get_turnedin_filepath($symb,$uname,$udom); - if (($is_task) || ($needs_upload)) { + if ($env{'request.user_in_effect'}) { + $form_tag_start .= ' onsubmit="preventDefault();"'; + } elsif (($is_task) || ($needs_upload)) { $form_tag_start .= ' onsubmit="return file_submission_check(this,'."'$path','$multiresp'".');"'; } $form_tag_start.='>'."\n"; @@ -1757,10 +1759,6 @@ sub start_problem { $firstaccres = $is_set; } } - - ($status,$accessmsg,$slot_name,$slot) = - &Apache::lonhomework::check_slot_access('0','problem'); - push (@Apache::inputtags::status,$status); } if ($target eq 'web' || $target eq 'webgrade' || $target eq 'tex' @@ -1768,7 +1766,8 @@ sub start_problem { ($result,$form_tag_start,$probpartlist) = &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval, $name); - } elsif (($target eq 'grade') && ($Apache::lonhomework::type eq 'randomizetry')) { + } elsif ((($target eq 'grade') && ($Apache::lonhomework::type eq 'randomizetry')) || { + ($target eq 'answer')) { my ($symb)= &Apache::lonnet::whichuser(); if ($symb ne '') { my $navmap = Apache::lonnavmaps::navmap->new(); @@ -1781,6 +1780,20 @@ sub start_problem { } } + if (($target eq 'web') && ($env{'request.user_in_effect'})) { + &Apache::lonxml::get_all_text("/problem",$parser,$style); + return $result; + } + + if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || + $target eq 'tex') { + + my ($symb)= &Apache::lonnet::whichuser(); + ($status,$accessmsg,$slot_name,$slot,$ipused) = + &Apache::lonhomework::check_slot_access('0','problem',$symb,$probpartlist); + push (@Apache::inputtags::status,$status); + } + if ($target eq 'tex' and $env{'request.symb'} =~ m/\.page_/) {$result='';} if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval,$target); } @@ -2113,6 +2126,12 @@ sub end_problem { } } $result =~ s/INSERTTEXFRONTMATTERHERE/$frontmatter/; + } elsif ($target eq 'web') { + if ($env{'request.user_in_effect'}) { + &reset_problem_globals('problem'); + $result .= &Apache::lonhtmlcommon::set_compute_end_time(); + return $result; + } } my $status=$Apache::inputtags::status['-1'];