--- loncom/interface/lonmenu.pm 2018/04/15 00:28:07 1.487 +++ loncom/interface/lonmenu.pm 2018/04/27 22:07:11 1.489 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.487 2018/04/15 00:28:07 raeburn Exp $ +# $Id: lonmenu.pm,v 1.489 2018/04/27 22:07:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -405,6 +405,7 @@ sub secondary_menu { my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec); my $canvgr = &Apache::lonnet::allowed('vgr', $crs_sec); my $canmgr = &Apache::lonnet::allowed('mgr', $crs_sec); + my $canplc = &Apache::lonnet::allowed('plc', $crs_sec); my $author = &getauthor(); my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv,$grouptools); @@ -488,6 +489,8 @@ sub secondary_menu { && !$showsyllabus; next if $$menuitem[4] eq 'showfeeds' && !$showfeeds; + next if $$menuitem[4] eq 'plc' + && !$canplc; next if $$menuitem[4] eq 'author' && !$author; next if $$menuitem[4] eq 'cca' @@ -582,6 +585,7 @@ sub secondary_menu { } $menu =~ s/\[uname\]/$$author{user}/g; $menu =~ s/\[udom\]/$$author{dom}/g; + $menu =~ s/\[javascript\]/javascript:/; if ($env{'request.course.id'}) { $menu =~ s/\[cnum\]/$cnum/g; $menu =~ s/\[cdom\]/$cdom/g; @@ -665,6 +669,20 @@ sub build_submenu { next unless (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')); $href =~ s/\[domain\]/$env{'user.domain'}/g; $href =~ s/\[user\]/$env{'user.name'}/g; + } elsif (($href =~ m{^/adm/preferences\?}) && ($href =~ /\[returnurl\]/)) { + my $returnurl = $ENV{'REQUEST_URI'}; + if ($ENV{'REQUEST_URI'} =~ m{/adm/preferences\?action=(?:changedomcoord|authorsettings)\&returnurl=([^\&]+)$}) { + $returnurl = $1; + } + if (($returnurl =~ m{^/adm/createuser($|\?action=)}) || + ($returnurl =~ m{^/priv/$match_domain/$match_username}) || + ($returnurl =~ m{^/res(/?$|/$match_domain/$match_username)})) { + $returnurl =~ s{\?.*$}{}; + $returnurl = '&returnurl='.&HTML::Entities::encode($returnurl,'"<>&\''); + } else { + undef($returnurl); + } + $href =~ s/\[returnurl\]/$returnurl/; } unless (($href eq '') || ($href =~ /^\#/)) { if ($target eq '_top') {