[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
raeburn
raeburn at source.lon-capa.org
Wed Mar 23 12:39:47 EDT 2022
raeburn Wed Mar 23 16:39:47 2022 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
- Bug 6969
Don't call &storeparm() for a user-specific parameter if $uname is null.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.604 loncom/interface/lonparmset.pm:1.605
--- loncom/interface/lonparmset.pm:1.604 Mon Feb 21 18:04:35 2022
+++ loncom/interface/lonparmset.pm Wed Mar 23 16:39:47 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.604 2022/02/21 18:04:35 raeburn Exp $
+# $Id: lonparmset.pm,v 1.605 2022/03/23 16:39:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3392,6 +3392,7 @@
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
my ($got_chostname,$chostname,$cmajor,$cminor);
my $totalstored = 0;
+ my $totalskippeduser = 0;
my $now = time;
for (my $i=0;$i<=$#markers;$i++) {
my ($needsrelease,$needsnewer,$name,$namematch);
@@ -3400,6 +3401,11 @@
}
if ($markers[$i] =~ /\&(8|7|6|5)$/) {
next if ($noeditgrp);
+ } elsif ($markers[$i] =~ /\&(4|3|2|1)$/) {
+ if ($uname eq '') {
+ $totalskippeduser ++;
+ next;
+ }
}
if ($markers[$i] =~ /\&(17|11|7|3)$/) {
$namematch = 'maplevelrecurse';
@@ -3538,9 +3544,27 @@
# ---------------------------------------------------------------- Done storing
if ($totalstored) {
$message.='<p class="LC_warning">'
+ .&mt('Changes for [quant,_1,parameter] saved.',$totalstored)
+ .'<br />'
.&mt('Changes can take up to 10 minutes before being active for all students.')
.&Apache::loncommon::help_open_topic('Caching')
.'</p>';
+ } else {
+ $message.='<p class="LC_info">'.&mt('No parameter changes saved.').'</p>';
+ }
+ if ($totalskippeduser) {
+ $message .= '<p class="LC_warning">';
+ if ($uhome eq 'no_host') {
+ $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the username or ID was invalid.',
+ $totalskippeduser);
+ } elsif ($env{'form.userroles'} eq 'any') {
+ $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user does not have a course role.',
+ $totalskippeduser);
+ } else {
+ $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user is not a student.',
+ $totalskippeduser);
+ }
+ $message .= '</p>';
}
}
More information about the LON-CAPA-cvs
mailing list