--- loncom/interface/lonmenu.pm 2023/11/03 01:12:15 1.541
+++ loncom/interface/lonmenu.pm 2025/01/07 22:21:56 1.560
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.541 2023/11/03 01:12:15 raeburn Exp $
+# $Id: lonmenu.pm,v 1.560 2025/01/07 22:21:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -245,7 +245,7 @@ sub prep_menuitem {
# @primary_menu is filled within the BEGIN block of this module with
# entries from mydesk.tab
sub primary_menu {
- my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target) = @_;
+ my ($crstype,$ltimenu,$menucoll,$menuref,$links_disabled,$links_target,$collapsible) = @_;
my (%menu,%ltiexc,%menuopts);
# each element of @primary contains following array:
# (link url, icon path, alt text, link text, condition, position)
@@ -366,6 +366,19 @@ sub primary_menu {
($item->[2] eq 'blog')) &&
(!&Apache::lonnet::usertools_access('','',$item->[2],
undef,'tools')));
+ if (($item->[2] eq 'browsepub') && ($item->[0] eq '/res/')) {
+ if ($env{'request.role'} =~ /^au\./) {
+ $item->[0] .= $env{'request.role.domain'}.'/?launch=1';
+ } elsif ($env{'request.role'} =~ m{^ca\./($match_domain)/($match_username)$}) {
+ $item->[0] .= $1.'/'.$2.'/?launch=1';
+ } elsif (&Apache::lonnet::allowed('bre',$env{'user.domain'})) {
+ $item->[0] .= $env{'user.domain'}.'/?launch=1';
+ } elsif (&Apache::lonnet::allowed('bro','/res/')) {
+ $item->[0] .= '?launch=1';
+ } else {
+ next;
+ }
+ }
if ($env{'request.course.id'} && $menucoll) {
next if ($item->[3]) && (!$menuopts{$item->[3]});
}
@@ -421,6 +434,10 @@ sub primary_menu {
}
my @output = ('','');
if ($menu{'left'} ne '') {
+ if ($collapsible) {
+ $menu{'left'} = ($listclass?'
':'').
+ ' '.$menu{'left'};
+ }
$output[0] = "";
}
if ($menu{'right'} ne '') {
@@ -598,6 +615,10 @@ sub secondary_menu {
&& !$env{'request.course.id'};
next if $$menuitem[4] =~ /^crsedit/
&& (!$canedit && !$canvieweditor);
+ next if $$menuitem[4] eq 'crseditCourse'
+ && ($crstype eq 'Community');
+ next if $$menuitem[4] eq 'crseditCommunity'
+ && ($crstype ne 'Community');
next if $$menuitem[4] eq 'nvgr'
&& ($canvgr || $ltiexc{'grades'});
next if $$menuitem[4] eq 'vgr'
@@ -893,7 +914,7 @@ sub innerregister {
my ($forcereg,$bread_crumbs,$group,$pagebuttonshide,$hostname,
$ltiscope,$ltiuri,$showncrumbsref) = @_;
my $const_space = ($env{'request.state'} eq 'construct');
- my $is_const_dir = 0;
+ my $in_daxe = 0;
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
@@ -1218,8 +1239,8 @@ END
# End course context
# Prepare the rest of the buttons
- my ($menuitems,$got_prt,$got_wishlist,$crsauthor);
- if ($const_space) {
+ my ($menuitems,$got_prt,$got_wishlist,$crsauthor,$toplevel_cstr,$crsauthor_cstr);
+ if ($const_space) {
#
# We are in construction space
#
@@ -1227,17 +1248,15 @@ END
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
my ($udom,$uname,$thisdisfn) =
($env{'request.filename'}=~m{^\Q$londocroot/priv/\E([^/]+)/([^/]+)/(.*)$});
- my $crsauthor;
if (($env{'request.course.id'}) &&
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {
- $crsauthor = 1;
+ $crsauthor_cstr = 1;
}
my $currdir = '/priv/'.$udom.'/'.$uname.'/'.$thisdisfn;
if ($currdir =~ m-/$-) {
- $is_const_dir = 1;
- if (($thisdisfn eq '') && ($crsauthor)) {
- $is_const_dir = 2;
+ if ($thisdisfn eq '') {
+ $toplevel_cstr = 1;
}
my $esc_currdir = &Apache::loncommon::escape_single($currdir);
$menuitems=(<
+
ENDSERVERFORM
}
@@ -3033,7 +3118,7 @@ sub roles_selector {
$js = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,
\%roledesc,$privref,$menucoll,$menuref);
$form =
- ''."\n";
+ $form .= ''."\n".
+ ''."\n";
foreach my $role (@roles_order) {
my $include;
if (defined($courseroles{$role})) {
@@ -3532,7 +3618,7 @@ $donebutton
-
+