--- loncom/interface/loncreateuser.pm 2016/10/22 17:56:12 1.417
+++ loncom/interface/loncreateuser.pm 2017/08/11 00:24:53 1.446
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.417 2016/10/22 17:56:12 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.446 2017/08/11 00:24:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -160,7 +160,8 @@ END_SCRIPT
'
');
} else {
- my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$srch->{'srchdomain'});
my $helpitem;
if ($env{'form.action'} eq 'singleuser') {
$helpitem = 'Course_Change_Privileges';
} elsif ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
+ } elsif ($context eq 'author') {
+ $helpitem = 'Author_Change_Privileges';
+ } elsif ($context eq 'domain') {
+ $helpitem = 'Domain_Change_Privileges';
}
push (@{$brcrum},
{href => "javascript:backPage(document.usersrchform,'','')",
@@ -1066,9 +1048,19 @@ ENDSCRIPT
);
$r->print(&Apache::loncommon::start_page('User Management',$jscript,{bread_crumbs => $brcrum}));
if ($env{'form.action'} eq 'singleuser') {
- $r->print("
$lt{'usrch'}");
+ my $readonly;
+ if (($context eq 'domain') && (!&Apache::lonnet::allowed('mau',$srch->{'srchdomain'}))) {
+ $readonly = 1;
+ $r->print("
$lt{'usrvu'}");
+ } else {
+ $r->print("
$lt{'usrch'}");
+ }
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
- $r->print('
'.$lt{'usel'}.'
');
+ if ($readonly) {
+ $r->print('
'.$lt{'suvr'}.'
');
+ } else {
+ $r->print('
'.$lt{'usel'}.'
');
+ }
} elsif ($env{'form.action'} eq 'singlestudent') {
$r->print($jscript."
");
if ($crstype eq 'Community') {
@@ -1087,7 +1079,7 @@ ENDSCRIPT
$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(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,undef,1));
$r->print(''.$lt{'vacsel'}.'
');
}
}
@@ -1168,7 +1160,8 @@ sub print_user_modification_page {
if (($ccuname eq '') || ($ccdomain eq '')) {
my $usermsg = &mt('No username and/or domain provided.');
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$usermsg,'','',$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$usermsg,'','',$crstype,$brcrum,
+ $permission);
return;
}
my ($form,$formname);
@@ -1207,12 +1200,18 @@ sub print_user_modification_page {
}
$response .= ''
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
- .' '
- .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
- ,'','')
- .'
';
+ .' ';
+ if ($context eq 'domain') {
+ $response .= &mt('Please contact a [_1] for assistance.',
+ &Apache::lonnet::plaintext('dc'));
+ } else {
+ $response .= &mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'
','');
+ }
+ $response .= '
';
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum,
+ $permission);
return;
}
$newuser = 1;
@@ -1236,7 +1235,8 @@ sub print_user_modification_page {
'username');
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum,
+ $permission);
return;
}
}
@@ -1257,10 +1257,14 @@ sub print_user_modification_page {
my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
$groupslist,$newuser,$formname,\%loaditem);
- my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
+ } elsif ($context eq 'author') {
+ $helpitem = 'Author_Change_Privileges';
+ } elsif ($context eq 'domain') {
+ $helpitem = 'Domain_Change_Privileges';
}
push (@{$brcrum},
{href => "javascript:backPage($form)",
@@ -1323,7 +1327,7 @@ ENDFORMINFO
}
my $title = '';
if ($newuser) {
- my ($portfolioform,$domroleform,$adhocroleform);
+ my ($portfolioform,$domroleform);
if ((&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) ||
(&Apache::lonnet::allowed('mut',$env{'request.role.domain'}))) {
# Current user has quota or user tools modification privileges
@@ -1333,12 +1337,6 @@ ENDFORMINFO
($ccdomain eq $env{'request.role.domain'})) {
$domroleform = '
'.&domainrole_req($ccuname,$ccdomain);
}
- if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {
- $adhocroleform = &domadhocroles($ccuname,$ccdomain);
- if ($adhocroleform) {
- $adhocroleform = '
'.$adhocroleform;
- }
- }
&initialize_authen_forms($ccdomain,$formname);
my %lt=&Apache::lonlocal::texthash(
'lg' => 'Login Data',
@@ -1449,7 +1447,7 @@ ENDAUTH
} else {
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
}
- $r->print($portfolioform.$domroleform.$adhocroleform);
+ $r->print($portfolioform.$domroleform);
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname,
$permission,$crstype,$ccuname,
@@ -1467,40 +1465,47 @@ ENDAUTH
'"'.$ccuname.'"','"'.$ccdomain.'"');
}
} else {
- $title = &mt('Modify existing user: [_1] in domain [_2]',
+ if ($permission->{'cusr'}) {
+ $title = &mt('Modify existing user: [_1] in domain [_2]',
+ '"'.$ccuname.'"','"'.$ccdomain.'"');
+ } else {
+ $title = &mt('Existing user: [_1] in domain [_2]',
'"'.$ccuname.'"','"'.$ccdomain.'"');
+ }
}
$r->print('
'.$title.'
'."\n");
$r->print('
');
$r->print(&personal_data_display($ccuname,$ccdomain,$newuser,$context,
$inst_results{$ccuname.':'.$ccdomain}));
- if (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
+ if ((&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
$r->print('
'.&mt('User Can Request Creation of Courses/Communities in this Domain?').'
'.
&Apache::loncommon::start_data_table());
if ($env{'request.role.domain'} eq $ccdomain) {
$r->print(&build_tools_display($ccuname,$ccdomain,'requestcourses'));
} else {
- $r->print(&coursereq_externaluser($ccuname,$ccdomain,
- $env{'request.role.domain'}));
+ if (&Apache::lonnet::will_trust('reqcrs',$ccdomain,$env{'request.role.domain'})) {
+ $r->print(&coursereq_externaluser($ccuname,$ccdomain,
+ $env{'request.role.domain'}));
+ }
}
$r->print(&Apache::loncommon::end_data_table());
}
$r->print('');
- my @order = ('auth','quota','tools','requestauthor','adhocroles');
+ my @order = ('auth','quota','tools','requestauthor');
my %user_text;
my ($isadv,$isauthor) =
- &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
+ &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
if ((!$isauthor) &&
- (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))
- && ($env{'request.role.domain'} eq $ccdomain)) {
+ ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
+ (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&
+ ($env{'request.role.domain'} eq $ccdomain)) {
$user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
}
- if (&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) {
- $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain);
- }
$user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname);
if ((&Apache::lonnet::allowed('mpq',$ccdomain)) ||
- (&Apache::lonnet::allowed('mut',$ccdomain))) {
+ (&Apache::lonnet::allowed('mut',$ccdomain)) ||
+ (&Apache::lonnet::allowed('udp',$ccdomain))) {
# Current user has quota modification privileges
$user_text{'quota'} = &user_quotas($ccuname,$ccdomain);
}
@@ -1558,9 +1563,18 @@ ENDNOTOOLSPRIV
if ($gotdiv) {
$r->print('
');
}
+ my $statuses;
+ if (($context eq 'domain') && (&Apache::lonnet::allowed('udp',$ccdomain)) &&
+ (!&Apache::lonnet::allowed('mau',$ccdomain))) {
+ $statuses = ['active'];
+ } elsif (($context eq 'course') && ((&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) ||
+ ($env{'request.course.sec'} &&
+ &Apache::lonnet::allowed('vcl',$env{'request.course.id'}.'/'.$env{'request.course.sec'})))) {
+ $statuses = ['active'];
+ }
if ($env{'form.action'} ne 'singlestudent') {
&display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context,
- $roledom,$crstype);
+ $roledom,$crstype,$showcredits,$statuses);
}
} ## End of new user/old user logic
if ($env{'form.action'} eq 'singlestudent') {
@@ -1571,7 +1585,7 @@ ENDNOTOOLSPRIV
$btntxt = &mt('Enroll Student');
}
$r->print('