';
+ foreach my $level ('course','domain','system') {
+ if ($customroles{$key}{$level}) {
+ my $suffix;
+ if (($level eq 'domain') || ($level eq 'system')) {
+ $suffix = ' ('.&mt($level).')';
+ }
+ my @privs = split(/:/,$customroles{$key}{$level});
+ foreach my $item (@privs) {
+ next if ($item eq '');
+ my ($priv,$cond) = split(/\&/,$item);
+ $output .= &Apache::lonnet::plaintext($priv,'Course').$suffix.' ';
+ }
+ }
+ }
+ $output .= '
'.
+ &Apache::loncommon::end_data_table_row();
+ }
+ $output .= &Apache::loncommon::end_data_table();
+ }
+ return $output;
+}
+
sub courserequest_titles {
my %titles = &Apache::lonlocal::texthash (
official => 'Official',
unofficial => 'Unofficial',
community => 'Communities',
textbook => 'Textbook',
+ placement => 'Placement Tests',
norequest => 'Not allowed',
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
@@ -666,6 +737,8 @@ sub print_username_entry_form {
$helpitem = 'Course_Editing_Custom_Roles';
} elsif ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
+ } elsif ($env{'form.action'} eq 'accesslogs') {
+ $helpitem = 'Domain_User_Access_Logs';
}
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
if ($env{'form.action'} eq 'custom') {
@@ -695,6 +768,7 @@ sub print_username_entry_form {
'srst' => 'Search for a user and enroll as a student',
'srme' => 'Search for a user and enroll as a member',
'srad' => 'Search for a user and modify/add user information or roles',
+ 'srva' => 'Search for a user and view access log information',
'usr' => "Username",
'dom' => "Domain",
'ecrp' => "Define or Edit Custom Role",
@@ -747,12 +821,17 @@ sub print_username_entry_form {
} else {
$actiontext = $lt{'srst'};
}
+ } elsif ($env{'form.action'} eq 'accesslogs') {
+ $actiontext = $lt{'srva'};
}
$r->print("
$actiontext
");
if ($env{'form.origform'} ne 'crtusername') {
- $r->print("\n".$response);
+ if ($response) {
+ $r->print("\n
$response
".
+ ' ');
+ }
}
- $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype));
+ $r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype,1));
}
}
@@ -795,7 +874,7 @@ END
}
sub entry_form {
- my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_;
+ my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype,$fixeddom) = @_;
my ($usertype,$inexact);
if (ref($srch) eq 'HASH') {
if (($srch->{'srchin'} eq 'dom') &&
@@ -813,16 +892,20 @@ sub entry_form {
}
my $cancreate =
&Apache::lonuserutils::can_create_user($dom,$context,$usertype);
- my $userpicker =
+ my ($userpicker,$cansearch) =
&Apache::loncommon::user_picker($dom,$srch,$forcenewuser,
- 'document.crtuser',$cancreate,$usertype);
+ 'document.crtuser',$cancreate,$usertype,$context,$fixeddom);
my $srchbutton = &mt('Search');
if ($env{'form.action'} eq 'singlestudent') {
$srchbutton = &mt('Search and Enroll');
+ } elsif ($env{'form.action'} eq 'accesslogs') {
+ $srchbutton = &mt('Search');
} elsif ($cancreate && $responsemsg ne '' && $inexact) {
$srchbutton = &mt('Search or Add New User');
}
- my $output = <<"ENDBLOCK";
+ my $output;
+ if ($cansearch) {
+ $output = <<"ENDBLOCK";
ENDBLOCK
- if ($env{'form.phase'} eq '') {
+ } else {
+ $output = '
'.$userpicker.'
';
+ }
+ if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs')) {
my $defdom=$env{'request.role.domain'};
my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
my %lt=&Apache::lonlocal::texthash(
@@ -946,9 +1032,11 @@ 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",
@@ -997,6 +1085,10 @@ ENDSCRIPT
$r->print($lt{'stusel'});
}
$r->print('');
+ } elsif ($env{'form.action'} eq 'accesslogs') {
+ $r->print("$lt{'srcva'} ");
+ $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,'accesslogs',undef,undef,1));
+ $r->print('
'."\n";
} elsif ($item eq 'approval') {
- my ($appon,$appoff);
- my $cid = $env{'request.course.id'};
- my $currnotified = $env{'course.'.$cid.'.internal.selfenroll_notifylist'};
- if ($env{'course.'.$cid.'.internal.selfenroll_approval'}) {
- $appon = ' checked="checked" ';
- $appoff = ' ';
- } else {
- $appon = ' ';
- $appoff = ' checked="checked" ';
+ my ($currnotified,$currapproval,%appchecked);
+ my %selfdescs = &Apache::lonuserutils::selfenroll_default_descs();
+ if (ref($currsettings) eq 'HASH') {
+ $currnotified = $currsettings->{'selfenroll_notifylist'};
+ $currapproval = $currsettings->{'selfenroll_approval'};
+ }
+ if ($currapproval !~ /^[012]$/) {
+ $currapproval = 0;
+ }
+ if ($noedit{$item}) {
+ $output .= $selfdescs{'approval'}{$currapproval}.
+ ' '.&mt('(Set by Domain Coordinator)');
+ next;
+ }
+ $appchecked{$currapproval} = ' checked="checked"';
+ for my $i (0..2) {
+ $output .= ''.(' 'x2);
}
- $output .= ' ';
my %advhash = &Apache::lonnet::get_course_adv_roles($cid,1);
my (@ccs,%notified);
my $ccrole = 'cc';
@@ -5890,7 +6077,13 @@ ENDSCRIPT
}
}
if (@ccs) {
- $output .= ' '.&mt('Personnel to be notified when an enrollment request needs approval, or has been approved:').' '.&Apache::loncommon::start_data_table().
+ my $style;
+ unless ($currapproval) {
+ $style = ' style="display: none;"';
+ }
+ $output .= '
'.
+ &mt('Personnel to be notified when an enrollment request needs approval, or has been approved:').' '.
+ &Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_row();
my $count = 0;
my $numcols = 4;
@@ -5918,14 +6111,29 @@ ENDSCRIPT
}
}
$output .= &Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table();
+ &Apache::loncommon::end_data_table().
+ '