--- loncom/interface/lonrequestcourse.pm	2011/01/11 04:28:52	1.61
+++ loncom/interface/lonrequestcourse.pm	2013/08/23 00:47:57	1.63.6.1
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.61 2011/01/11 04:28:52 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.63.6.1 2013/08/23 00:47:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -712,7 +712,8 @@ END
         official => 'You are not permitted to request creation of an official course in this domain.',
         unofficial => 'You are not permitted to request creation of an unofficial course in this domain.',
         community => 'You are not permitted to request creation of a community this domain.',
-        all => 'You must choose a specific course type when making a new course request.\\n\"All types\" is not allowed.',
+        all => 'You must choose a specific course type when making a new course request.',
+        allt => '"All types" is not allowed.',
     ); 
     $js .= <<END;
     if (crschoice == 'official') {
@@ -734,7 +735,7 @@ END
                 }
             } else {
                 if (actionchoice == 'new') {
-                    alert("$lt{'all'}");
+                    alert('$lt{'all'}'+'\\n'+'$lt{'allt'}');
                     return false;
                 }               
             }
@@ -3163,7 +3164,7 @@ sub print_request_outcome {
         $enrollstart = '';
         $enrollend = '';
     }
-    my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg);
+    my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg,%skipped);
     for (my $i=0; $i<$env{'form.persontotal'}; $i++) {
         my $uname = $env{'form.person_'.$i.'_uname'};
         my $udom = $env{'form.person_'.$i.'_dom'};
@@ -3175,50 +3176,55 @@ sub print_request_outcome {
                              lastname     => $env{'form.person_'.$i.'_lastname'},
                              emailaddr    => $env{'form.person_'.$i.'_emailaddr'},
                                                    };
-                    my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);
-                    if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {
-                        my ($allowed,$msg,$authtype,$authparam) =
-                            &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,
-                                                 \%inst_results,\%curr_rules,\%got_rules);
-                        if ($allowed) {
-                            my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);
-                            if ($usertype eq 'official') {
-                                if ($authtype eq '') {
-                                    $authtype = $domdefaults{'auth_def'};
-                                    $authparam = $domdefaults{'auth_arg_def'};
-                                } else {
-                                    if ($authtype eq 'loc') {
-                                        $authtype = 'localauth';
-                                    } elsif ($authtype eq 'int') {
-                                        $authtype = 'internal';
-                                    }
-                                    if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {
+                    if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') {
+                        my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules);
+                        if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) {
+                            my ($allowed,$msg,$authtype,$authparam) =
+                                &check_newuser_rules($udom,$uname,\%alerts,\%rulematch,
+                                                     \%inst_results,\%curr_rules,\%got_rules);
+                            if ($allowed) {
+                                my %domdefaults = &Apache::lonnet::get_domain_defaults($udom);
+                                if ($usertype eq 'official') {
+                                    if ($authtype eq '') {
                                         $authtype = $domdefaults{'auth_def'};
                                         $authparam = $domdefaults{'auth_arg_def'};
+                                    } else {
+                                        if ($authtype eq 'loc') {
+                                            $authtype = 'localauth';
+                                        } elsif ($authtype eq 'int') {
+                                            $authtype = 'internal';
+                                        }
+                                        if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) {
+                                            $authtype = $domdefaults{'auth_def'};
+                                            $authparam = $domdefaults{'auth_arg_def'};
+                                        }
+                                    }
+                                } elsif ($usertype eq 'unofficial') {
+                                    if ($authtype eq '') {
+                                        $authtype = 'internal';
+                                        $authparam = '';
                                     }
+                                } else {
+                                    $authtype = $domdefaults{'auth_def'};
+                                    $authparam = $domdefaults{'auth_arg_def'};
                                 }
-                            } elsif ($usertype eq 'unofficial') {
-                                if ($authtype eq '') {
-                                    $authtype = 'internal';
-                                    $authparam = '';
+                                if (($authtype eq '') ||
+                                    (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||
+                                    ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {
+                                    $skipped{$uname.':'.$udom} = 1;
+                                    next;
+                                } else {
+                                    $personnel{$uname.':'.$udom}{'authtype'} = $authtype;
+                                    $personnel{$uname.':'.$udom}{'autharg'} = $authparam;
                                 }
                             } else {
-                                $authtype = $domdefaults{'auth_def'};
-                                $authparam = $domdefaults{'auth_arg_def'};
-                            }
-                            if (($authtype eq '') ||
-                                (($authtype =~/^krb(4|5)$/) && ($authparam eq '')) ||
-                                ($authtype !~ /^(krb4|krb5|internal|localauth)$/)) {
+                                $skipped{$uname.':'.$udom} = 1;
                                 next;
-                            } else {
-                                $personnel{$uname.':'.$udom}{'authtype'} = $authtype;
-                                $personnel{$uname.':'.$udom}{'autharg'} = $authparam;
                             }
                         } else {
+                            $skipped{$uname.':'.$udom} = 1;
                             next;
                         }
-                    } else {
-                        next;
                     }
                 }
                 my $role = $env{'form.person_'.$i.'_role'};
@@ -3265,6 +3271,11 @@ sub print_request_outcome {
             push(@baduname,$uname.':'.$udom);
         }
     }
+    if (keys(%skipped)) {
+        foreach my $key (keys(%skipped)) {
+            delete($personnel{$key}); 
+        }
+    }
     my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend');
     my $autodrops = 0;
     if ($env{'form.autodrops'}) {
@@ -3479,7 +3490,7 @@ sub print_request_outcome {
         }
         ($storeresult,my $updateresult) = 
             &Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom,
-                $cnum,$reqstatus,'request');
+                $cnum,$reqstatus,'request',$env{'user.domain'},$env{'user.name'});
         if ($modified && $queued && $storeresult eq 'ok') {
             if ($crstype eq 'community') {
                 $output .= '<p>'.&mt('Your community request has been updated').'</p>';