--- loncom/interface/loncreateuser.pm 2023/01/22 17:14:57 1.406.2.20.2.3
+++ loncom/interface/loncreateuser.pm 2016/10/22 17:56:12 1.417
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.406.2.20.2.3 2023/01/22 17:14:57 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.417 2016/10/22 17:56:12 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -71,7 +71,6 @@ use Apache::longroup;
use Apache::lonuserutils;
use Apache::loncoursequeueadmin;
use LONCAPA qw(:DEFAULT :match);
-use HTML::Entities;
my $loginscript; # piece of javascript used in two separate instances
my $authformnop;
@@ -161,8 +160,7 @@ END_SCRIPT
'
');
} else {
- my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$srch->{'srchdomain'});
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype);
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,'','')",
@@ -1037,19 +1066,9 @@ ENDSCRIPT
);
$r->print(&Apache::loncommon::start_page('User Management',$jscript,{bread_crumbs => $brcrum}));
if ($env{'form.action'} eq 'singleuser') {
- 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("
$lt{'usrch'}");
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
- if ($readonly) {
- $r->print('
'.$lt{'suvr'}.'
');
- } else {
- $r->print('
'.$lt{'usel'}.'
');
- }
+ $r->print('
'.$lt{'usel'}.'
');
} elsif ($env{'form.action'} eq 'singlestudent') {
$r->print($jscript."
");
if ($crstype eq 'Community') {
@@ -1068,7 +1087,7 @@ ENDSCRIPT
$r->print('');
} elsif ($env{'form.action'} eq 'accesslogs') {
$r->print("$lt{'srcva'}
");
- $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,undef,1));
+ $r->print(&entry_form($srch->{'srchdomain'},$srch,undef,'accesslogs',undef,undef,1));
$r->print(''.$lt{'vacsel'}.'
');
}
}
@@ -1149,8 +1168,7 @@ 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,
- $permission);
+ &print_username_entry_form($r,$context,$usermsg,'','',$crstype,$brcrum);
return;
}
my ($form,$formname);
@@ -1189,18 +1207,12 @@ sub print_user_modification_page {
}
$response .= ''
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
- .' ';
- 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 .= '
';
+ .' '
+ .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'
','')
+ .'
';
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum,
- $permission);
+ &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
return;
}
$newuser = 1;
@@ -1224,8 +1236,7 @@ sub print_user_modification_page {
'username');
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum,
- $permission);
+ &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum);
return;
}
}
@@ -1246,14 +1257,10 @@ sub print_user_modification_page {
my $js = &validation_javascript($context,$ccdomain,$pjump_def,$crstype,
$groupslist,$newuser,$formname,\%loaditem);
- my %breadcrumb_text = &singleuser_breadcrumb($crstype,$context,$ccdomain);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype);
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)",
@@ -1316,7 +1323,7 @@ ENDFORMINFO
}
my $title = '';
if ($newuser) {
- my ($portfolioform,$domroleform);
+ my ($portfolioform,$domroleform,$adhocroleform);
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
@@ -1326,6 +1333,12 @@ 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',
@@ -1436,7 +1449,7 @@ ENDAUTH
} else {
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
}
- $r->print($portfolioform.$domroleform);
+ $r->print($portfolioform.$domroleform.$adhocroleform);
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname,
$permission,$crstype,$ccuname,
@@ -1454,20 +1467,14 @@ ENDAUTH
'"'.$ccuname.'"','"'.$ccdomain.'"');
}
} else {
- if ($permission->{'cusr'}) {
- $title = &mt('Modify existing user: [_1] in domain [_2]',
- '"'.$ccuname.'"','"'.$ccdomain.'"');
- } else {
- $title = &mt('Existing user: [_1] in domain [_2]',
+ $title = &mt('Modify 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'})) ||
- (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) {
+ if (&Apache::lonnet::allowed('ccc',$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) {
@@ -1479,20 +1486,21 @@ ENDAUTH
$r->print(&Apache::loncommon::end_data_table());
}
$r->print('');
- my @order = ('auth','quota','tools','requestauthor');
+ my @order = ('auth','quota','tools','requestauthor','adhocroles');
my %user_text;
my ($isadv,$isauthor) =
- &Apache::lonnet::is_advanced_user($ccdomain,$ccuname);
+ &Apache::lonnet::is_advanced_user($ccuname,$ccdomain);
if ((!$isauthor) &&
- ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
- (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) &&
- ($env{'request.role.domain'} eq $ccdomain)) {
+ (&Apache::lonnet::allowed('cau',$env{'request.role.domain'}))
+ && ($env{'request.role.domain'} eq $ccdomain)) {
$user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain);
}
- $user_text{'auth'} = &user_authentication($ccuname,$ccdomain,$formname,$crstype,$permission);
+ 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('udp',$ccdomain))) {
+ (&Apache::lonnet::allowed('mut',$ccdomain))) {
# Current user has quota modification privileges
$user_text{'quota'} = &user_quotas($ccuname,$ccdomain);
}
@@ -1550,18 +1558,9 @@ 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,$showcredits,$statuses);
+ $roledom,$crstype);
}
} ## End of new user/old user logic
if ($env{'form.action'} eq 'singlestudent') {
@@ -1572,7 +1571,7 @@ ENDNOTOOLSPRIV
$btntxt = &mt('Enroll Student');
}
$r->print('