--- loncom/interface/loncommon.pm 2022/05/31 23:11:47 1.1075.2.161.2.7 +++ loncom/interface/loncommon.pm 2022/07/08 16:01:54 1.1075.2.161.2.8 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.161.2.7 2022/05/31 23:11:47 raeburn Exp $ +# $Id: loncommon.pm,v 1.1075.2.161.2.8 2022/07/08 16:01:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5898,6 +5898,21 @@ Inputs: context, this will contain a reference to hash of items to be included in the page header and/or inline menu. +=item * $menucoll, optional argument, if specific menu collection is in + effect, either set as the default for the course, or set for + the deeplink paramater for $env{'request.deeplink.login'} + then $menucoll will be the number of that collection. + +=item * $menuref, optional argument, reference to a hash, containing the + menu options included for the menu in effect, based on the + configuration for the numbered menu collection in use. + +=item * $showncrumbsref, reference to a scalar. Calls to lonmenu::innerregister + within &bodytag() can result in calls to lonhtmlcommon::breadcrumbs(), + if so, $showncrumbsref is set there to 1, and will propagate back + via &bodytag() to &start_page(), to prevent lonhtmlcommon::breadcrumbs() + being called a second time. + =back Returns: A uniform header for LON-CAPA web pages. @@ -5910,7 +5925,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg, $no_nav_bar,$bgcolor,$no_inline_link,$args,$advtoolsref, - $ltiscope,$ltiuri,$ltimenu,$menucoll,$menuref)=@_; + $ltiscope,$ltiuri,$ltimenu,$menucoll,$menuref,$showncrumbsref)=@_; my $public; if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) @@ -6103,12 +6118,12 @@ sub bodytag { $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::innerregister($forcereg, - $args->{'bread_crumbs'},'','',$hostname,$ltiscope,$ltiuri); + $args->{'bread_crumbs'},'','',$hostname, + $ltiscope,$ltiuri,$showncrumbsref); } elsif ($forcereg) { $bodytag .= &Apache::lonmenu::innerregister($forcereg,undef, - $args->{'group'}, - $args->{'hide_buttons'}, - $hostname,$ltiscope,$ltiuri); + $args->{'group'},$args->{'hide_buttons'}, + $hostname,$ltiscope,$ltiuri,$showncrumbsref); } else { my $forbodytag; &Apache::lonmenu::prepare_functions($env{'request.noversionuri'}, @@ -8820,6 +8835,7 @@ sub start_page { } } + my $showncrumbs; if (! exists($args->{'skip_phases'}{'body'}) ) { if ($args->{'frameset'}) { my $attr_string = &make_attr_string($args->{'force_register'}, @@ -8833,7 +8849,7 @@ sub start_page { $args->{'force_register'}, $args->{'no_nav_bar'}, $args->{'bgcolor'}, $args->{'no_inline_link'}, $args, \@advtools, - $ltiscope,$ltiuri,\%ltimenu,$menucoll,\%menu); + $ltiscope,$ltiuri,\%ltimenu,$menucoll,\%menu,\$showncrumbs); } } @@ -8855,6 +8871,7 @@ sub start_page { #Breadcrumbs if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) { + unless ($showncrumbs) { &Apache::lonhtmlcommon::clear_breadcrumbs(); #if any br links exists, add them to the breadcrumbs if (exists($args->{'bread_crumbs'}) and ref($args->{'bread_crumbs'}) eq 'ARRAY') { @@ -8874,12 +8891,20 @@ sub start_page { } else { undef($menulink); } + my $linkprotout; + if ($env{'request.deeplink.login'}) { + my $linkprotout = &Apache::lonmenu::linkprot_exit(); + if ($linkprotout) { + &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$linkprotout); + } + } #if bread_crumbs_component exists show it as headline else show only the breadcrumbs if(exists($args->{'bread_crumbs_component'})){ $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'},'',$menulink); } else { $result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink); } + } } elsif (($env{'environment.remote'} eq 'on') && ($env{'form.inhibitmenu'} ne 'yes') && ($env{'request.noversionuri'} =~ m{^/res/}) &&