[LON-CAPA-cvs] cvs: loncom /interface lonuserutils.pm
raeburn
raeburn at source.lon-capa.org
Thu Jan 4 23:01:40 EST 2024
raeburn Fri Jan 5 04:01:40 2024 EDT
Modified files:
/loncom/interface lonuserutils.pm
Log:
- Defaults for User Status for "List Users" in course context for courses
with institutional code:
- "Will Have Future Access" if before start access date set in course
("last login" checkbox also unchecked, bu default).
- "Previously Had Access" if after end access date set in course.
- "Currently Has Access" otherwise.
- "active groups" unchecked if there are no groups in course.
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.220 loncom/interface/lonuserutils.pm:1.221
--- loncom/interface/lonuserutils.pm:1.220 Thu Dec 7 04:47:00 2023
+++ loncom/interface/lonuserutils.pm Fri Jan 5 04:01:40 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.220 2023/12/07 04:47:00 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.221 2024/01/05 04:01:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2183,6 +2183,24 @@
if (! exists($env{'form.sortby'})) {
$env{'form.sortby'} = 'username';
}
+ my ($showstart,$showend);
+ if (($env{'form.Status'} eq '') && ($env{'form.phase'} eq '') &&
+ ($env{'form.showrole'} eq '') && ($context eq 'course') &&
+ ($env{'request.course.id'} ne '') &&
+ ($env{'course.'.$env{'request.course.id'}.'.internal.coursecode'} ne '')) {
+ my $now = time;
+ my $startaccess = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_start_date'};
+ my $endaccess = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_end_date'};
+ if (($startaccess) && ($startaccess > $now)) {
+ $env{'form.Status'} = 'Future';
+ $showstart = 1;
+ }
+ if (($endaccess ne '') && ($endaccess != 0) && ($endaccess < $now)) {
+ $env{'form.Status'} = 'Expired';
+ undef($showstart);
+ $showend = 1;
+ }
+ }
if ($env{'form.Status'} !~ /^(Any|Expired|Active|Future)$/) {
$env{'form.Status'} = 'Active';
}
@@ -2250,7 +2268,7 @@
$r->print(§ion_group_filter($cnum,$cdom));
}
$r->print('</div><div class="LC_left_float">'.
- &column_checkboxes($context,$mode,$formname,$showcredits).
+ &column_checkboxes($context,$mode,$formname,$showcredits,$showstart,$showend).
'</div>');
if ($env{'form.phase'} eq '') {
$r->print('<br clear="all" />'.
@@ -2661,7 +2679,7 @@
}
sub column_checkboxes {
- my ($context,$mode,$formname,$showcredits) = @_;
+ my ($context,$mode,$formname,$showcredits,$showstart,$showend) = @_;
my @cols = &get_cols_array($context,$mode,$showcredits);
my @showncols = &Apache::loncommon::get_env_multiple('form.showcol');
my (%disabledchk,%unchecked);
@@ -2674,11 +2692,21 @@
if ($showcredits) {
$unchecked{'credits'} = 1;
}
- } elsif ($context eq 'domain') {
+ my %curr_groups = &Apache::longroup::coursegroups();
+ unless (keys(%curr_groups)) {
+ $unchecked{'groups'} = 1;
+ }
+ } elsif ($context eq 'domain') {
$unchecked{'extent'} = 1;
}
- $unchecked{'start'} = 1;
- $unchecked{'end'} = 1;
+ if ($showstart) {
+ $unchecked{'lastlogin'} = 1;
+ } else {
+ $unchecked{'start'} = 1;
+ }
+ unless ($showend) {
+ $unchecked{'end'} = 1;
+ }
} else {
if ($env{'form.Status'} ne 'Any') {
$disabledchk{'status'} = 1;
More information about the LON-CAPA-cvs
mailing list