'.
+ &Apache::loncommon::end_data_table_header_row();
+ foreach my $key (sort(keys(%customroles))) {
+ next if ((!$canmodify) && (!grep(/^\Q$key\E$/,@current)));
+ $output .= &Apache::loncommon::start_data_table_row();
+ if ($canmodify) {
+ if (grep(/^\Q$key\E$/,@current)) {
+ $output .= '
'.
+ ''.
+ &mt('Delete').''.
+ '
';
+ } else {
+ $output .= '
'.
+ ''.
+ &mt('Add').''.
+ '
';
+ }
+ }
+ $output .= '
'.$key.'
';
+ 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,8 +754,10 @@ 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);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$defdom);
if ($env{'form.action'} eq 'custom') {
push(@{$brcrum},
{href=>"javascript:backPage(document.crtuser)",
@@ -695,6 +785,8 @@ 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',
+ 'srvu' => 'Search for a user and view user information and roles',
+ 'srva' => 'Search for a user and view access log information',
'usr' => "Username",
'dom' => "Domain",
'ecrp' => "Define or Edit Custom Role",
@@ -747,12 +839,20 @@ sub print_username_entry_form {
} else {
$actiontext = $lt{'srst'};
}
+ } elsif ($env{'form.action'} eq 'accesslogs') {
+ $actiontext = $lt{'srva'};
+ } elsif (($env{'form.action'} eq 'singleuser') &&
+ ($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$defdom))) {
+ $actiontext = $lt{'srvu'};
}
$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 +895,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 +913,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') &&
+ (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') &&
+ (!&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))))) {
my $defdom=$env{'request.role.domain'};
my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain');
my %lt=&Apache::lonlocal::texthash(
@@ -946,9 +1055,13 @@ 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",
+ 'usrvu' => "User Search to view user roles",
'usel' => "Select a user to add/modify roles",
+ 'suvr' => "Select a user to view 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",
@@ -958,7 +1071,7 @@ ENDSCRIPT
if ($context eq 'requestcrs') {
$r->print('