--- loncom/interface/loncreateuser.pm 2016/11/13 15:47:04 1.406.2.7 +++ loncom/interface/loncreateuser.pm 2016/11/12 00:39:39 1.422 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.406.2.7 2016/11/13 15:47:04 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.422 2016/11/12 00:39:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -252,13 +252,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(); @@ -333,6 +335,7 @@ sub build_tools_display { ' '.$lt{$item}.''."\n". ' '."\n". &Apache::loncommon::start_data_table_row()."\n"; + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { my ($curroption,$currlimit); my $envkey = $context.'.'.$item; @@ -451,12 +454,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); @@ -615,6 +620,7 @@ sub courserequest_titles { unofficial => 'Unofficial', community => 'Communities', textbook => 'Textbook', + placement => 'Placement Tests', norequest => 'Not allowed', approval => 'Approval by Dom. Coord.', validate => 'With validation', @@ -932,7 +938,7 @@ ENDBLOCK $output = '

'.$userpicker.'

'; } if (($env{'form.phase'} eq '') && ($env{'form.action'} ne 'accesslogs') && - (!(($env{'form.action'} eq 'singleuser') && ($context eq 'domain') && + (!(($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'); @@ -1513,7 +1519,7 @@ ENDAUTH $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()); @@ -1533,10 +1539,10 @@ ENDAUTH if ((!$isauthor) && ((&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) || (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) && - ($env{'request.role.domain'} eq $ccdomain)) { + ($env{'request.role.domain'} eq $ccdomain)) { $user_text{'requestauthor'} = &domainrole_req($ccuname,$ccdomain); } - if ((&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) || + if ((&Apache::lonnet::allowed('cdh',$env{'request.role.domain'})) || (&Apache::lonnet::allowed('udp',$env{'request.role.domain'}))) { $user_text{'adhocroles'} = &domadhocroles($ccuname,$ccdomain); } @@ -1608,7 +1614,7 @@ ENDNOTOOLSPRIV } 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']; + $statuses = ['active']; } if ($env{'form.action'} ne 'singlestudent') { &display_existing_roles($r,$ccuname,$ccdomain,\%inccourses,$context, @@ -1842,7 +1848,7 @@ sub display_existing_roles { if ($active) { next unless($showall || $showactive); } else { - next unless($showall || $showexpired); + next unless($showall || $showexpired); } # Is this a custom role? Get role owner and title. my ($croleudom,$croleuname,$croletitle)= @@ -1987,7 +1993,7 @@ sub display_existing_roles { } else { $row.=' '; } - $row.= ''; + $row.= ''; } my $plaintext=''; if (!$croletitle) { @@ -2256,6 +2262,7 @@ $lt{'uuas'} ($currentauth). $lt{'adcs'}. ENDBADAUTH } } else { # Authentication type is valid + &initialize_authen_forms($ccdomain,$formname,$currentauth,'modifyuser'); my ($authformcurrent,$can_modify,@authform_others) = &modify_login_block($ccdomain,$currentauth); @@ -2814,7 +2821,7 @@ sub update_user_data { my (%alerts,%rulematch,%inst_results,%curr_rules); my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); my @usertools = ('aboutme','blog','webdav','portfolio'); - my @requestcourses = ('official','unofficial','community','textbook'); + my @requestcourses = ('official','unofficial','community','textbook','placement'); my @requestauthor = ('requestauthor'); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); @@ -2993,7 +3000,8 @@ sub update_user_data { 'requestcourses.community','requestcourses.textbook', 'reqcrsotherdom.official','reqcrsotherdom.unofficial', 'reqcrsotherdom.community','reqcrsotherdom.textbook', - 'requestauthor','adhocroles.'.$env{'request.role.domain'}], + 'reqcrsotherdom.placement','requestauthor', + 'adhocroles.'.$env{'request.role.domain'}], $env{'form.ccdomain'},$env{'form.ccuname'}); my ($tmp) = keys(%userenv); if ($tmp =~ /^(con_lost|error)/i) { @@ -3296,8 +3304,9 @@ sub update_user_data { ($env{'user.domain'} eq $env{'form.ccdomain'})) { my %newenvhash; foreach my $key (keys(%changed)) { - if (($key eq 'official') || ($key eq 'unofficial') - || ($key eq 'community') || ($key eq 'textbook')) { + if (($key eq 'official') || ($key eq 'unofficial') || + ($key eq 'community') || ($key eq 'textbook') || + ($key eq 'placement')) { $newenvhash{'environment.requestcourses.'.$key} = $changeHash{'requestcourses.'.$key}; if ($changeHash{'requestcourses.'.$key}) { @@ -3366,7 +3375,7 @@ sub update_user_data { \%newsettingstext); if ($env{'form.cid'} ne $userenv{'id'}) { &Apache::lonnet::idput($env{'form.ccdomain'}, - {$env{'form.ccuname'} => $env{'form.cid'}}); + {$env{'form.ccuname'} => $env{'form.cid'}},$uhome,'ids'); if (($recurseid) && (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { my $idresult = @@ -3509,6 +3518,7 @@ sub display_userinfo { 'unofficial' => 'Can Request Unofficial Courses', 'community' => 'Can Request Communities', 'textbook' => 'Can Request Textbook Courses', + 'placement' => 'Can Request Placement Tests', 'requestauthor' => 'Can Request Author Role', 'adhocroles' => 'Ad Hoc Roles Selectable via Helpdesk Role', 'inststatus' => "Affiliation", @@ -4549,7 +4559,7 @@ sub custom_role_editor { ); my $args = { bread_crumbs => $brcrum, bread_crumbs_component => 'User Management'}; - + $r->print(&Apache::loncommon::start_page('Custom Role Editor', $head_script,$args). $body_top); @@ -5190,13 +5200,12 @@ sub handler { } elsif ($env{'form.state'} eq 'done') { $r->print('

'.&mt('Enrollment request processing').'

'."\n"); $r->print(&Apache::loncoursequeueadmin::update_request_queue($context, - $cdom,$cnum,$coursedesc)); + $cdom,$cnum,$coursedesc)); } } else { $r->print(&header(undef,{'no_nav_bar' => 1}). ''.&mt('You do not have permission to manage self-enrollment').''); } - } elsif ($env{'form.action'} eq 'changelogs') { if ($permission->{cusr} || $permission->{view}) { &print_userchangelogs_display($r,$context,$permission,$brcrum); @@ -5457,9 +5466,9 @@ sub print_main_menu { ); if ($linkcontext eq 'domain') { unless ($permission->{'cusr'}) { - $links{'domain'}{'singleuser'} = 'View a User'; + $links{'domain'}{'singleuser'} = 'View a User'; $linktitles{'domain'}{'singleuser'} = 'View information about a user in the domain'; - + } } elsif ($linkcontext eq 'course') { unless ($permission->{'cusr'}) { @@ -5577,6 +5586,7 @@ sub print_main_menu { groups => 'Community Groups', }, ); + $linktext{'Placement'} = $linktext{'Course'}; my %linktitle = ( 'Course' => { @@ -5591,6 +5601,8 @@ sub print_main_menu { }, ); + $linktitle{'Placement'} = $linktitle{'Course'}; + push(@{ $menu[0]->{items} }, #Category: Single Users { linktext => $linktext{$crstype}{'single'}, @@ -6202,7 +6214,7 @@ ENDSCRIPT } elsif ($item eq 'approval') { my ($currnotified,$currapproval,%appchecked); my %selfdescs = &Apache::lonuserutils::selfenroll_default_descs(); - if (ref($currsettings) eq 'HASH') { + if (ref($currsettings) eq 'HASH') { $currnotified = $currsettings->{'selfenroll_notifylist'}; $currapproval = $currsettings->{'selfenroll_approval'}; } @@ -6330,8 +6342,8 @@ ENDSCRIPT .&mt('Save').'" onclick="validate_types(this.form);" />'; } $output .= '' - .''."\n" - .$additional.''; + .''."\n" + .$additional.''; $r->print($output); return; } @@ -6736,7 +6748,7 @@ ENDSCRIPT } } if (($context eq 'course') && ($viewablesec ne '')) { - next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec); + next if ($roleslog{$id}{'logentry'}{'section'} ne $viewablesec); } $count ++; next if ($count < $minshown); @@ -7786,6 +7798,7 @@ sub build_search_response { ,' ' ,'') .'
'; + } } }