--- loncom/interface/lonmenu.pm 2023/10/06 02:16:46 1.369.2.83.2.11
+++ loncom/interface/lonmenu.pm 2024/01/02 14:14:47 1.369.2.83.2.16
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369.2.83.2.11 2023/10/06 02:16:46 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.83.2.16 2024/01/02 14:14:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -370,6 +370,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]});
}
@@ -1221,7 +1234,7 @@ $sellink
END
&switch('','',7,5,'viewuser.png','View As','user[_1]',
'toggleViewAsUser('."'$change'".')',
- 'View As','','',$chooser);
+ 'View As','','','',$chooser);
}
# End view as user check
@@ -1256,8 +1269,16 @@ s&6&1&list.png&Directory&dir[_1]&golist(
s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version
s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource
s&7&1&del.png&Delete&resource[_2]&gocstr('/adm/cfile?action=delete','/priv/$udom/$uname/$cleandisfn')&Delete this resource
+ENDMENUITEMS
+
+#
+# Print only makes sense for certain mime types
+#
+ if ($thisdisfn=~/\.(xml|html|htm|xhtml|xhtm|tex)$/ || $thisdisfn=~/$LONCAPA::assess_re/) {
+ $menuitems .= (<';
$inlineremote[$idx] =
''.$form;
+ $pic.'';
}
# Remote
$img=~s/\.png$/\.gif/;
@@ -2187,7 +2208,7 @@ sub switch {
} else {
$inlineremote[$idx] =
'';
+ ''.$form;
}
}
return '';