--- loncom/homework/structuretags.pm 2023/09/06 22:46:09 1.512.2.24.2.4 +++ loncom/homework/structuretags.pm 2024/01/13 12:30:59 1.512.2.24.2.8 @@ -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.4 2023/09/06 22:46:09 raeburn Exp $ +# $Id: structuretags.pm,v 1.512.2.24.2.8 2024/01/13 12:30:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -273,7 +273,7 @@ sub homework_js { } return &Apache::loncommon::resize_textarea_js(). &Apache::loncommon::colorfuleditor_js(). - &setmode_javascript(). + &Apache::lonxml::setmode_javascript(). <<"JS"; -ENDSCRIPT -} - sub page_start { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name, $extra_head)=@_; @@ -1383,20 +1368,25 @@ sub needs_linkprot_passback { $lti_in_use = $domlti{$itemnum}; } my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink); - my $passback; - if ($scope eq 'resource') { + my ($passback,$pbscope); + if ($scope eq 'res') { if ($deeplink_symb eq $symb) { $passback = 1; + $pbscope = 'resource'; } } elsif ($scope eq 'map') { if (&Apache::lonnet::clutter($deeplink_map) eq $map) { $passback = 1; + $pbscope = 'nonrec'; + } + } elsif ($scope eq 'rec') { + my @recurseup = &get_map_hierarchy($map,$env{'request.course.id'}); + if (grep(/^\Q$deeplink_map\E$/,@recurseup)) { + $passback = 1; + $pbscope = 'map'; } - } elsif ($scope eq 'recurse') { -#FIXME check if $deeplink_map contains $map - $passback = 1; } - return ($passback,$scope,$deeplink_map,$deeplink_symb,$crsdef,$itemnum,$lti_in_use); + return ($passback,$pbscope,$deeplink_map,$deeplink_symb,$crsdef,$itemnum,$lti_in_use); } } } @@ -1766,8 +1756,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')) || { - ($target eq 'answer')) { + } 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(); @@ -1789,7 +1779,7 @@ sub start_problem { $target eq 'tex') { my ($symb)= &Apache::lonnet::whichuser(); - ($status,$accessmsg,$slot_name,$slot,$ipused) = + ($status,$accessmsg,$slot_name,$slot) = &Apache::lonhomework::check_slot_access('0','problem',$symb,$probpartlist); push (@Apache::inputtags::status,$status); } @@ -2246,7 +2236,8 @@ ENDJS # computation: # if ($target eq 'web') { - $result .= &Apache::lonhtmlcommon::set_compute_end_time(); + $result .= &Apache::lonhtmlcommon::dash_to_minus_js(). + &Apache::lonhtmlcommon::set_compute_end_time(); # # Closing tags delayed so any tags # not in head can appear inside body, for valid xhtml.