--- loncom/interface/loncommon.pm 2024/08/22 17:05:49 1.1075.2.161.2.26 +++ loncom/interface/loncommon.pm 2024/10/06 20:12:05 1.1075.2.161.2.30 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1075.2.161.2.26 2024/08/22 17:05:49 raeburn Exp $ +# $Id: loncommon.pm,v 1.1075.2.161.2.30 2024/10/06 20:12:05 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3452,6 +3452,21 @@ sub passwd_validation_js { } else { $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; } + } elsif ($context eq 'ltitools') { + my %domconfig = &Apache::lonnet::get_dom('configuration',['toolsec'],$domain); + if (ref($domconfig{'toolsec'}) eq 'HASH') { + if (ref($domconfig{'toolsec'}{'rules'}) eq 'HASH') { + %passwdconf = %{$domconfig{'toolsec'}{'rules'}}; + } + } + if ($id eq 'add') { + $alertmsg = &mt('Secret for added external tool did not satisfy requirement(s):').'\n\n'; + } elsif ($id =~ /^\d+$/) { + my $pos = $id+1; + $alertmsg = &mt('Secret for external tool [_1] did not satisfy requirement(s):','#'.$pos).'\n\n'; + } else { + $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; + } } else { %passwdconf = &Apache::lonnet::get_passwdconf($domain); $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; @@ -6445,7 +6460,11 @@ sub bodytag {
END } - unless ($args->{'no_primary_menu'}) { + 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); + } + } elsif (!$args->{'no_primary_menu'}) { my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref, $args->{'links_disabled'}, $args->{'links_target'}, @@ -6477,7 +6496,9 @@ END } #don't show menus for public users if (!$public){ - unless ($args->{'no_inline_menu'}) { + unless (($args->{'no_inline_menu'}) || + (($env{'environment.remote'} eq 'on') && + ($env{'request.state'} eq 'construct'))) { $bodytag .= Apache::lonmenu::secondary_menu($httphost,$ltiscope,$ltimenu, $args->{'no_primary_menu'}, $menucoll,$menuref, @@ -6523,12 +6544,6 @@ END # 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')); @@ -6547,26 +6562,37 @@ END } 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 ' '. @@ -9296,6 +9322,11 @@ $args - additional optional args support no_auto_mt_title -> prevent &mt()ing the title arg bread_crumbs -> Array containing breadcrumbs bread_crumbs_component -> if exists show it as headline else show only the breadcrumbs + bread_crumbs_style -> breadcrumbs are contained within
, + and &standard_css() contains CSS for #LC_breadcrumbs, if you want + to override those values, or add to them, specify the value to + include in the style attribute to include in the div tag by using + bread_crumbs_style (e.g., overflow: visible) bread_crumbs_nomenu -> if true will pass false as the value of $menulink to lonhtmlcommon::breadcrumbs group -> includes the current group, if page is for a @@ -9461,9 +9492,12 @@ sub start_page { } #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); + $result .= &Apache::lonhtmlcommon::breadcrumbs($args->{'bread_crumbs_component'}, + '',$menulink,'', + $args->{'bread_crumbs_style'}); } else { - $result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink); + $result .= &Apache::lonhtmlcommon::breadcrumbs('','',$menulink,'', + $args->{'bread_crumbs_style'}); } } } elsif (($env{'environment.remote'} eq 'on') && @@ -17302,8 +17336,8 @@ sub init_user_environment { my %is_adv = ( is_adv => $env{'user.adv'} ); my %domdef = &Apache::lonnet::get_domain_defaults($domain); - foreach my $tool ('aboutme','blog','webdav','portfolio','timezone') { - $userenv{'availabletools.'.$tool} = + foreach my $tool ('aboutme','blog','webdav','portfolio','portaccess','timezone') { + $userenv{'availabletools.'.$tool} = &Apache::lonnet::usertools_access($username,$domain,$tool,'reload', undef,\%userenv,\%domdef,\%is_adv); }