--- loncom/interface/lonmenu.pm 2023/11/03 01:12:15 1.541
+++ loncom/interface/lonmenu.pm 2025/03/25 01:02:59 1.562
@@ -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.562 2025/03/25 01:02:59 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'
@@ -796,7 +817,7 @@ sub create_submenu {
my $menu = ''.
''.
''.$title.
- ''.
+ ''.
' ▼ '.
'';
@@ -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 ''; }
@@ -1089,17 +1110,17 @@ sub innerregister {
if ($perms{'mgr'}) {
&switch('','',7,2,'pgrd.png','Content Grades','grades[_4]',
"gocmd('/adm/grades','gradingmenu')",
- 'Content Grades');
+ 'Grading for Resource/Folder');
} elsif ($perms{'vgr'}) {
&switch('','',7,2,'subm.png','Content Submissions','missions[_1]',
"gocmd('/adm/grades','submission')",
- 'Content Submissions');
+ 'Submissions for Resource/Folder');
}
}
if (($env{'request.symb'} ne '') && (($perms{'opa'}) || ($perms{'vpa'}))) {
&switch('','',7,3,'pparm.png','Content Settings','parms[_2]',
"gocmd('/adm/parmset','set')",
- 'Content Settings');
+ 'Content Settings for Resource/Folder');
}
# End grades/submissions check
@@ -1126,11 +1147,13 @@ sub innerregister {
if (($env{'request.symb'} ne '') &&
($env{'request.filename'}=~/$LONCAPA::assess_re/) &&
(($perms{'mgr'}) || ($perms{'vgr'}))) {
- my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$defdom,
- $domselector,$righticon);
+ my ($viewas,$text,$change,$visibility,$vuname,$vudom,$vid,$leftvis,$rightvis,
+ $defdom,$domselector,$righticon);
my %lt = &Apache::lonlocal::texthash(
view => 'View',
upda => 'Update',
+ user => 'View as user',
+ choo => 'Choose user',
);
my $possdomstr = $env{'course.'.$env{'request.course.id'}.'.internal.userdomains'};
if ($possdomstr =~ /,/) {
@@ -1142,7 +1165,10 @@ sub innerregister {
} elsif (&Apache::lonnet::domain($possdoms[0]) ne '') {
$defdom = $possdoms[0];
}
- $domselector = &Apache::loncommon::select_dom_form($defdom,'vudom','','','',\@possdoms);
+ $domselector = &Apache::loncommon::select_dom_form($defdom,'vudom','','','',
+ \@possdoms,'','','vudom').
+ ''.
+ &mt("user's domain").' ';
} elsif (($possdomstr ne '') && (&Apache::lonnet::domain($possdomstr) ne '')) {
if ($env{'request.user_in_effect'} =~ /^$match_username:($match_domain)$/) {
$defdom = $1;
@@ -1160,6 +1186,7 @@ sub innerregister {
$change = 'off';
$visibility = 'inline';
$leftvis = 'none';
+ $rightvis = 'inline';
$defdom = $vudom;
$righticon = '✖';
} else {
@@ -1167,6 +1194,8 @@ sub innerregister {
$change = 'on';
$visibility = 'none';
$leftvis = 'inline';
+ $rightvis = 'none';
+ $righticon = '◄';
if ($defdom eq '') {
$defdom = $cdom;
}
@@ -1191,11 +1220,14 @@ sub innerregister {
$input .= ' ',
' ';
my $chooser = <
+$lt{'user'}
+
$selscript
-
+
-
+$lt{'choo'}
-
END
&switch('','',7,5,'viewuser.png','View As','user[_1]',
'toggleViewAsUser('."'$change'".')',
- 'View As','','',$chooser);
+ 'View resource as user','','',$chooser);
}
# End view as user check
@@ -1218,8 +1250,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 +1259,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=(< ';
if ($env{'browser.interface'} eq 'faketextual') {
# Main Menu
- if ($nobreak==3) {
- $inlineremote[$idx]="\n".
- ''.
- ''.$pic.' ';
- } elsif ($nobreak) {
- $inlineremote[$idx]="\n".
- ''.
- ''.$pic.'
- ';
- } else {
- $inlineremote[$idx]="\n ".
- ''.
- ''.$pic.
- ' ';
- }
+ $inlineremote[$idx] = {
+ linktext => $desc,
+ url => 'javascript:'.$act,
+ permission => 'F',
+ icon => $img,
+ alttext => $alttext,
+ linktitle => '',
+ };
} else {
# Inline Menu
my @tools = (93,91,81,82,83);
@@ -1904,9 +2003,10 @@ sub switch {
$inlineremote[$idx] =
'';
} else {
+ my $linktext = &mt($top);
$inlineremote[$idx] =
''.$form;
+ ''.$form;
}
}
return '';
@@ -1931,32 +2031,33 @@ sub inlinemenu {
undef(%category_members);
# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
&rawconfig(1);
- my $output='';
+ my $output;
for (my $col=1; $col<=2; $col++) {
- $output.='';
+ $output .= ''."\n";
for (my $row=1; $row<=8; $row++) {
foreach my $cat (keys(%category_members)) {
- if ($category_positions{$cat} ne "$col,$row") { next; }
- #$output.='
';
- $output.='';
- $output.='
'.&mt($category_names{$cat}).' ';
- $output.='
';
- my %active=();
- foreach my $menu_item (split(/\:/,$category_members{$cat})) {
- if ($inlineremote[$menu_item]) {
- $active{$menu_item}=1;
- }
- }
- foreach my $item (sort(keys(%active))) {
- $output.=$inlineremote[$item];
- }
- $output.='
';
- $output.='
';
+ my @menu = ({ categorytitle=>&mt($category_names{$cat}),
+ listclass=>'LC_ListStyleMainMenu',
+ boxclass=>'LC_MainMenu_Box',
+ items =>[],});
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ my %active=();
+ foreach my $menu_item (split(/\:/,$category_members{$cat})) {
+ if ($inlineremote[$menu_item]) {
+ $active{$menu_item}=1;
+ }
+ }
+ foreach my $item (sort(keys(%active))) {
+ push(@{ $menu[0]->{items} }, $inlineremote[$item]);
+ }
+ if (@{$menu[0]->{items}} > 0) {
+ $output .= &Apache::lonhtmlcommon::generate_menu(@menu);
+ }
}
- }
- $output.="";
+ }
+ $output.="";
}
- $output.="
";
+ $output .= '
'."\n";
return $output;
}
@@ -2490,13 +2591,13 @@ function toggleViewAsUser(change) {
if ((document.getElementById('usexpand')) && (document.getElementById('uscollapse'))) {
if (currstyle == 'inline') {
seluserid.style.display = 'none';
- document.getElementById('usexpand').innerHTML='► ';
- document.getElementById('uscollapse').innerHTML='';
+ document.getElementById('usexpand').style.display= 'inline';
+ document.getElementById('uscollapse').style.display = 'none';
} else {
seluserid.style.display = 'inline';
- document.getElementById('usexpand').innerHTML='';
- document.getElementById('uscollapse').innerHTML='◄ ';
toggleIdentifier(document.userview);
+ document.getElementById('usexpand').style.display = 'none';
+ document.getElementById('uscollapse').style.display = 'inline';
}
}
}
@@ -2550,16 +2651,21 @@ function validCourseUser(form,change) {
function toggleIdentifier(form) {
if ((document.getElementById('LC_vuname')) && (document.getElementById('LC_vid'))) {
+ var identifylabel = document.getElementById('LC_vuidentifier');
+ var identifier;
+ var userbyuname;
var radioelem = form.elements['vuidentifier'];
if (radioelem.length > 0) {
var i;
for (i=0; i
+
ENDSERVERFORM
}
@@ -3033,7 +3153,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 +3653,7 @@ $donebutton
-
+