[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm lonuserutils.pm

raeburn raeburn at source.lon-capa.org
Sat Nov 4 16:23:23 EDT 2017


raeburn		Sat Nov  4 20:23:23 2017 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm lonuserutils.pm 
  Log:
  - When current action is 'upload', opening <form> tag is provided by
    loncreateuser::handler -- add the same for the closing </form> tag.
  - Eliminate duplicated <form> tags provided by routines in lonuserutils.pm 
    called in this context by loncreateuser, and remove code in lonuserutils.pm
    which provides </form> (no longer needed).
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.446 loncom/interface/loncreateuser.pm:1.447
--- loncom/interface/loncreateuser.pm:1.446	Fri Aug 11 00:24:53 2017
+++ loncom/interface/loncreateuser.pm	Sat Nov  4 20:23:23 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.446 2017/08/11 00:24:53 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.447 2017/11/04 20:23:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4760,6 +4760,7 @@
         } 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'})) ||
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.191 loncom/interface/lonuserutils.pm:1.192
--- loncom/interface/lonuserutils.pm:1.191	Sat Nov  4 16:13:31 2017
+++ loncom/interface/lonuserutils.pm	Sat Nov  4 20:23:23 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.191 2017/11/04 16:13:31 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.192 2017/11/04 20:23:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4133,10 +4133,6 @@
             $fields{$env{'form.f'.$i}}=$keyfields[$i];
         }
     }
-    if ($env{'form.fullup'} ne 'yes') {
-        $r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n".
-                  '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />');
-    }
     #
     # Store the field choices away
     my @storefields = qw/username names fname mname lname gen id 
@@ -4180,12 +4176,9 @@
                 if (&Apache::lonnet::will_trust('enroll',$crsdom,$env{'form.defaultdomain'})) {
                     $domain = $env{'form.defaultdomain'};
                 } else {
-                    $r->print('<span class="LC_error">'.&mt('Error').
+                    $r->print('<span class="LC_error">'.&mt('Error').': '.
                               &mt('Enrollment of users not permitted for specified default domain: [_1].',
                                   &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>');
-                    if ($env{'form.fullup'} ne 'yes') {
-                        $r->print('</form>');
-                    }
                     return;
                 }
             }
@@ -4197,12 +4190,9 @@
                     (&Apache::lonnet::will_trust('coaurem',$env{'form.defaultdomain'},$defdom))) {
                     $domain = $env{'form.defaultdomain'};
                 } else {
-                    $r->print('<span class="LC_error">'.&mt('Error').
+                    $r->print('<span class="LC_error">'.&mt('Error').': '.
                               &mt('Addition of users not permitted for specified default domain: [_1].',
                                   &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>');
-                    if ($env{'form.fullup'} ne 'yes') {
-                        $r->print('</form>');
-                    }
                     return;
                 }
             }
@@ -4213,12 +4203,9 @@
                 if (&Apache::lonnet::will_trust('domroles',$defdom,$env{'form.defaultdomain'})) {
                     $domain = $env{'form.defaultdomain'};
                 } else {
-                    $r->print('<span class="LC_error">'.&mt('Error').
+                    $r->print('<span class="LC_error">'.&mt('Error').': '.
                               &mt('Addition of users not permitted for specified default domain: [_1].',
                                   &Apache::lonnet::domain($env{'form.defaultdomain'},'description')).'</span>');
-                    if ($env{'form.fullup'} ne 'yes') {
-                        $r->print('</form>');
-                    }
                     return;
                 }
             }
@@ -4232,11 +4219,8 @@
     } else {
         my %home_servers = &Apache::lonnet::get_servers($defdom,'library');
         if (! exists($home_servers{$desiredhost})) {
-            $r->print('<span class="LC_error">'.&mt('Error').
+            $r->print('<span class="LC_error">'.&mt('Error').': '.
                       &mt('Invalid home server specified').'</span>');
-            if ($env{'form.fullup'} ne 'yes') {
-                $r->print('</form>');
-            }
             return;
         }
     }
@@ -4264,7 +4248,7 @@
     }
     if ($amode =~ /^krb/) {
         if (! defined($genpwd) || $genpwd eq '') {
-            $r->print('<span class="Error">'.
+            $r->print('<span class="Error">'.': '.
                       &mt('Unable to enroll users').' '.
                       &mt('No Kerberos domain was specified.').'</span></p>');
             $amode = ''; # This causes the loop below to be skipped
@@ -4912,7 +4896,9 @@
                   "</p>\n");
         if ($counts{'role'} > 0) {
             $r->print("<p>\n".
-                      &mt('Roles added for [quant,_1,user].',$counts{'role'}).' '.&mt('If a user is currently logged-in to LON-CAPA, any new roles which are active will be available when the user next logs in.')."</p>\n");
+                      &mt('Roles added for [quant,_1,user].',$counts{'role'}).' '.
+                      &mt('If a user is currently logged-in to LON-CAPA, any new roles which are active will be available when the user next logs in.').
+                      "</p>\n");
         } else {
             $r->print('<p>'.&mt('No roles added').'</p>');
         }
@@ -4930,10 +4916,9 @@
             #  Get current classlist
             my $classlist = &Apache::loncoursedata::get_classlist();
             if (! defined($classlist)) {
-                $r->print('<form name="studentform" method="post" action="/adm/createuser">'.
-                          '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'.
-                          '<p class="LC_info">'.&mt('There are no students with current/future access to the course.').'</p>'.
-                          '</form>'."\n");
+                $r->print('<p class="LC_info">'.
+                          &mt('There are no students with current/future access to the course.').
+                          '</p>'."\n");
             } elsif (ref($classlist) eq 'HASH') {
                 # Remove the students we just added from the list of students.
                 foreach my $line (@userdata) {
@@ -4949,9 +4934,6 @@
             }
         }
     } # end of unless
-    if ($env{'form.fullup'} ne 'yes') {
-        $r->print('</form>');
-    }
 }
 
 sub print_namespacing_alerts {




More information about the LON-CAPA-cvs mailing list