--- loncom/interface/loncreateuser.pm 2010/10/11 15:38:17 1.329.2.5 +++ loncom/interface/loncreateuser.pm 2011/06/20 19:04:42 1.355 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.329.2.5 2010/10/11 15:38:17 raeburn Exp $ +# $Id: loncreateuser.pm,v 1.355 2011/06/20 19:04:42 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -219,7 +219,7 @@ END_SCRIPT sub build_tools_display { my ($ccuname,$ccdomain,$context) = @_; my (@usertools,%userenv,$output,@options,%validations,%reqtitles,%reqdisplay, - $colspan); + $colspan,$isadv,%domconfig); my %lt = &Apache::lonlocal::texthash ( 'blog' => "Personal User Blog", 'aboutme' => "Personal Information Page", @@ -243,6 +243,9 @@ sub build_tools_display { %reqtitles = &courserequest_titles(); %reqdisplay = &courserequest_display(); $colspan = ' colspan="2"'; + %domconfig = + &Apache::lonnet::get_dom('configuration',['requestcourses'],$ccdomain); + $isadv = &Apache::lonnet::is_advanced_user($ccuname,$ccdomain); } else { %userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname, 'tools.aboutme','tools.portfolio','tools.blog'); @@ -289,7 +292,14 @@ sub build_tools_display { &Apache::loncommon::start_data_table_row()."\n"; if ($context eq 'requestcourses') { my ($curroption,$currlimit); - $curroption = $userenv{$context.'.'.$item}; + if ($userenv{$context.'.'.$item} ne '') { + $curroption = $userenv{$context.'.'.$item}; + } else { + my (@inststatuses); + $curroption = + &Apache::loncoursequeueadmin::get_processtype($ccuname,$ccdomain,$isadv,$ccdomain, + $item,\@inststatuses,\%domconfig); + } if (!$curroption) { $curroption = 'norequest'; } @@ -472,7 +482,6 @@ sub print_username_entry_form { my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum) = @_; my $defdom=$env{'request.role.domain'}; my $formtoset = 'crtuser'; - my $is_custom = &Apache::loncommon::needs_gci_custom(); if (exists($env{'form.startrolename'})) { $formtoset = 'docustom'; $env{'form.rolename'} = $env{'form.startrolename'}; @@ -494,12 +503,6 @@ sub print_username_entry_form { && (&Apache::lonnet::allowed('mcr','/'))) { $jscript .= &customrole_javascript(); } - my $title = 'User Management'; - if ($context eq 'course') { - if ($is_custom) { - $title = 'Enrollment and Student Activity'; - } - } my $helpitem = 'Course_Change_Privileges'; if ($env{'form.action'} eq 'custom') { $helpitem = 'Course_Editing_Custom_Roles'; @@ -528,7 +531,7 @@ sub print_username_entry_form { my $args = {bread_crumbs => $brcrum, bread_crumbs_component => 'User Management', add_entries => \%loaditems,}; - $r->print(&Apache::loncommon::start_page($title,$jscript,$args)); + $r->print(&Apache::loncommon::start_page('User Management',$jscript,$args)); my %lt=&Apache::lonlocal::texthash( 'srst' => 'Search for a user and enroll as a student', @@ -540,6 +543,7 @@ sub print_username_entry_form { 'nr' => "role name", 'cre' => "Next", ); + if ($env{'form.action'} eq 'custom') { if (&Apache::lonnet::allowed('mcr','/')) { my $newroletext = &mt('Define new custom role:'); @@ -634,7 +638,6 @@ END sub entry_form { my ($dom,$srch,$forcenewuser,$context,$responsemsg,$crstype) = @_; - my %domconf = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom); my ($usertype,$inexact); if (ref($srch) eq 'HASH') { if (($srch->{'srchin'} eq 'dom') && @@ -642,9 +645,10 @@ sub entry_form { ($srch->{'srchtype'} eq 'exact') && ($srch->{'srchdomain'} ne '') && ($srch->{'srchterm'} ne '')) { + my (%curr_rules,%got_rules); my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($srch->{'srchdomain'},'username'); - $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules); + $usertype = &Apache::lonuserutils::check_usertype($srch->{'srchdomain'},$srch->{'srchterm'},$rules,\%curr_rules,\%got_rules); } else { $inexact = 1; } @@ -670,7 +674,7 @@ $userpicker ENDBLOCK if ($env{'form.phase'} eq '') { my $defdom=$env{'request.role.domain'}; - my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain','',1); + my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain'); my %lt=&Apache::lonlocal::texthash( 'enro' => 'Enroll one student', 'enrm' => 'Enroll one member', @@ -719,7 +723,7 @@ $showresponse
$lt{'usr'}: | -+ | $lt{'dom'}: | $domform | $sellink | @@ -764,7 +768,6 @@ sub print_user_selection_page { my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype,$brcrum) = @_; my @fields = ('username','domain','lastname','firstname','permanentemail'); my $sortby = $env{'form.sortby'}; - my $is_custom = &Apache::loncommon::needs_gci_custom(); if (!grep(/^\Q$sortby\E$/,@fields)) { $sortby = 'lastname'; @@ -803,12 +806,6 @@ ENDSCRIPT if ($context eq 'requestcrs') { $r->print(' |