--- loncom/interface/lonmenu.pm 2022/05/30 15:40:15 1.369.2.83.2.3 +++ loncom/interface/lonmenu.pm 2022/07/08 16:08:05 1.369.2.83.2.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.369.2.83.2.3 2022/05/30 15:40:15 raeburn Exp $ +# $Id: lonmenu.pm,v 1.369.2.83.2.4 2022/07/08 16:08:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -822,7 +822,8 @@ sub registerurl { } sub innerregister { - my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname) = @_; + my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname, + $ltiscope,$ltiuri,$showncrumbsref) = @_; my $const_space = ($env{'request.state'} eq 'construct'); my $is_const_dir = 0; @@ -919,14 +920,17 @@ sub innerregister { if ($env{'form.folderpath'}) { &prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname); ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); } else { &Apache::lonhtmlcommon::add_breadcrumb( {text => "Supplemental $crstype Content", href => "javascript:gopost('/adm/supplemental','')"}); $title = &mt('View Resource'); ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); + } + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; } return $trail; } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) { @@ -935,7 +939,10 @@ sub innerregister { $forcereg,$group,undef,undef,1,$hostname); $title = &mt('Syllabus File'); my ($trail) = - &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,$hostname); + &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1); + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; + } return $trail; } unless ($env{'request.state'} eq 'construct') { @@ -1193,6 +1200,10 @@ ENDMENUITEMS } } } + my $linkprotout; + if ($env{'request.deeplink.login'}) { + $linkprotout = &linkprot_exit(); + } if ($noremote) { my $addremote=0; foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} } @@ -1218,11 +1229,17 @@ ENDMENUITEMS if ($countdown) { &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$countdown); } + if ($linkprotout) { + &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); + } } else { my @tools = @inlineremote[93,91,81,82,83]; if ($countdown) { unshift(@tools,$countdown); } + if ($linkprotout) { + unshift(@tools,$linkprotout); + } &Apache::lonhtmlcommon::add_breadcrumb_tool( 'tools',@tools); @@ -1236,6 +1253,10 @@ ENDMENUITEMS } &advtools_crumbs(@inlineremote); } + } else { + if ($linkprotout) { + &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); + } } my ($topic_help,$topic_help_text); if ($is_const_dir == 2) { @@ -1247,6 +1268,9 @@ ENDMENUITEMS $topic_help_text = 'About WebDAV access'; } } + if (ref($showncrumbsref)) { + $$showncrumbsref = 1; + } return &Apache::lonhtmlcommon::scripttag('', 'start') . &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'','','','',$topic_help,$topic_help_text) . &Apache::lonhtmlcommon::scripttag('', 'end'); @@ -3428,6 +3452,94 @@ END } } return; +} + +sub linkprot_exit { + if (($env{'request.course.id'}) && ($env{'request.deeplink.login'})) { + my ($deeplink_symb,$deeplink); + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + if (($cnum ne '') && ($cdom ne '')) { + $deeplink_symb = &Apache::loncommon::deeplink_login_symb($cnum,$cdom); + if ($deeplink_symb) { + if ($deeplink_symb =~ /\.(page|sequence)$/) { + my $mapname = &Apache::lonnet::deversion((&Apache::lonnet::decode_symb($deeplink_symb))[2]); + my $navmap = Apache::lonnavmaps::navmap->new(); + if (ref($navmap)) { + $deeplink = $navmap->get_mapparam(undef,$mapname,'0.deeplink'); + } + } else { + $deeplink = &Apache::lonnet::EXT('resource.0.deeplink',$deeplink_symb); + } + if ($deeplink ne '') { + my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink); + my %lt = &Apache::lonlocal::texthash( + title => 'Exit Tool', + okdone => 'Click "OK" to exit embedded tool', + cancel => 'Click "Cancel" to continue working.', + ok => 'OK', + exit => 'Cancel', + ); + if ($exit) { + my ($show,$text) = split(/:/,$exit); + unless ($show eq 'no') { + my $height = 250; + my $width = 300; + my $exitbuttontext; + if ($text eq '') { + $exitbuttontext = &mt('Exit Tool'); + } else { + $exitbuttontext = $text; + } + return < + + + + +
+

$lt{'okdone'} $lt{'cancel'}

+
+ + + +END + } + } + } + } + } + } + return; } # ================================================================ Main Program