--- loncom/interface/loncommon.pm 2023/05/22 21:10:55 1.1405
+++ loncom/interface/loncommon.pm 2023/09/10 18:12:54 1.1411
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1405 2023/05/22 21:10:55 raeburn Exp $
+# $Id: loncommon.pm,v 1.1411 2023/09/10 18:12:54 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -71,6 +71,7 @@ use Apache::lonuserutils();
use Apache::lonuserstate();
use Apache::courseclassifier();
use LONCAPA qw(:DEFAULT :match);
+use LONCAPA::ltiutils;
use LONCAPA::LWPReq;
use LONCAPA::map();
use HTTP::Request;
@@ -6369,6 +6370,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 +6379,7 @@ Returns: HTML div with CSTR path and rec
=cut
sub CSTR_pageheader {
- my ($trailfile,$frameset) = @_;
+ my ($trailfile,$frameset,$title) = @_;
if ($trailfile eq '') {
$trailfile = $env{'request.filename'};
}
@@ -6399,13 +6402,15 @@ sub CSTR_pageheader {
$lastitem = $thisdisfn;
}
- my ($crsauthor,$title);
+ my $crsauthor;
if (($env{'request.course.id'}) &&
($env{'course.'.$env{'request.course.id'}.'.num'} eq $uname) &&
($env{'course.'.$env{'request.course.id'}.'.domain'} eq $udom)) {
$crsauthor = 1;
- $title = &mt('Course Authoring Space');
- } else {
+ if ($title eq '') {
+ $title = &mt('Course Authoring Space');
+ }
+ } elsif ($title eq '') {
$title = &mt('Authoring Space');
}
@@ -6844,6 +6849,9 @@ ENDJS
$endbodytag;
}
}
+ if ((ref($args) eq 'HASH') && ($args->{'dashjs'})) {
+ $endbodytag = &Apache::lonhtmlcommon::dash_to_minus_js().$endbodytag;
+ }
return $endbodytag;
}
@@ -10496,6 +10504,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_user($udom,$uname)) {
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ }
my $course = !$env{'user.adv'};
if (!$env{'user.adv'}) {
foreach my $env (keys(%env)) {
@@ -16527,9 +16545,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.'
';
@@ -16541,7 +16560,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";
@@ -16550,7 +16570,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";
@@ -16570,7 +16591,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 {
@@ -16586,7 +16608,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";
@@ -16610,8 +16632,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');
@@ -16637,7 +16660,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 '') {