--- loncom/interface/loncreateuser.pm 2014/02/12 21:29:03 1.391
+++ loncom/interface/loncreateuser.pm 2016/10/04 21:02:16 1.414
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.391 2014/02/12 21:29:03 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.414 2016/10/04 21:02:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -251,13 +251,15 @@ sub build_tools_display {
'unofficial' => 'Can request creation of unofficial courses',
'community' => 'Can request creation of communities',
'textbook' => 'Can request creation of textbook courses',
+ 'placement' => 'Can request creation of placement tests',
'requestauthor' => 'Can request author space',
);
if ($context eq 'requestcourses') {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'requestcourses.official','requestcourses.unofficial',
- 'requestcourses.community','requestcourses.textbook');
- @usertools = ('official','unofficial','community','textbook');
+ 'requestcourses.community','requestcourses.textbook',
+ 'requestcourses.placement');
+ @usertools = ('official','unofficial','community','textbook','placement');
@options =('norequest','approval','autolimit','validate');
%validations = &Apache::lonnet::auto_courserequest_checks($ccdomain);
%reqtitles = &courserequest_titles();
@@ -447,12 +449,14 @@ sub coursereq_externaluser {
'unofficial' => 'Can request creation of unofficial courses',
'community' => 'Can request creation of communities',
'textbook' => 'Can request creation of textbook courses',
+ 'placement' => 'Can request creation of placement tests',
);
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
'reqcrsotherdom.official','reqcrsotherdom.unofficial',
- 'reqcrsotherdom.community','reqcrsotherdom.textbook');
- @usertools = ('official','unofficial','community','textbook');
+ 'reqcrsotherdom.community','reqcrsotherdom.textbook',
+ 'reqcrsotherdom.placement');
+ @usertools = ('official','unofficial','community','textbook','placement');
@options = ('approval','validate','autolimit');
%validations = &Apache::lonnet::auto_courserequest_checks($cdom);
my $optregex = join('|',@options);
@@ -527,12 +531,79 @@ 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 '') { my $defdom=$env{'request.role.domain'}; my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); @@ -1231,7 +1307,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 @@ -1241,6 +1317,12 @@ ENDFORMINFO ($ccdomain eq $env{'request.role.domain'})) { $domroleform = ''); if ($crstype eq 'Community') { - $r->print(&mt('If the member is currently logged-in to LON-CAPA, the new role will be available when the member next logs in.')); + $r->print(&mt('If the member is currently logged-in to LON-CAPA, the new role can be displayed by using the "Check for changes" link on the Roles/Courses page.')); } else { - $r->print(&mt('If the student is currently logged-in to LON-CAPA, the new role will be available when the student next logs in.')); + $r->print(&mt('If the student is currently logged-in to LON-CAPA, the new role can be displayed by using the "Check for changes" link on the Roles/Courses page.')); } $r->print('
'); } @@ -4145,7 +4323,7 @@ sub build_roles { # ========================================================== Custom Role Editor sub custom_role_editor { - my ($r,$brcrum) = @_; + my ($r,$brcrum,$prefix) = @_; my $action = $env{'form.customroleaction'}; my $rolename; if ($action eq 'new') { @@ -4160,7 +4338,7 @@ sub custom_role_editor { $context = 'course'; } else { $context = 'domain'; - $crstype = $env{'form.templatecrstype'}; + $crstype = 'course'; } $rolename=~s/[^A-Za-z0-9]//gs; @@ -4169,118 +4347,54 @@ sub custom_role_editor { return; } -# ------------------------------------------------------- What can be assigned? - my %full=(); - my %courselevel=(); - my %courselevelcurrent=(); - my $syspriv=''; - my $dompriv=''; - my $coursepriv=''; - my $body_top; + my $formname = 'form1'; + my %privs=(); + my $body_top = ''.$visactions->{'vis'}.'
'; + + my $visactions = &cat_visibility(); + my ($cathash,%cattype); + my %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom); + if (ref($domconfig{'coursecategories'}) eq 'HASH') { + $cathash = $domconfig{'coursecategories'}{'cats'}; + $cattype{'auth'} = $domconfig{'coursecategories'}{'auth'}; + $cattype{'unauth'} = $domconfig{'coursecategories'}{'unauth'}; + if ($cattype{'auth'} eq '') { + $cattype{'auth'} = 'std'; + } + if ($cattype{'unauth'} eq '') { + $cattype{'unauth'} = 'std'; + } + } else { + $cathash = {}; + $cattype{'auth'} = 'std'; + $cattype{'unauth'} = 'std'; + } + if (($cattype{'auth'} eq 'none') && ($cattype{'unauth'} eq 'none')) { + $r->print(''.$visactions->{'miss'}.'
' - .$visactions->{'yous'}. - ''.$visactions->{'gen'}.'
'.$visactions->{'coca'};
- if (ref($vismsgs) eq 'ARRAY') {
- $output .= '
'.$visactions->{'make'}.'
'.$visactions->{'vis'}.'
'; + } else { + $output .= ''.$visactions->{'miss'}.'
' + .$visactions->{'yous'}. + ''.$visactions->{'gen'}.'
'.$visactions->{'coca'};
+ if (ref($vismsgs) eq 'ARRAY') {
+ $output .= '
'.$visactions->{'make'}.'