[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncreateuser.pm

raeburn raeburn at source.lon-capa.org
Fri Sep 14 10:57:52 EDT 2018


raeburn		Fri Sep 14 14:57:52 2018 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncreateuser.pm 
  Log:
  - For 2.11
    Backport 1.441, 1.447, 1.448.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.406.2.14 loncom/interface/loncreateuser.pm:1.406.2.15
--- loncom/interface/loncreateuser.pm:1.406.2.14	Sun Apr  2 12:40:18 2017
+++ loncom/interface/loncreateuser.pm	Fri Sep 14 14:57:52 2018
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.406.2.14 2017/04/02 12:40:18 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.406.2.15 2018/09/14 14:57:52 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4679,16 +4679,41 @@
         if (! exists($env{'form.state'})) {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         } elsif ($env{'form.state'} eq 'got_file') {
-            &Apache::lonuserutils::print_upload_manager_form($r,$context,$permission,
-                                                             $crstype,$showcredits);
+            my $result =
+                &Apache::lonuserutils::print_upload_manager_form($r,$context,
+                                                                 $permission,
+                                                                 $crstype,$showcredits);
+            if ($result eq 'missingdata') {
+                delete($env{'form.state'});
+                &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+            }
         } elsif ($env{'form.state'} eq 'enrolling') {
             if ($env{'form.datatoken'}) {
-                &Apache::lonuserutils::upfile_drop_add($r,$context,$permission,
-                                                       $showcredits);
+                my $result = &Apache::lonuserutils::upfile_drop_add($r,$context,
+                                                                    $permission,
+                                                                    $showcredits);
+                if ($result eq 'missingdata') {
+                    delete($env{'form.state'});
+                    &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+                } elsif ($result eq 'invalidhome') {
+                    $env{'form.state'} = 'got_file';
+                    delete($env{'form.lcserver'});
+                    my $result =
+                        &Apache::lonuserutils::print_upload_manager_form($r,$context,$permission,
+                                                                         $crstype,$showcredits);
+                    if ($result eq 'missingdata') {
+                        delete($env{'form.state'});
+                        &Apache::lonuserutils::print_first_users_upload_form($r,$context);
+                    }
+                }
+            } else {
+                delete($env{'form.state'});
+                &Apache::lonuserutils::print_first_users_upload_form($r,$context);
             }
         } else {
             &Apache::lonuserutils::print_first_users_upload_form($r,$context);
         }
+        $r->print('</form>');
     } elsif (((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
               eq 'singlestudent')) && ($permission->{'cusr'})) ||
              (($env{'form.action'} eq 'singleuser') && ($permission->{'view'})) ||
@@ -5817,12 +5842,13 @@
 }
 
 function check_types(num,countfail,needaction) {
-    var typeidx = getIndexByName('selfenroll_types_'+num);
+    var boxname = 'selfenroll_types_'+num;
+    var typeidx = getIndexByName(boxname);
     var count = 0;
     if (typeidx != -1) {
-        if (document.$formname.elements[typeidx].length) {
-            for (var k=0; k<document.$formname.elements[typeidx].length; k++) {
-                if (document.$formname.elements[typeidx][k].checked) {
+        if (document.$formname.elements[boxname].length) {
+            for (var k=0; k<document.$formname.elements[boxname].length; k++) {
+                if (document.$formname.elements[boxname][k].checked) {
                     count ++;
                 }
             }




More information about the LON-CAPA-cvs mailing list