+
');
}
@@ -586,16 +766,21 @@ sub display_threshold_config {
foreach my $type (@thresholditems) {
my $parameter = $env{'request.course.id'}.':threshold_'.$type;
# onchange is javascript to automatically check the 'Set' button.
- my $onchange = 'onFocus="javascript:window.document.forms'.
+ my $onchange = 'onfocus="javascript:window.document.forms'.
"['thresholdform'].elements['".$parameter."_setparmval']".
'.checked=true;"';
+ my $aria_textbox = ' aria-label="'.&mt('Threshold value for [_1]',
+ $threshold_titles{$type}).'"';
+ my $aria_checkbox = ' aria-label="'.&mt('Change threshold value for [_1]',
+ $threshold_titles{$type}).'"';
$r->print(&Apache::loncommon::start_data_table_row()."\n".
'
'."\n".
&Apache::loncommon::end_data_table_row());
}
@@ -620,6 +805,8 @@ sub display_interval_config {
$setting = 'oldroleinterval';
} elsif ($context eq 'newroles') {
$setting = 'newroleinterval';
+ } elsif ($context eq 'sessions') {
+ $setting = 'sessionactivity';
}
my $lctype = lc(&Apache::loncommon::course_type());
my $current = &get_current($env{'user.name'},$env{'user.domain'},
@@ -628,6 +815,10 @@ sub display_interval_config {
$r->print(' '.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' expired.').' ');
} elsif ($context eq 'newroles') {
$r->print(' '.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').' ');
+ } elsif ($context eq 'crslogin') {
+ $r->print(' '.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).' ');
+ } elsif ($context eq 'sessions') {
+ $r->print(' '.&mt('Choose the time limit to use to display active user sessions in the '.$lctype.'.').' ');
} else {
$r->print(' '.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').' ');
}
@@ -643,12 +834,19 @@ sub display_interval_config {
'.
&mt('Display:').'
-
');
my $row;
foreach my $res (@{$warnings}) {
$row++;
@@ -1568,13 +1931,15 @@ sub display_abovethreshold {
if (ref($$triggered{$res}{text}) eq 'ARRAY') {
if (@{$$triggered{$res}{text}} > 1) {
for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) {
- $r->print('
'.
+ $r->print('
'.
$$triggered{$res}{text}[$i].'
');
}
}
}
}
- $r->print('
');
+ if ($checkallowed->{'resetcounters'}) {
+ $r->print('
');
+ }
} elsif ($itemserror) {
$r->print('
'.$itemserror.'
');
} else {
@@ -1620,7 +1985,7 @@ sub display_versionchanges {
}
sub display_rolechanges {
- my ($r,$chgcount,$changed,$interval,$crstype) = @_;
+ my ($r,$chgcount,$changed,$interval,$crstype,$classlist) = @_;
my $now = time();
my %lt = &Apache::lonlocal::texthash(
'user' => 'User',
@@ -1639,6 +2004,7 @@ sub display_rolechanges {
if (ref($changed) eq 'HASH') {
my @changes = sort { $b <=> $a } (keys(%{$changed}));
my $changenum = 0;
+ my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME();
foreach my $item (@changes) {
if (ref($changed->{$item}) eq 'ARRAY') {
foreach my $chg (@{$changed->{$item}}) {
@@ -1656,8 +2022,14 @@ sub display_rolechanges {
my $udom = $chg->{'udom'};
$changenum ++;
my $css_class = $changenum%2?' class="LC_odd_row"':'';
+ my $fullname;
+ if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') {
+ $fullname = $classlist->{$uname.':'.$udom}->[$fullnameidx];
+ } else {
+ $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname');
+ }
my $link =
- &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom);
+ &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
$r->print('
'.
'
'.&Apache::lonlocal::locallocaltime($item).'
'.
'
'.$link.'
'.
@@ -1675,7 +2047,112 @@ sub display_rolechanges {
}
return;
}
-
+
+sub display_activity {
+ my ($r,$context,$count,$details,$interval,$crstype,$classlist) = @_;
+ return unless (ref($classlist) eq 'HASH');
+ my %lt = &Apache::lonlocal::texthash(
+ 'user' => 'User',
+ 'role' => 'Role',
+ 'sec' => 'Section',
+ 'number' => 'Total number of logins',
+ );
+ my $prefix = 'login';
+ if ($context eq 'sessions') {
+ $lt{'number'} = &mt('Total number of active user sessions');
+ $lt{'active'} = &mt('Last active');
+ $prefix = 'session';
+ }
+ if ($count) {
+
+ my $hdr = '
'.
+ '
'.$lt{'user'}.'
'.
+ '
'.$lt{'role'}.'
'.
+ '
'.$lt{'sec'}.'
';
+ if ($context eq 'sessions') {
+ $hdr .= '
'.$lt{'active'}.'
';
+ }
+ $hdr .= '
'."\n".
+ '
'.
+ '
'.$lt{'number'}.'
'.
+ '
'.$lt{'role'}.'
'.
+ '
'.$lt{'sec'};
+ my (%bylastname,%counts);
+ if (ref($details) eq 'HASH') {
+ my @items = sort { $b <=> $a } (keys(%{$details}));
+ my $num = 0;
+ my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME();
+ foreach my $item (@items) {
+ if (ref($details->{$item}) eq 'ARRAY') {
+ foreach my $user (@{$details->{$item}}) {
+ if (ref($user) eq 'HASH') {
+ my $section;
+ my $role =
+ &Apache::lonnet::plaintext($user->{'role'},$crstype);
+ if ($user->{'section'} eq '') {
+ $section = &mt('none');
+ } else {
+ $section = $user->{'section'};
+ }
+ $counts{$user->{'role'}}{$section} ++;
+ my $uname = $user->{'uname'};
+ my $udom = $user->{'udom'};
+ my $fullname;
+ if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') {
+ $fullname = $classlist->{$uname.':'.$udom}->[$fullnameidx];
+ } else {
+ $fullname = &Apache::loncommon::plainname($uname,$udom,'lastname');
+ }
+ my $link =
+ &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
+ my $entry = '
'.$link.'
'.
+ '
'.$role.'
'.
+ '
'.$section.'
';
+ if ($context eq 'sessions') {
+ $entry .= '
'.&Apache::lonlocal::locallocaltime($item).'
';
+ }
+ push(@{$bylastname{$fullname}},$entry);
+ }
+ }
+ }
+ }
+ my $table;
+ foreach my $person (sort(keys(%bylastname))) {
+ if (ref($bylastname{$person}) eq 'ARRAY') {
+ foreach my $item (@{$bylastname{$person}}) {
+ $num ++;
+ my $css_class = $num%2?' class="LC_odd_row"':'';
+ $table .= '
'.$item.'
';
+ }
+ }
+ }
+ my $numrow = 0;
+ foreach my $role (sort(keys(%counts))) {
+ my $showrole = &Apache::lonnet::plaintext($role,$crstype);
+ if (ref($counts{$role}) eq 'HASH') {
+ foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) {
+ $numrow ++;
+ my $css_class = $numrow%2?' class="LC_odd_row"':'';
+ $table .= '