--- loncom/interface/lonmenu.pm 2019/02/06 18:52:54 1.369.2.71.4.6
+++ loncom/interface/lonmenu.pm 2018/09/03 14:30:16 1.369.2.72
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.369.2.71.4.6 2019/02/06 18:52:54 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.72 2018/09/03 14:30:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -499,6 +499,8 @@ sub secondary_menu {
next if ($item->[2] eq 'mgr' && !$canmgr);
next if ($item->[2] eq 'vcg' && !$canviewgrps);
next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor);
+ next if ($item->[2] eq 'author' && !$author);
+ next if ($item->[2] eq 'cca' && !$canmodifycoauthor);
push(@scndsub,$item);
}
}
@@ -528,6 +530,7 @@ sub secondary_menu {
} else {
$$menuitem[0] =~ s{\?register=1}{};
}
+ $$menuitem[0] = &HTML::Entities::encode($$menuitem[0],'&<>"');
}
$menu .= &prep_menuitem(\@$menuitem);
}
@@ -635,6 +638,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 =~ /^\#/)) {
$target = ' target="_top"';
@@ -699,31 +716,21 @@ sub innerregister {
$newmail= 'swmenu.setstatus("you have","messages");';
}
- my ($mapurl,$resurl,$navmap);
+ my ($mapurl,$resurl);
if ($env{'request.course.id'}) {
-#
-#course_type: Course or Community
-#
if ($env{'request.symb'}) {
- my $ignorenull;
- unless ($env{'request.noversionuri'} eq '/adm/navmaps') {
- $ignorenull = 1;
- }
- my $symb = &Apache::lonnet::symbread('','',$ignorenull);
- ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb($symb);
+ ($mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
my $maptitle = &Apache::lonnet::gettitle($mapurl);
- my $restitle = &Apache::lonnet::gettitle($symb);
+ my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
- my (@crumbs,@mapcrumbs);
- if (($env{'request.noversionuri'} ne '/adm/navmaps') && ($mapurl ne '')) {
- $navmap = Apache::lonnavmaps::navmap->new();
- if (ref($navmap)) {
- @mapcrumbs = $navmap->recursed_crumbs($mapurl,$restitle);
- }
- }
+
+#SD
+#course_type only Course and Community?
+#
+ my @crumbs;
unless (($forcereg) &&
($env{'request.noversionuri'} eq '/adm/navmaps') &&
($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
@@ -732,21 +739,15 @@ sub innerregister {
href => "Javascript:gopost('/adm/navmaps','')"});
}
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
- if (@mapcrumbs) {
- push(@crumbs,@mapcrumbs);
- } else {
- push(@crumbs, {text => '...',
- no_mt => 1});
- }
+ push(@crumbs, {text => '...',
+ no_mt => 1});
}
- unless ((@mapcrumbs) || (!$maptitle) || ($maptitle eq 'default.sequence') ||
- ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
- push @crumbs, {text => $maptitle, no_mt => 1, href => $mapurl};
- }
- if ($restitle && !@mapcrumbs) {
- push(@crumbs,{text => $restitle, no_mt => 1});
- }
+ push @crumbs, {text => $maptitle, no_mt => 1} if ($maptitle
+ && $maptitle ne 'default.sequence'
+ && $maptitle ne $coursetitle);
+
+ push @crumbs, {text => $restitle, no_mt => 1} if $restitle;
my @tools;
if ($env{'request.filename'} =~ /\.page$/) {
my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
@@ -981,10 +982,10 @@ if ($env{'browser.mobile'}) {
$is_mobile = 1;
}
- unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio|ext\.tool)(\?|$)/) {
+ unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/}) && ($env{'request.noversionuri'} !~ m{^/uploaded/$match_domain/$match_courseid/docs/})) {
$menuitems.=(< ';
- if ($type eq 'map') {
- $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing);
- } else {
- $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing);
- }
- if ($missing > 1) {
- $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').'';
- } else {
- $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').' $lt{'preamble'} $lt{$type} $lt{'proctor'} $lt{'cancel'}
';
- }
- return < $lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'}