[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Wed Nov 30 20:24:53 EST 2022
raeburn Thu Dec 1 01:24:53 2022 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- When commit_customrole() or commit_standardrole() are called in list
context, both the result of assignrole() calls (e.g., ok) and a more verbose
logging-type message will be returned.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1398 loncom/interface/loncommon.pm:1.1399
--- loncom/interface/loncommon.pm:1.1398 Thu Nov 24 00:49:48 2022
+++ loncom/interface/loncommon.pm Thu Dec 1 01:24:53 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1398 2022/11/24 00:49:48 raeburn Exp $
+# $Id: loncommon.pm,v 1.1399 2022/12/01 01:24:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -16370,26 +16370,29 @@
sub commit_customrole {
my ($udom,$uname,$url,$three,$four,$five,$start,$end,$context) = @_;
+ my $result = &Apache::lonnet::assigncustomrole(
+ $udom,$uname,$url,$three,$four,$five,$end,$start,undef,undef,$context);
my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.':'.$three.' in '.$url.
($start?', '.&mt('starting').' '.localtime($start):'').
- ($end?', ending '.localtime($end):'').': <b>'.
- &Apache::lonnet::assigncustomrole(
- $udom,$uname,$url,$three,$four,$five,$end,$start,undef,undef,$context).
- '</b><br />';
- return $output;
+ ($end?', ending '.localtime($end):'').': <b>'.$result.'</b><br />';
+ if (wantarray) {
+ return ($output,$result);
+ } else {
+ return $output;
+ }
}
sub commit_standardrole {
my ($udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context,$credits) = @_;
- my ($output,$logmsg,$linefeed);
+ my ($output,$logmsg,$linefeed,$result);
if ($context eq 'auto') {
$linefeed = "\n";
} else {
$linefeed = "<br />\n";
}
if ($three eq 'st') {
- my $result = &commit_studentrole(\$logmsg,$udom,$uname,$url,$three,$start,$end,
- $one,$two,$sec,$context,$credits);
+ $result = &commit_studentrole(\$logmsg,$udom,$uname,$url,$three,$start,$end,
+ $one,$two,$sec,$context,$credits);
if (($result =~ /^error/) || ($result eq 'not_in_class') ||
($result eq 'unknown_course') || ($result eq 'refused')) {
$output = $logmsg.' '.&mt('Error: ').$result."\n";
@@ -16409,14 +16412,18 @@
$output = &mt('Assigning').' '.$three.' in '.$url.
($start?', '.&mt('starting').' '.localtime($start):'').
($end?', '.&mt('ending').' '.localtime($end):'').': ';
- my $result = &Apache::lonnet::assignrole($udom,$uname,$url,$three,$end,$start,'','',$context);
+ $result = &Apache::lonnet::assignrole($udom,$uname,$url,$three,$end,$start,'','',$context);
if ($context eq 'auto') {
$output .= $result.$linefeed;
} else {
$output .= '<b>'.$result.'</b>'.$linefeed;
}
}
- return $output;
+ if (wantarray) {
+ return ($output,$result);
+ } else {
+ return $output;
+ }
}
sub commit_studentrole {
More information about the LON-CAPA-cvs
mailing list