--- loncom/interface/loncreateuser.pm 2023/03/29 16:01:13 1.467
+++ loncom/interface/loncreateuser.pm 2023/06/20 14:03:52 1.468
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.467 2023/03/29 16:01:13 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.468 2023/06/20 14:03:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4246,7 +4246,6 @@ sub update_roles {
0 );
my $url='/'.$one.'/'.$two;
my $id = $url.'_'.$three;
- my $type = 'three';
# split multiple sections
my %sections = ();
my $num_sections = &build_roles($env{'form.sec_'.$one.'_'.$two.'_'.$three},\%sections,$three);
@@ -4330,6 +4329,7 @@ sub update_roles {
my $two = $2;
my $url='/'.$one.'/';
my $id = $url.'_'.$two;
+ my ($cdom,$cnum) = split(/\//,$one);
# split multiple sections
my %sections = ();
my ($restricted,$numchanges);
@@ -4337,7 +4337,7 @@ sub update_roles {
if ($num_sections == 0) {
unless ($udom eq $one) {
$restricted = &Apache::lonuserutils::restricted_dom($context,$id,$udom,
- $uname,$two,$start,$end,$one,$two,'','',\%process_by,
+ $uname,$two,$start,$end,$cdom,$cnum,'','',\%process_by,
\%instdoms,\%got_role_approvals,\%got_instdoms,\%reject,
\%pending,\%notifydc,\%status,\%unauthorized,\%currqueued);
next if ($restricted);
@@ -4353,7 +4353,7 @@ sub update_roles {
unless ($udom eq $one) {
undef($restricted);
$restricted = &Apache::lonuserutils::restricted_dom($context,$secid,$udom,
- $uname,$two,$start,$end,$one,$two,$sec,'',\%process_by,
+ $uname,$two,$start,$end,$cdom,$cnum,$sec,'',\%process_by,
\%instdoms,\%got_role_approvals,\%got_instdoms,\%reject,
\%pending,\%notifydc,\%status,\%unauthorized,\%currqueued);
next if ($restricted);
@@ -4368,7 +4368,7 @@ sub update_roles {
unless ($udom eq $one) {
undef($restricted);
$restricted = &Apache::lonuserutils::restricted_dom($context,$id,$udom,
- $uname,$two,$start,$end,$one,$two,'','',\%process_by,
+ $uname,$two,$start,$end,$cdom,$cnum,'','',\%process_by,
\%instdoms,\%got_role_approvals,\%got_instdoms,\%reject,
\%pending,\%notifydc,\%status,\%unauthorized,\%currqueued);
next if ($restricted);
@@ -7070,12 +7070,13 @@ ENDSCRIPT
chgcontext => 'any',
rolelog_start_date => $defstart,
rolelog_end_date => $now,
+ approvals => 'any',
);
my $more_records = 0;
# set current
my %curr;
- foreach my $item ('show','page','role','chgcontext') {
+ foreach my $item ('show','page','role','chgcontext','approvals') {
$curr{$item} = $env{'form.'.$item};
}
my ($startdate,$enddate) =
@@ -7149,6 +7150,11 @@ ENDSCRIPT
if (($context eq 'course') && ($viewablesec ne '')) {
next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec);
}
+ if ($curr{'approvals'} eq 'none') {
+ next if ($roleslog{$id}{'logentry'}{'approval'});
+ } elsif ($curr{'approvals'} ne 'any') {
+ next if ($roleslog{$id}{'logentry'}{'approval'} ne $curr{'approvals'});
+ }
$count ++;
next if ($count < $minshown);
unless ($showntableheader) {
@@ -7195,11 +7201,30 @@ ENDSCRIPT
if ($chgcontext ne '' && $lt{$chgcontext} ne '') {
$chgcontext = $lt{$chgcontext};
}
+ my ($showreqby,%reqby);
+ if (($roleslog{$id}{'logentry'}{'approval'}) &&
+ ($roleslog{$id}{'logentry'}{'requester'})) {
+ if ($reqby{$roleslog{$id}{'logentry'}{'requester'}} eq '') {
+ my ($requname,$requdom) = split(/:/,$roleslog{$id}{'logentry'}{'requester'});
+ $reqby{$roleslog{$id}{'logentry'}{'requester'}} =
+ &Apache::loncommon::plainname($requname,$requdom);
+ }
+ $showreqby = &mt('Requester').': '.$reqby{$roleslog{$id}{'logentry'}{'requester'}}.'
';
+ if ($roleslog{$id}{'logentry'}{'approval'} eq 'domain') {
+ $showreqby .= &mt('Adjudicator').': '.
+ $whodunit{$roleslog{$id}{'exe_uname'}.':'.$roleslog{$id}{'exe_udom'}}.
+ '';
+ } else {
+ $showreqby .= ''.&mt('User approved').'';
+ }
+ } else {
+ $showreqby = $whodunit{$roleslog{$id}{'exe_uname'}.':'.$roleslog{$id}{'exe_udom'}};
+ }
$r->print(
&Apache::loncommon::start_data_table_row()
.'
' @@ -7744,6 +7781,7 @@ sub rolechg_contexts { domain => 'User Management in domain', selfenroll => 'Self-enrolled', requestcourses => 'Course Request', + ltienroll => 'Enrollment via LTI', ); if ($crstype eq 'Community') { $lt{'createcourse'} = &mt('Community Creation'); @@ -7768,6 +7806,15 @@ sub rolechg_contexts { return %lt; } +sub approval_types { + return &Apache::lonlocal::texthash ( + any => 'Any', + none => 'No approval needed', + user => 'Role recipient approval', + domain => 'Domain coordinator approval', + ); +} + sub print_helpdeskaccess_display { my ($r,$permission,$brcrum) = @_; my $formname = 'helpdeskaccess';