--- loncom/interface/lonuserutils.pm 2016/10/14 23:26:21 1.177
+++ loncom/interface/lonuserutils.pm 2020/10/15 13:47:45 1.183.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA user accounts
#
-# $Id: lonuserutils.pm,v 1.177 2016/10/14 23:26:21 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.183.2.1 2020/10/15 13:47:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2307,7 +2307,7 @@ sub courses_selector {
my $allidlist = $idlist{$codetitles[0]};
$jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist);
$jscript .= $scripttext;
- $jscript .= &Apache::courseclassifier::javascript_code_selections($formname,@codetitles);
+ $jscript .= &Apache::courseclassifier::javascript_code_selections($formname,\@codetitles);
}
}
my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($cdom);
@@ -2572,9 +2572,13 @@ function username_display_launch(usernam
}
}
}
- if (target == 'modify') {
+ if ((target == 'modify') || (target == 'activity')) {
+ var nextaction = 'singleuser';
+ if (target == 'activity') {
+ nextaction = 'accesslogs';
+ }
if (document.$formname.userwin.checked == true) {
- var url = '/adm/createuser?srchterm='+username+'&srchdomain='+domain+'&phase=get_user_info&action=singleuser&srchin=dom&srchby=uname&srchtype=exact&popup=1';
+ var url = '/adm/createuser?srchterm='+username+'&srchdomain='+domain+'&phase=get_user_info&srchin=dom&srchby=uname&srchtype=exact&popup=1&action='+nextaction;
var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
modifywin = window.open(url,'',options,1);
modifywin.focus();
@@ -2583,7 +2587,7 @@ function username_display_launch(usernam
document.$formname.srchterm.value=username;
document.$formname.srchdomain.value=domain;
document.$formname.phase.value='get_user_info';
- document.$formname.action.value = 'singleuser';
+ document.$formname.action.value = nextaction;
document.$formname.submit();
}
}
@@ -2629,6 +2633,7 @@ END
'owin' => "Open in a new window",
'modify' => "Modify a user's information",
'track' => "View a user's recent activity",
+ 'activity' => "View a user's access log",
);
my %lt = (%coltxt,%acttxt);
my $rolefilter = $env{'form.showrole'};
@@ -2719,12 +2724,17 @@ END
if ($permission->{'cusr'}) {
unshift (@linkdests,'modify');
}
- if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) ||
- &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.
- $env{'request.course.sec'})) {
- push(@linkdests,'track');
+ if ($context eq 'course') {
+ if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.
+ $env{'request.course.sec'})) {
+ push(@linkdests,'track');
+ }
+ } elsif ($context eq 'domain') {
+ if (&Apache::lonnet::allowed('vac',$env{'request.role.domain'})) {
+ push(@linkdests,'activity');
+ }
}
-
$output .= '
';
my $usernamelink = $env{'form.usernamelink'};
if ($usernamelink eq '') {
@@ -2993,6 +3003,12 @@ END
} (keys(%$userlist));
}
my $rowcount = 0;
+ my $disabled;
+ if ($mode eq 'autoenroll') {
+ unless ($permission->{'cusr'}) {
+ $disabled = ' disabled="disabled"';
+ }
+ }
foreach my $user (@sorted_users) {
my %in;
my $sdata = $userlist->{$user};
@@ -3029,16 +3045,16 @@ END
if ($mode eq 'autoenroll') {
my $cellentry;
if ($in{'type'} eq 'auto') {
- $cellentry = ''.&mt('auto').' ';
+ $cellentry = ''.&mt('auto').' ';
$autocount ++;
} else {
- $cellentry = ''.&mt('manual').' | | ';
+ $cellentry = '';
@@ -3085,7 +3101,14 @@ END
}
if ($showcheckbox) {
$r->print(' | | ');
+ 'actionlist" value="'.
+ &HTML::Entities::encode($checkval,'&<>"').'" />');
+ foreach my $item ('start','end') {
+ $r->print('');
+ }
+ $r->print('');
} else {
$r->print(' | ');
}
@@ -3099,8 +3122,6 @@ END
foreach my $item (@cols) {
if ($item eq 'username') {
$r->print(''.&print_username_link($mode,\%in).' | ');
- } elsif (($item eq 'start' || $item eq 'end') && ($actionselect)) {
- $r->print(''.$in{$item}.' | '."\n");
} elsif ($item eq 'status') {
my $showitem = $in{$item};
if (defined($ltstatus{$in{$item}})) {
@@ -4765,16 +4786,16 @@ sub upfile_drop_add {
}
}
}
- if (!$multiple) {
- ($userresult,$authresult,$roleresult,$idresult) =
- &modifyuserrole($context,$setting,
- $changeauth,$cid,$userdomain,$username,
- $id,$amode,$password,$fname,
- $mname,$lname,$gen,$singlesec,
- $env{'form.forceid'},$desiredhost,
- $email,$role,$enddate,$startdate,
- $checkid,$inststatus);
- }
+ }
+ if (!$multiple) {
+ ($userresult,$authresult,$roleresult,$idresult) =
+ &modifyuserrole($context,$setting,
+ $changeauth,$cid,$userdomain,$username,
+ $id,$amode,$password,$fname,
+ $mname,$lname,$gen,$singlesec,
+ $env{'form.forceid'},$desiredhost,
+ $email,$role,$enddate,$startdate,
+ $checkid,$inststatus);
}
}
if ($multiple) {
@@ -5416,13 +5437,13 @@ sub set_login {
}
sub course_sections {
- my ($sections_count,$role,$current_sec) = @_;
+ my ($sections_count,$role,$current_sec,$disabled) = @_;
my $output = '';
my @sections = (sort {$a <=> $b} keys(%{$sections_count}));
my $numsec = scalar(@sections);
my $is_selected = ' selected="selected"';
if ($numsec <= 1) {
- $output = '
|