--- loncom/interface/loncommon.pm 2023/06/10 23:55:36 1.1406
+++ loncom/interface/loncommon.pm 2023/06/20 14:03:52 1.1408
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1406 2023/06/10 23:55:36 raeburn Exp $
+# $Id: loncommon.pm,v 1.1408 2023/06/20 14:03:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6369,6 +6369,8 @@ Input: (optional) filename from which br
If page header is being requested for use in a frameset, then
the second (option) argument -- frameset will be true, and
the target attribute set for links should be target="_parent".
+ If $title is supplied as the thitd arg, that will be used to
+ the left of the breadcrumbs tail for the current path.
Returns: HTML div with CSTR path and recent box
To be included on Authoring Space pages
@@ -6376,7 +6378,7 @@ Returns: HTML div with CSTR path and rec
=cut
sub CSTR_pageheader {
- my ($trailfile,$frameset,$title,$diraction) = @_;
+ my ($trailfile,$frameset,$title) = @_;
if ($trailfile eq '') {
$trailfile = $env{'request.filename'};
}
@@ -6424,7 +6426,7 @@ sub CSTR_pageheader {
}
my $output =
- '
'
+ '
'
.&Apache::loncommon::help_open_menu('','',3,'Authoring') #FIXME: Broken? Where is it?
.''.$title.' '
.''
.&Apache::lonmenu::constspaceform($frameset);
}
- $output .= '
'.$diraction;
+ $output .= '
';
return $output;
}
@@ -10498,6 +10500,16 @@ Scalar: 1 if 'Course' to be used, 0 othe
###############################################
sub show_course {
+ my ($udom,$uname) = @_;
+ if (($udom ne '') && ($uname ne '')) {
+ if (($udom ne $env{'user.domain'}) || ($uname ne $env{'user.name'})) {
+ if (&Apache::lonnet::is_advanced($udom,$uname)) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ }
my $course = !$env{'user.adv'};
if (!$env{'user.adv'}) {
foreach my $env (keys(%env)) {
@@ -16529,9 +16541,10 @@ sub assign_category_rows {
sub commit_customrole {
- my ($udom,$uname,$url,$three,$four,$five,$start,$end,$context) = @_;
+ my ($udom,$uname,$url,$three,$four,$five,$start,$end,$context,$othdomby,$requester) = @_;
my $result = &Apache::lonnet::assigncustomrole(
- $udom,$uname,$url,$three,$four,$five,$end,$start,undef,undef,$context);
+ $udom,$uname,$url,$three,$four,$five,$end,$start,undef,undef,
+ $context,$othdomby,$requester);
my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.':'.$three.' in '.$url.
($start?', '.&mt('starting').' '.localtime($start):'').
($end?', ending '.localtime($end):'').': '.$result.'
';
@@ -16543,7 +16556,8 @@ sub commit_customrole {
}
sub commit_standardrole {
- my ($udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context,$credits) = @_;
+ my ($udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context,$credits,
+ $othdomby,$requester) = @_;
my ($output,$logmsg,$linefeed,$result);
if ($context eq 'auto') {
$linefeed = "\n";
@@ -16552,7 +16566,8 @@ sub commit_standardrole {
}
if ($three eq 'st') {
$result = &commit_studentrole(\$logmsg,$udom,$uname,$url,$three,$start,$end,
- $one,$two,$sec,$context,$credits);
+ $one,$two,$sec,$context,$credits,$othdomby,
+ $requester);
if (($result =~ /^error/) || ($result eq 'not_in_class') ||
($result eq 'unknown_course') || ($result eq 'refused')) {
$output = $logmsg.' '.&mt('Error: ').$result."\n";
@@ -16572,7 +16587,8 @@ sub commit_standardrole {
$output = &mt('Assigning').' '.$three.' in '.$url.
($start?', '.&mt('starting').' '.localtime($start):'').
($end?', '.&mt('ending').' '.localtime($end):'').': ';
- $result = &Apache::lonnet::assignrole($udom,$uname,$url,$three,$end,$start,'','',$context);
+ $result = &Apache::lonnet::assignrole($udom,$uname,$url,$three,$end,$start,
+ '','',$context,$othdomby,$requester);
if ($context eq 'auto') {
$output .= $result.$linefeed;
} else {
@@ -16588,7 +16604,7 @@ sub commit_standardrole {
sub commit_studentrole {
my ($logmsg,$udom,$uname,$url,$three,$start,$end,$one,$two,$sec,$context,
- $credits) = @_;
+ $credits,$othdomby,$requester) = @_;
my ($result,$linefeed,$oldsecurl,$newsecurl);
if ($context eq 'auto') {
$linefeed = "\n";
@@ -16612,8 +16628,9 @@ sub commit_studentrole {
}
$oldsecurl = $uurl;
$expire_role_result =
- &Apache::lonnet::assignrole($udom,$uname,$uurl,'st',$now,'','','',$context);
- if ($env{'request.course.sec'} ne '') {
+ &Apache::lonnet::assignrole($udom,$uname,$uurl,'st',$now,
+ '','','',$context,$othdomby,$requester);
+ if ($env{'request.course.sec'} ne '') {
if ($expire_role_result eq 'refused') {
my @roles = ('st');
my @statuses = ('previous');
@@ -16639,7 +16656,8 @@ sub commit_studentrole {
&Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,
undef,undef,undef,$sec,
$end,$start,'','',$cid,
- '',$context,$credits);
+ '',$context,$credits,'',
+ $othdomby,$requester);
if ($modify_section_result =~ /^ok/) {
if ($secchange == 1) {
if ($sec eq '') {