--- loncom/interface/loncreateuser.pm 2016/10/22 17:57:54 1.406.2.5
+++ loncom/interface/loncreateuser.pm 2016/02/17 19:15:48 1.408
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.406.2.5 2016/10/22 17:57:54 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.408 2016/02/17 19:15:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -527,72 +527,6 @@ sub domainrole_req {
&Apache::loncommon::end_data_table();
}
-sub domadhocroles {
- my ($ccuname,$ccdomain) = @_;
- my $confname = &Apache::lonnet::get_domainconfiguser($env{'request.role.domain'});
- my %existing=&Apache::lonnet::dump('roles',$env{'request.role.domain'},
- $confname,'rolesdef_');
- my $output;
- if (keys(%existing) > 0) {
- my @current;
- my $curradhoc = 'adhocroles.'.$env{'request.role.domain'};
- my %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,$curradhoc);
- if ($userenv{$curradhoc}) {
- @current = split(/,/,$userenv{$curradhoc});
- }
- my %customroles;
- foreach my $key (keys(%existing)) {
- if ($key=~/^rolesdef\_(\w+)$/) {
- my $rolename = $1;
- my %privs;
- ($privs{'system'},$privs{'domain'},$privs{'course'}) = split(/\_/,$existing{$key});
- $customroles{$rolename} = \%privs;
- }
- }
- $output = '
'.$userpicker.'
'; - } - if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs')) { + if ($env{'form.phase'} eq '') { my $defdom=$env{'request.role.domain'}; my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); my %lt=&Apache::lonlocal::texthash( @@ -1027,11 +946,9 @@ ENDSCRIPT 'usrch' => "User Search to add/modify roles", 'stusrch' => "User Search to enroll student", 'memsrch' => "User Search to enroll member", - 'srcva' => "Search for a user and view access log information", 'usel' => "Select a user to add/modify roles", 'stusel' => "Select a user to enroll as a student", 'memsel' => "Select a user to enroll as a member", - 'vacsel' => "Select a user to view access log", 'username' => "username", 'domain' => "domain", 'lastname' => "last name", @@ -1080,10 +997,6 @@ ENDSCRIPT $r->print($lt{'stusel'}); } $r->print(''); - } elsif ($env{'form.action'} eq 'accesslogs') { - $r->print("$lt{'srcva'}'
.&mt('There are no records to display.')
@@ -6636,328 +6603,15 @@ ENDSCRIPT
return;
}
-sub print_useraccesslogs_display {
- my ($r,$uname,$udom,$permission,$brcrum) = @_;
- my $formname = 'accesslog';
- my $form = 'document.accesslog';
-
-# set breadcrumbs
- my %breadcrumb_text = &singleuser_breadcrumb();
- push (@{$brcrum},
- {href => "javascript:backPage($form)",
- text => $breadcrumb_text{'search'}});
- my (@prevphases,$prevphasestr);
- if ($env{'form.prevphases'}) {
- @prevphases = split(/,/,$env{'form.prevphases'});
- $prevphasestr = $env{'form.prevphases'};
- }
- if (($env{'form.phase'} eq 'userpicked') || (grep(/^userpicked$/,@prevphases))) {
- push(@{$brcrum},
- {href => "javascript:backPage($form,'get_user_info','select')",
- text => $breadcrumb_text{'userpicked'}});
- if ($env{'form.phase'} eq 'userpicked') {
- $prevphasestr = 'userpicked';
- }
- }
- push(@{$brcrum},
- {href => '/adm/createuser?action=accesslogs',
- text => 'User access logs',
- help => 'User_Access_Logs'});
- my $bread_crumbs_component = 'User Access Logs';
- my $args = { bread_crumbs => $brcrum,
- bread_crumbs_component => 'User Management'};
-
-# set javascript
- my ($jsback,$elements) = &crumb_utilities();
- my $jsnav = &userlogdisplay_js($formname);
-
- my $jscript = (< '
- .&mt('You do not have rights to display user access logs.')
- .' '
- .&mt("User's domain must match role's domain")
- .' '
- .&mt('Invalid username or domain')
- .' '
- .&mt('There are no records to display.')
- .' '
- .''
- .' ';
- if (($curr->{'page'} > 1) || ($more_records)) {
- if (($curr->{'page'} > 1) && ($curr->{'show'} !~ /\D/)) {
- $nav_links .= ' ';
- }
- if ($more_records) {
- $nav_links .= '';
+ # Navigation Buttons
+ $nav_links = ' ';
+ if (($curr->{'page'} > 1) || ($more_records)) {
+ if ($curr->{'page'} > 1) {
+ $nav_links .= ' ';
+ }
+ if ($more_records) {
+ $nav_links .= '';
+ }
}
+ $nav_links .= ' '
- .''.&mt('When').' '
- .''.&mt('HostID').' '
- .''.&mt('Event').' '
- .''.&mt('Other data').' '
- .&Apache::loncommon::end_data_table_header_row();
-
- my %filters=(
- start => $curr{'accesslog_start_date'},
- end => $curr{'accesslog_end_date'},
- action => $curr{'activity'},
- );
-
- my $reply = &Apache::lonnet::userlog_query($uname,$udom,%filters);
- unless ( ($reply =~/^timeout/) || ($reply =~/^error/) ) {
- my (%courses,%missing);
- my @results = split(/\&/,$reply);
- foreach my $item (reverse(@results)) {
- my ($timestamp,$host,$event) = split(/:/,$item);
- next unless ($event =~ /^(Log|Role)/);
- if ($curr{'show'} !~ /\D/) {
- if ($count >= $curr{'page'} * $curr{'show'}) {
- $more_records = 1;
- last;
- }
- }
- $count ++;
- next if ($count < $minshown);
- unless ($showntableheader) {
- $r->print($nav_script
- .&Apache::loncommon::start_data_table()
- .$tableheader);
- $r->rflush();
- $showntableheader = 1;
- }
- my ($shown,$extra,);
- my ($event,$data) = split(/\s+/,&unescape($event));
- if ($event eq 'Role') {
- my ($rolecode,$extent) = split(/\./,$data,2);
- next if ($extent eq '');
- my ($crstype,$desc,$info);
- if ($extent =~ m{^/($match_domain)/($match_courseid)$}) {
- my ($cdom,$cnum) = ($1,$2);
- my $cid = $cdom.'_'.$cnum;
- if (exists($courses{$cid})) {
- $crstype = $courses{$cid}{'type'};
- $desc = $courses{$cid}{'description'};
- } elsif ($missing{$cid}) {
- $crstype = 'Course';
- $desc = 'Course/Community';
- } else {
- my %crsinfo = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,undef,undef,'.');
- if (ref($crsinfo{$cdom.'_'.$cnum}) eq 'HASH') {
- $courses{$cid} = $crsinfo{$cid};
- $crstype = $crsinfo{$cid}{'type'};
- $desc = $crsinfo{$cid}{'description'};
- } else {
- $missing{$cid} = 1;
- }
- }
- $extra = &mt($crstype).': '.$desc.'';
- } elsif ($extent =~ m{^/($match_domain)/($match_username|$)}) {
- my ($dom,$name) = ($1,$2);
- if ($rolecode eq 'au') {
- $extra = '';
- } elsif ($rolecode =~ /^(ca|aa)$/) {
- $extra = &mt('Authoring Space: [_1]',$name.':'.$dom);
- } elsif ($rolecode =~ /^(li|dg|dh|dc|sc)$/) {
- $extra = &mt('Domain: [_1]',$dom);
- }
- }
- my $rolename;
- if ($rolecode =~ m{^cr/($match_domain)/($match_username)/(\w+)}) {
- my $role = $3;
- my $owner = "($2:$1)";
- if ($2 eq $1.'-domainconfig') {
- $owner = '(ad hoc)';
- }
- $rolename = &mt('Custom role: [_1]',$role.' '.$owner);
- } else {
- $rolename = &Apache::lonnet::plaintext($rolecode,$crstype);
- }
- $shown = &mt('Role selection: [_1]',$rolename);
- } else {
- $shown = &mt($event);
- if ($data ne '') {
- $extra = &mt('Client IP address: [_1]',$data);
- }
- }
- $r->print(
- &Apache::loncommon::start_data_table_row()
- .''.$count.' '
- .''.&Apache::lonlocal::locallocaltime($timestamp).' '
- .''.$host.' '
- .''.$shown.' '
- .''.$extra.' '
- .&Apache::loncommon::end_data_table_row()."\n");
- }
- }
-
- if ($showntableheader) { # Table footer, if content displayed above
- $r->print(&Apache::loncommon::end_data_table().
- &userlogdisplay_navlinks(\%curr,$more_records));
- } else { # No content displayed above
- $r->print('
';
- # Update Display button
- $output .= ''.
- ''.&mt('Actions/page:').'
'.
- &Apache::lonmeta::selectbox('show',$curr->{'show'},undef,
- (&mt('all'),5,10,20,50,100,1000,10000)).
- ' ';
- my $startform =
- &Apache::lonhtmlcommon::date_setter($formname,'accesslog_start_date',
- $curr->{'accesslog_start_date'},undef,
- undef,undef,undef,undef,undef,undef,$nolink);
- my $endform =
- &Apache::lonhtmlcommon::date_setter($formname,'accesslog_end_date',
- $curr->{'accesslog_end_date'},undef,
- undef,undef,undef,undef,undef,undef,$nolink);
- my %lt = &Apache::lonlocal::texthash (
- activity => 'Activity',
- Role => 'Role selection',
- log => 'Log-in or Logout',
- );
- $output .= ''.&mt('Window during which actions occurred:').' '.
- '
'.
- '
'.
- ' '.
- ''.&mt('After:').
- ' '.$startform.' '.&mt('Before:').' '.
- ''.$endform.' '.
- ''.&mt('Activities').' '.
- '
'.
- '