--- loncom/interface/loncreateuser.pm 2011/06/20 19:04:42 1.355 +++ loncom/interface/loncreateuser.pm 2012/02/06 04:50:52 1.358.4.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Create a user # -# $Id: loncreateuser.pm,v 1.355 2011/06/20 19:04:42 www Exp $ +# $Id: loncreateuser.pm,v 1.358.4.1 2012/02/06 04:50:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -674,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'); + my $domform = &Apache::loncommon::select_dom_form($defdom,'srchdomain','',1); my %lt=&Apache::lonlocal::texthash( 'enro' => 'Enroll one student', 'enrm' => 'Enroll one member', @@ -723,7 +723,7 @@ $showresponse - + @@ -938,12 +938,18 @@ sub print_user_modification_page { my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules); my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); if ($uhome eq 'no_host') { - my $usertype; + my $lc_ccuname = lc($ccuname); + if ($lc_ccuname ne $ccuname) { + $uhome = &Apache::lonnet::homeserver($lc_ccuname,$ccdomain); + $ccuname = $lc_ccuname; + } + } + if ($uhome eq 'no_host') { my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($ccdomain,'username'); - $usertype = - &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules, - \%curr_rules,\%got_rules); + my $usertype = + &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules, + \%curr_rules,\%got_rules); my $cancreate = &Apache::lonuserutils::can_create_user($ccdomain,$context, $usertype); @@ -1322,7 +1328,7 @@ ENDNOTOOLSPRIV $addrolesdisplay = &new_coauthor_roles($r,$ccuname,$ccdomain); } if ($context eq 'domain') { - my $add_domainroles = &new_domain_roles($r); + my $add_domainroles = &new_domain_roles($r,$ccdomain); if (!$addrolesdisplay) { $addrolesdisplay = $add_domainroles; } @@ -1765,7 +1771,7 @@ sub new_coauthor_roles { } sub new_domain_roles { - my ($r) = @_; + my ($r,$ccdomain) = @_; my $addrolesdisplay = 0; # # Domain level @@ -1783,6 +1789,7 @@ sub new_domain_roles { foreach my $thisdomain (sort(&Apache::lonnet::all_domains())) { foreach my $role (@allroles) { next if ($role eq 'ad'); + next if (($role eq 'au') && ($ccdomain ne $thisdomain)); if (&Apache::lonnet::allowed('c'.$role,$thisdomain)) { my $plrole=&Apache::lonnet::plaintext($role); my %lt=&Apache::lonlocal::texthash( @@ -4041,6 +4048,10 @@ sub handler { my ($permission,$allowed) = &Apache::lonuserutils::get_permission($context,$crstype); if (!$allowed) { + if ($context eq 'course') { + $r->internal_redirect('/adm/viewclasslist'); + return OK; + } $env{'user.error.msg'}= "/adm/createuser:cst:0:0:Cannot create/modify user data ". "or view user status."; @@ -4095,7 +4106,9 @@ sub handler { if ($env{'form.phase'} eq 'createnewuser') { my $response; if ($env{'form.srchterm'} !~ /^$match_username$/) { - my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); + my $response = '

'. + &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'). + '

'; $env{'form.phase'} = ''; &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum); } else { @@ -5609,7 +5622,9 @@ sub user_search_result { if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) { if (($srch->{'srchdomain'} eq '') || ! (&Apache::lonnet::domain($srch->{'srchdomain'}))) { - $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.') + $response = '

'. + &mt('You must specify a valid domain when searching in a domain or institutional directory.'). + '

'; } } if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') || @@ -5622,7 +5637,9 @@ sub user_search_result { } } if ($unamecheck !~ /^$match_username$/) { - $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'); + $response = '

'. + &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @'). + '

'; } } } @@ -5797,7 +5814,8 @@ sub user_search_result { ($currstate,$response,$forcenewuser) = &build_search_response($context,$srch,%srch_results); } else { - my $showdom = &display_domain_info($srch->{'srchdomain'}); $response = ''. + my $showdom = &display_domain_info($srch->{'srchdomain'}); + $response = ''. &mt('Institutional directory search is not available in domain: [_1]',$showdom). '
'. &mt('You may want to search in the LON-CAPA domain instead of the institutional directory.'). @@ -6208,7 +6226,7 @@ sub course_level_dc { ''. ''; my $courseform=&Apache::loncommon::selectcourse_link - ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Community','crstype'); + ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Select','crstype'); my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu','role','Course/Community Browser'); my %lt=&Apache::lonlocal::texthash( 'rol' => "Role", @@ -6227,8 +6245,8 @@ sub course_level_dc { '
'. &Apache::loncommon::end_data_table_header_row(); my $otheritems = &Apache::loncommon::start_data_table_row()."\n". - ''."\n". + ''."\n". '
$lt{'usr'}:  $lt{'dom'}:$domform  $sellink   '.$lt{'scc'}.''.$lt{'rol'}.''.$lt{'grs'}.''.$lt{'sta'}.''.$lt{'end'}.'
'. - $courseform.'

'. + $courseform.(' ' x4).'