--- loncom/interface/loncommon.pm 2024/07/31 22:14:33 1.1075.2.168 +++ loncom/interface/loncommon.pm 2024/10/07 21:20:09 1.1075.2.172 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.168 2024/07/31 22:14:33 raeburn Exp $ +# $Id: loncommon.pm,v 1.1075.2.172 2024/10/07 21:20:09 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,12 +5917,6 @@ sub bodytag { # Top frame rendering, Remote is up # - my $imgsrc = $img; - if ($img =~ /^\/adm/) { - $imgsrc = &lonhttpdurl($img); - } - my $upperleft=''.$function.''; - my $help=($no_inline_link?'' :&Apache::loncommon::top_nav_help('Help')); @@ -5917,26 +5935,37 @@ sub bodytag { } unless ($env{'form.inhibitmenu'}) { - $bodytag .= qq|
$name $role
-
    -
  1. $help
  2. -
  3. $menu
  4. -
$realm $dc_info
|; - } - if ($env{'request.state'} eq 'construct') { - if (!$public){ - if ($env{'request.state'} eq 'construct') { - $funclist = &Apache::lonhtmlcommon::scripttag( - &Apache::lonmenu::utilityfunctions($httphost), 'start'). - &Apache::lonhtmlcommon::scripttag('','end'). - &Apache::lonmenu::innerregister($forcereg, - $args->{'bread_crumbs'}); - } - } + $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 ' '. @@ -8107,7 +8136,7 @@ sub headtag { $inhibitprint = &print_suppression(); } - if (!$args->{'frameset'}) { + if (!$args->{'frameset'} && !$args->{'switchserver'}) { $result .= &Apache::lonhtmlcommon::htmlareaheaders(); } if ($args->{'force_register'}) { @@ -8115,7 +8144,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();