--- loncom/interface/loncommon.pm 2024/10/05 22:53:27 1.1075.2.169 +++ loncom/interface/loncommon.pm 2024/10/08 19:30:17 1.1075.2.173 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.169 2024/10/05 22:53:27 raeburn Exp $ +# $Id: loncommon.pm,v 1.1075.2.173 2024/10/08 19:30:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -5820,46 +5820,68 @@ sub bodytag { unless (ref($args->{'bread_crumbs'}) eq 'ARRAY') { $funclist = $forbodytag; } + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); } else { # if ($env{'request.state'} eq 'construct') { # $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls # } - $bodytag .= Apache::lonhtmlcommon::scripttag( - Apache::lonmenu::utilityfunctions($httphost), 'start'); + my $need_endlcint; + unless ($args->{'switchserver'}) { + $bodytag .= Apache::lonhtmlcommon::scripttag( + Apache::lonmenu::utilityfunctions($httphost), 'start'); + $need_endlcint = 1; + } - my ($left,$right) = Apache::lonmenu::primary_menu($args->{'links_disabled'}); + if (($env{'environment.remote'} eq 'on') && ($env{'request.state'} eq 'construct')) { + unless ($env{'form.inhibitmenu'}) { + $bodytag .= &inline_for_remote($public,$role,$realm,$dc_info,$no_inline_link); + } + } else { + my ($left,$right) = Apache::lonmenu::primary_menu($args->{'links_disabled'}); - if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { - if ($dc_info) { - $dc_info = qq|$dc_info|; + if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { + if ($dc_info) { + $dc_info = qq|$dc_info|; + } + $bodytag .= qq|
$left $role
+ $realm $dc_info
|; + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } + return $bodytag; } - $bodytag .= qq|
$left $role
- $realm $dc_info
|; - return $bodytag; - } - unless ($env{'request.symb'} =~ m/\.page___\d+___/) { - $bodytag .= qq|
$left $role
|; - } + unless ($env{'request.symb'} =~ m/\.page___\d+___/) { + $bodytag .= qq|
$left $role
|; + } - $bodytag .= $right; + $bodytag .= $right; - if ($dc_info) { - $dc_info = &dc_courseid_toggle($dc_info); + if ($dc_info) { + $dc_info = &dc_courseid_toggle($dc_info); + } + $bodytag .= qq|
$realm $dc_info
|; } - $bodytag .= qq|
$realm $dc_info
|; #if directed to not display the secondary menu, don't. if ($args->{'no_secondary_menu'}) { + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } return $bodytag; } #don't show menus for public users if (!$public){ - $bodytag .= Apache::lonmenu::secondary_menu($httphost,$args->{'links_disabled'}); + unless (($env{'environment.remote'} eq 'on') && + ($env{'request.state'} eq 'construct')) { + $bodytag .= Apache::lonmenu::secondary_menu($httphost,$args->{'links_disabled'}); + } $bodytag .= Apache::lonmenu::serverform(); - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::innerregister($forcereg, $args->{'bread_crumbs'},'','',$hostname); @@ -5879,11 +5901,13 @@ sub bodytag { $bodytag .= $forbodytag; } } - }else{ - # this is to seperate menu from content when there's no secondary + } else { + # this is to separate menu from content when there's no secondary # menu. Especially needed for public accessible ressources. $bodytag .= '
'; - $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + if ($need_endlcint) { + $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); + } } return $bodytag; @@ -5893,18 +5917,17 @@ sub bodytag { # Top frame rendering, Remote is up # - my $imgsrc = $img; - if ($img =~ /^\/adm/) { - $imgsrc = &lonhttpdurl($img); + my $linkattr; + if ($args->{'links_disabled'}) { + $linkattr = 'class="LCisDisabled" aria-disabled="true"'; } - my $upperleft=''.$function.''; my $help=($no_inline_link?'' - :&Apache::loncommon::top_nav_help('Help')); + :&top_nav_help('Help',$linkattr)); # Explicit link to get inline menu my $menu= ($no_inline_link?'' - :''.&mt('Switch to Inline Menu Mode').''); + :''.&mt('Switch to Inline Menu Mode').''); if ($dc_info) { $dc_info = qq|($dc_info)|; @@ -5912,20 +5935,46 @@ sub bodytag { my $name = &plainname($env{'user.name'},$env{'user.domain'}); unless ($public) { + my $class = 'LC_menubuttons_link'; + if ($args->{'links_disabled'}) { + $class .= ' LCisDisabled'; + } $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'}, - undef,'LC_menubuttons_link'); + undef,$class); } unless ($env{'form.inhibitmenu'}) { - $bodytag .= qq|
$name $role
-
    -
  1. $help
  2. -
  3. $menu
  4. -
$realm $dc_info
|; + $bodytag .= &inline_for_remote($public,$role,$realm,$dc_info,$no_inline_link); } return $bodytag."\n".$funclist; } +sub inline_for_remote { + my ($public,$role,$realm,$dc_info,$no_inline_link) = @_; + my $help=($no_inline_link?'' + :&Apache::loncommon::top_nav_help('Help')); + + # Explicit link to get inline menu + my $menu= ($no_inline_link?'' + :''.&mt('Switch to Inline Menu Mode').''); + + if ($dc_info) { + $dc_info = qq|($dc_info)|; + } + + my $name = &plainname($env{'user.name'},$env{'user.domain'}); + unless ($public) { + $name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'}, + undef,'LC_menubuttons_link'); + } + + return qq|
$name $role
+
    +
  1. $help
  2. +
  3. $menu
  4. +
$realm $dc_info
|; +} + sub dc_courseid_toggle { my ($dc_info) = @_; return ' '. @@ -8096,7 +8145,7 @@ sub headtag { $inhibitprint = &print_suppression(); } - if (!$args->{'frameset'}) { + if (!$args->{'frameset'} && !$args->{'switchserver'}) { $result .= &Apache::lonhtmlcommon::htmlareaheaders(); } if ($args->{'force_register'}) { @@ -8104,7 +8153,8 @@ sub headtag { } if (!$args->{'no_nav_bar'} && !$args->{'only_body'} - && !$args->{'frameset'}) { + && !$args->{'frameset'} + && !$args->{'switchserver'}) { $result .= &help_menu_js($httphost); $result.=&modal_window(); $result.=&togglebox_script();