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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 14 Dec 2007 00:20:54 -0000


This is a MIME encoded message

--raeburn1197591654
Content-Type: text/plain

raeburn		Thu Dec 13 19:20:54 2007 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm lonuserutils.pm lonpopulate.pm 
  Log:
  &authorpriv() and &get_permission() moved from loncreateuser.pm to lonuserutils.pm to be more generally available.
  
  - classlist display in Autoenrollment Manager (used for locking/unlocking users and/or toggling user type between auto and manual) now uses lonuserutils::show_users_list().
  
  lonpopulate.pm
  - link in breadcrumb trail to dropadd replaced with createuser
  - style
  - localization
  - tables displaying result of auto/manual lock/unlock changes for student enrollments use loncommon::start_date_table* and end_data_table*
  
  
--raeburn1197591654
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20071213192054.txt"

Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.208 loncom/interface/loncreateuser.pm:1.209
--- loncom/interface/loncreateuser.pm:1.208	Wed Dec 12 20:08:47 2007
+++ loncom/interface/loncreateuser.pm	Thu Dec 13 19:20:53 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.208 2007/12/13 01:08:47 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.209 2007/12/14 00:20:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -115,15 +115,6 @@
     return %abv_auth;
 }
 
-# ==================================================== Figure out author access
-
-sub authorpriv {
-    my ($auname,$audom)=@_;
-    unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname))
-         || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; }
-    return 1;
-}
-
 # ====================================================
 
 sub portfolio_quota {
@@ -970,7 +961,7 @@
                }
                if (($role_code eq 'ca') || ($role_code eq 'aa')) {
                    $area=~m{/($match_domain)/($match_username)};
-		   if (&authorpriv($2,$1)) {
+		   if (&Apache::lonuserutils::authorpriv($2,$1)) {
 		       $allowed=1;
                    } else {
                        $allowed=0;
@@ -1063,7 +1054,8 @@
 #
 # Co-Author
 # 
-    if (&authorpriv($env{'user.name'},$env{'request.role.domain'}) &&
+    if (&Apache::lonuserutils::authorpriv($env{'user.name'},
+                                          $env{'request.role.domain'}) &&
         ($env{'user.name'} ne $ccuname || $env{'user.domain'} ne $ccdomain)) {
         # No sense in assigning co-author role to yourself
         $addrolesdisplay = 1;
@@ -1114,7 +1106,8 @@
          &Apache::loncommon::end_data_table_row()."\n".
          &Apache::loncommon::end_data_table());
     } elsif ($env{'request.role'} =~ /^au\./) {
-        if (!(&authorpriv($env{'user.name'},$env{'request.role.domain'}))) {
+        if (!(&Apache::lonuserutils::authorpriv($env{'user.name'},
+                                                $env{'request.role.domain'}))) {
             $r->print('<span class="LC_error">'.
                       &mt('You do not have privileges to assign co-author roles.').
                       '</span>');
@@ -2618,7 +2611,8 @@
             ({href=>"/adm/createuser",
               text=>"User Management"});
     }
-    my ($permission,$allowed) = &get_permission($context);
+    my ($permission,$allowed) = 
+        &Apache::lonuserutils::get_permission($context);
     if (!$allowed) {
         $env{'user.error.msg'}=
             "/adm/createuser:cst:0:0:Cannot create/modify user data ".
@@ -2936,60 +2930,6 @@
     return $menu_html;
 }
 
-sub get_permission {
-    my ($context) = @_;
-    my %permission;
-    if ($context eq 'course') {
-        if ((&Apache::lonnet::allowed('cta',$env{'request.course.id'})) ||
-            (&Apache::lonnet::allowed('cin',$env{'request.course.id'})) ||
-            (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) ||
-            (&Apache::lonnet::allowed('cep',$env{'request.course.id'})) ||
-            (&Apache::lonnet::allowed('cst',$env{'request.course.id'}))) {
-            $permission{'cusr'} = 1;
-            $permission{'view'} =
-                 &Apache::lonnet::allowed('vcl',$env{'request.course.id'});
-
-        }
-        if (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) {
-            $permission{'custom'} = 1;
-        }
-        if (&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) {
-            $permission{'view'} = 1;
-        }
-        if (!$permission{'view'}) {
-            my $scope = $env{'request.course.id'}.'/'.$env{'request.course.sec'};
-            $permission{'view'} =  &Apache::lonnet::allowed('vcl',$scope);
-            if ($permission{'view'}) {
-                $permission{'view_section'} = $env{'request.course.sec'};
-            }
-        }
-        if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
-            $permission{'grp_manage'} = 1;
-        }
-    } elsif ($context eq 'author') {
-        $permission{'cusr'} = &authorpriv($env{'user.name'},$env{'request.role.domain'});
-        $permission{'view'} = $permission{'cusr'};
-    } else {
-        if ((&Apache::lonnet::allowed('cad',$env{'request.role.domain'})) ||
-            (&Apache::lonnet::allowed('cli',$env{'request.role.domain'})) ||
-            (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
-            (&Apache::lonnet::allowed('csc',$env{'request.role.domain'})) ||
-            (&Apache::lonnet::allowed('cdg',$env{'request.role.domain'})) || 
-            (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) {
-            $permission{'cusr'} = 1;
-        }
-        if (&Apache::lonnet::allowed('ccr',$env{'request.role.domain'})) {
-            $permission{'custom'} = 1;
-        }
-        $permission{'view'} = $permission{'cusr'};
-    }
-    my $allowed = 0;
-    foreach my $perm (values(%permission)) {
-        if ($perm) { $allowed=1; last; }
-    }
-    return (\%permission,$allowed);
-}
-
 sub restore_prev_selections {
     my %saveable_parameters = ('srchby'   => 'scalar',
 			       'srchin'   => 'scalar',
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.15 loncom/interface/lonuserutils.pm:1.16
--- loncom/interface/lonuserutils.pm:1.15	Wed Dec 12 18:59:41 2007
+++ loncom/interface/lonuserutils.pm	Thu Dec 13 19:20:53 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.15 2007/12/12 23:59:41 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.16 2007/12/14 00:20:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1764,16 +1764,19 @@
         $cnum = $env{'course.'.$cid.'.num'};
         ($classgroups) = &Apache::loncoursedata::get_group_memberships(
                                      $userlist,$keylist,$cdom,$cnum);
-        if (! exists($env{'form.displayphotos'})) {
-            $env{'form.displayphotos'} = 'off';
-        }
-        $displayphotos = $env{'form.displayphotos'};
-        if (! exists($env{'form.displayclickers'})) {
-            $env{'form.displayclickers'} = 'off';
-        }
-        $displayclickers = $env{'form.displayclickers'};
-        if ($env{'course.'.$cid.'.internal.showphoto'}) {
-            $r->print('
+        if ($mode eq 'autoenroll') {
+            $env{'form.showrole'} = 'st';
+        } else {
+            if (! exists($env{'form.displayphotos'})) {
+                $env{'form.displayphotos'} = 'off';
+            }
+            $displayphotos = $env{'form.displayphotos'};
+            if (! exists($env{'form.displayclickers'})) {
+                $env{'form.displayclickers'} = 'off';
+            }
+            $displayclickers = $env{'form.displayclickers'};
+            if ($env{'course.'.$cid.'.internal.showphoto'}) {
+                $r->print('
 <script type="text/javascript">
 function photowindow(photolink) {
     var title = "Photo_Viewer";
@@ -1783,14 +1786,15 @@
     stdeditbrowser.focus();
 }
 </script>
-           ');
-        }
-        $r->print(<<END);
+               ');
+            }
+            $r->print(<<END);
 <input type="hidden" name="displayphotos" value="$displayphotos" />
 <input type="hidden" name="displayclickers" value="$displayclickers" />
 END
+        }
     }
-    unless ($mode eq 'autoenroll') {
+    if ($mode ne 'autoenroll') {
         my $check_uncheck_js = &Apache::loncommon::check_uncheck_jscript();
         my $alert = &mt("You must select at least one user by checking a user's 'Select' checkbox");
         my $singconfirm = &mt(' for a single user');
@@ -1919,49 +1923,52 @@
     } elsif ($env{'form.showrole'} ne 'Any') {
         $rolefilter = &Apache::lonnet::plaintext($env{'form.showrole'});
     }
-    my $results_description = &results_header_row($rolefilter,$statusmode,
-                                                  $context,$permission);
-    $r->print('<b>'.$results_description.'</b><br />');
+    my $results_description;
+    if ($mode ne 'autoenroll') {
+        $results_description = &results_header_row($rolefilter,$statusmode,
+                                                   $context,$permission);
+        $r->print('<b>'.$results_description.'</b><br />');
+    }
     my ($output,$actionselect);
-    if ($mode eq 'html' || $mode eq 'view') {
-        if ($permission->{'cusr'}) {
-            $actionselect = &select_actions($context,$setting,$statusmode);
-        }
-        $r->print(<<END);
+    if ($mode eq 'html' || $mode eq 'view' || $mode eq 'autoenroll') {
+        if ($mode ne 'autoenroll') {
+            if ($permission->{'cusr'}) {
+                $actionselect = &select_actions($context,$setting,$statusmode);
+            }
+            $r->print(<<END);
 <input type="hidden" name="srchby"  value="uname" />
 <input type="hidden" name="srchin"   value="dom" />
 <input type="hidden" name="srchtype" value="exact" />
 <input type="hidden" name="srchterm" value="" />
 <input type="hidden" name="srchdomain" value="" /> 
 END
-         if ($mode ne 'autoenroll') {
-             $output = '<p>';
-             my @linkdests = ('aboutme');
-             if ($permission->{'cusr'}) {
-                 push (@linkdests,'modify');
-                 $output .= '<span class="LC_nobreak">'.$lt{'link'}.':&nbsp;';
-                 my $usernamelink = $env{'form.usernamelink'};
-                 if ($usernamelink eq '') {
-                     $usernamelink = 'aboutme';
-                 }
-                 foreach my $item (@linkdests) {
-                     my $checkedstr = '';
-                     if ($item eq $usernamelink) {
-                         $checkedstr = ' checked="checked" ';
-                     }
-                     $output .= '<label><input type="radio" name="usernamelink" value="'.$item.'"'.$checkedstr.'>&nbsp;'.$lt{$item}.'</label>&nbsp;&nbsp;';
-                 }
-                 $output .= '</span><br />';
-             } else {
-                 $output .= &mt("Click on a username to view the user's personal page.").'<br />';
-             }
-             if ($actionselect) {
-                 $output .= <<"END"; 
+            $output = '<p>';
+            my @linkdests = ('aboutme');
+            if ($permission->{'cusr'}) {
+                push (@linkdests,'modify');
+                $output .= '<span class="LC_nobreak">'.$lt{'link'}.':&nbsp;';
+                my $usernamelink = $env{'form.usernamelink'};
+                if ($usernamelink eq '') {
+                    $usernamelink = 'aboutme';
+                }
+                foreach my $item (@linkdests) {
+                    my $checkedstr = '';
+                    if ($item eq $usernamelink) {
+                        $checkedstr = ' checked="checked" ';
+                    }
+                    $output .= '<label><input type="radio" name="usernamelink" value="'.$item.'"'.$checkedstr.'>&nbsp;'.$lt{$item}.'</label>&nbsp;&nbsp;';
+                }
+                $output .= '</span><br />';
+            } else {
+                $output .= &mt("Click on a username to view the user's personal page.").'<br />';
+            }
+            if ($actionselect) {
+                $output .= <<"END"; 
 $lt{'ac'}:&nbsp;$actionselect <input type="button" value="$lt{'pr'}" onclick="javascript:verify_action(document.studentform.actionlist)" /></p>
 <p><input type="button" value="$lt{'ca'}" onclick="javascript:checkAll(document.studentform.actionlist)" /> &nbsp;
 <input type="button" value="$lt{'ua'}" onclick="javascript:uncheckAll(document.studentform.actionlist)" />
 END
-             }
+            }
         }
         $output .= "\n<p>\n".
                   &Apache::loncommon::start_data_table().
@@ -1980,7 +1987,7 @@
             $output .= "<th><a href=\"javascript:document.studentform.sortby.value='$item';document.studentform.submit();\">$lt{$item}</a></th>\n";
         }
         my %role_types = &role_type_names();
-        if ($context eq 'course') {
+        if ($context eq 'course' && $mode ne 'autoenroll') {
             if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
                 # Clicker display on or off?
                 my %clicker_options = &Apache::lonlocal::texthash(
@@ -2014,8 +2021,8 @@
                       '    </th>'."\n";
                 }
             }
-            $output .= &Apache::loncommon::end_data_table_header_row();
         }
+        $output .= &Apache::loncommon::end_data_table_header_row();
 # Done with the HTML header line
     } elsif ($mode eq 'csv') {
         #
@@ -2151,32 +2158,54 @@
         }
         if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
             $r->print(&Apache::loncommon::start_data_table_row());
-            $r->print("<td>$rowcount</td>\n");
             my $checkval;
-            if ($mode ne 'autoenroll' && $actionselect) {
-                $checkval = $user; 
-                if ($context eq 'course') {
-                    if ($role eq 'st') {
-                        $checkval .= ':st';
-                    }
-                    $checkval .= ':'.$in{'section'};
-                    if ($role eq 'st') {
-                        $checkval .= ':'.$in{'type'}.':'.$in{'lockedtype'};
+            if ($mode eq 'autoenroll') {
+                my $cellentry;
+                if ($in{'type'} eq 'auto') {
+                    $cellentry = '<b>'.&mt('auto').'</b>&nbsp;<label><input type="checkbox" name="chgauto" value="'.$in{'username'}.':'.$in{'domain'}.'" />&nbsp;Change</label>';
+                    $autocount ++;
+                } else {
+                    $cellentry = '<table border="0" cellspacing="0"><tr><td rowspan="2"><b>'.&mt('manual').'</b></td><td><nobr><label><input type="checkbox" name="chgmanual" value="'.$in{'username'}.':'.$in{'domain'}.'" />&nbsp;Change</label></nobr></td></tr><tr><td><nobr>';
+                    $manualcount ++;
+                    if ($in{'lockedtype'}) {
+                        $cellentry .= '<label><input type="checkbox" name="unlockchg" value="'.$in{'username'}.':'.$in{'domain'}.'" />&nbsp;'.&mt('Unlock').'</label>';
+                        $unlockcount ++;
+                    } else {
+                        $cellentry .= '<label><input type="checkbox" name="lockchg" value="'.$in{'username'}.':'.$in{'domain'}.'" />&nbsp;'.&mt('Lock').'</label>';
+                        $lockcount ++;
                     }
+                    $cellentry .= '</nobr></td></tr></table>';
+                }
+                $r->print("<td>$cellentry</td>\n");
+            } else {
+                $r->print("<td>$rowcount</td>\n");
+                $checkval;
+                if ($actionselect) {
+                    $checkval = $user; 
+                    if ($context eq 'course') {
+                        if ($role eq 'st') {
+                            $checkval .= ':st';
+                        }
+                        $checkval .= ':'.$in{'section'};
+                        if ($role eq 'st') {
+                            $checkval .= ':'.$in{'type'}.':'.$in{'lockedtype'};
+                        }
+                    }
+                    $r->print('<td><input type="checkbox" name="actionlist" value="'.
+                              $checkval.'"></td>');
                 }
-                $r->print('<td><input type="checkbox" name="actionlist" value="'.
-                          $checkval.'"></td>');
             }
             foreach my $item (@cols) {
                 if ($item eq 'username') {
-                    $r->print('<td>'.&print_username_link($permission,\%in).'</td>');
-                } elsif (($item eq 'start' || $item eq 'end') && ($mode ne 'autoeroll') && ($actionselect)) {
+                    $r->print('<td>'.&print_username_link($mode,$permission,
+                                                          \%in).'</td>');
+                } elsif (($item eq 'start' || $item eq 'end') && ($actionselect)) {
                     $r->print('<td>'.$in{$item}.'<input type="hidden" name="'.$checkval.'_'.$item.'" value="'.$sdata->[$index{$item}].'" /></td>'."\n");
                 } else {
                     $r->print('<td>'.$in{$item}.'</td>'."\n");
                 }
             }
-            if ($context eq 'course') {
+            if (($context eq 'course') && ($mode ne 'autoenroll')) {
                 if ($env{'form.showrole'} eq 'st' || $env{'form.showrole'} eq 'Any') {
                     if ($displayclickers eq 'on') {
                         my $clickers =
@@ -2256,9 +2285,11 @@
 }
 
 sub print_username_link {
-    my ($permission,$in) = @_;
+    my ($mode,$permission,$in) = @_;
     my $output;
-    if (!$permission->{'cusr'}) {
+    if ($mode eq 'autoenroll') {
+        $output = $in->{'username'};
+    } elsif (!$permission->{'cusr'}) {
         $output = &Apache::loncommon::aboutmewrapper($in->{'username'},
                                                      $in->{'username'},
                                                      $in->{'domain'});
@@ -3723,5 +3754,67 @@
     return $cancreate;
 }
 
+sub get_permission {
+    my ($context) = @_;
+    my %permission;
+    if ($context eq 'course') {
+        if ((&Apache::lonnet::allowed('cta',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('cin',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('cep',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('cst',$env{'request.course.id'}))) {
+            $permission{'cusr'} = 1;
+            $permission{'view'} =
+                 &Apache::lonnet::allowed('vcl',$env{'request.course.id'});
+
+        }
+        if (&Apache::lonnet::allowed('ccr',$env{'request.course.id'})) {
+            $permission{'custom'} = 1;
+        }
+        if (&Apache::lonnet::allowed('vcl',$env{'request.course.id'})) {
+            $permission{'view'} = 1;
+        }
+        if (!$permission{'view'}) {
+            my $scope = $env{'request.course.id'}.'/'.$env{'request.course.sec'};
+            $permission{'view'} =  &Apache::lonnet::allowed('vcl',$scope);
+            if ($permission{'view'}) {
+                $permission{'view_section'} = $env{'request.course.sec'};
+            }
+        }
+        if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
+            $permission{'grp_manage'} = 1;
+        }
+    } elsif ($context eq 'author') {
+        $permission{'cusr'} = &authorpriv($env{'user.name'},$env{'request.role.domain'});
+        $permission{'view'} = $permission{'cusr'};
+    } else {
+        if ((&Apache::lonnet::allowed('cad',$env{'request.role.domain'})) ||
+            (&Apache::lonnet::allowed('cli',$env{'request.role.domain'})) ||
+            (&Apache::lonnet::allowed('cau',$env{'request.role.domain'})) ||
+            (&Apache::lonnet::allowed('csc',$env{'request.role.domain'})) ||
+            (&Apache::lonnet::allowed('cdg',$env{'request.role.domain'})) ||
+            (&Apache::lonnet::allowed('mau',$env{'request.role.domain'}))) {
+            $permission{'cusr'} = 1;
+        }
+        if (&Apache::lonnet::allowed('ccr',$env{'request.role.domain'})) {
+            $permission{'custom'} = 1;
+        }
+        $permission{'view'} = $permission{'cusr'};
+    }
+    my $allowed = 0;
+    foreach my $perm (values(%permission)) {
+        if ($perm) { $allowed=1; last; }
+    }
+    return (\%permission,$allowed);
+}
+
+# ==================================================== Figure out author access
+
+sub authorpriv {
+    my ($auname,$audom)=@_;
+    unless ((&Apache::lonnet::allowed('cca',$audom.'/'.$auname))
+         || (&Apache::lonnet::allowed('caa',$audom.'/'.$auname))) { return ''; }    return 1;
+}
+
 1;
 
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.50 loncom/interface/lonpopulate.pm:1.51
--- loncom/interface/lonpopulate.pm:1.50	Tue May  1 21:33:49 2007
+++ loncom/interface/lonpopulate.pm	Thu Dec 13 19:20:53 2007
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.50 2007/05/02 01:33:49 albertel Exp $
+# $Id: lonpopulate.pm,v 1.51 2007/12/14 00:20:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::lonlocal;
 use Apache::loncoursedata;
 use Apache::longroup;
+use Apache::lonuserutils;
 use Apache::Constants qw(:common :http REDIRECT);
 use Time::Local;
 use LONCAPA::Enrollment;
@@ -225,7 +226,7 @@
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
   <td bgcolor="#CCCCFF"> 
-   <font size="2"><a href="/adm/menu">$realm</a> -&gt; <a href="/adm/dropadd">Enrollment Manager</a> -&gt; $page</font><br/>
+   <font size="2"><a href="/adm/menu">$realm</a> -&gt; <a href="/adm/createuser">User Management</a> -&gt; $page</font><br/>
   </td>
   <td align="right" bgcolor="#CCCCFF" valign="top">
    <font size="+1">Automated Enrollment Manager&nbsp;</font>
@@ -1121,16 +1122,34 @@
       }
       my $status_select = &Apache::lonhtmlcommon::StatusOptions($env{'form.Status'});
 #  Get current classlist
-      my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
+      my %userlist;
+      my ($indexhash,$keylist) = &Apache::lonuserutils::make_keylist_array();
+      my $classlist = &Apache::loncoursedata::get_classlist();
+      my $secidx = &Apache::loncoursedata::CL_SECTION();
+      my ($permission,$allowed) = &Apache::lonuserutils::get_permission();
+      foreach my $student (keys(%{$classlist})) {
+          if (exists($permission->{'view_section'})) {
+              if ($classlist->{$student}[$secidx] ne $permission->{'view_section'}) {
+                  next;
+              } else {
+                  $userlist{$student} = $classlist->{$student};
+              }
+          } else {
+              $userlist{$student} = $classlist->{$student};
+          }
+      }
+
       if (! defined($classlist)) {
-          $r->print(&mt('There are no students either currently or previously enrolled.').
-                      "\n");
+          $r->print(&mt('There are no students either currently or previously enrolled.')."
+                      </td>
+                     </tr>\n");
       } else {
           $r->print(&mt('Student Status: [_1]',$status_select)."\n");
           $r->print('<input type="submit" value="'.&mt('Update Display').'" />'.
               "\n</p>\n");
-
-          my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::londropadd::show_class_list($r,'autoenroll','nothing',$env{'form.Status'},$classlist,$keylist);
+          my $context = 'course';
+          my $mode = 'autoenroll';
+          my ($studentcount,$autocount,$manualcount,$lockcount,$unlockcount) = &Apache::lonuserutils::show_users_list($r,$context,$mode,$permission,$env{'form.Status'},\%userlist,$keylist);
           $r->print("
                      </td>
                     </tr>
@@ -1185,6 +1204,14 @@
                      </td>
                     </tr>
               ");
+          } else {
+              $r->print('
+                    <tr>
+                     <td><br />
+                      '.&mt('There are no students with the selected status.').'
+                     </td>
+                    </tr>
+              ');
           }
           $r->print("
                    </table>
@@ -2689,7 +2716,7 @@
 		       &Apache::loncommon::get_env_multiple('form.unlockchg'));
 
     foreach my $student (sort @typechglist) {
-        my ($uname,$udom) = split/:/,$student;
+        my ($uname,$udom) = split(/:/,$student);
         my $sdata    = $classlist->{$student};
         my $section  = $sdata->[$secidx];
         my $uid       = $sdata->[$ididx];
@@ -2727,7 +2754,7 @@
         }
     }
     foreach my $student (@lockchglist) {
-        my ($uname,$udom) = split/:/,$student;
+        my ($uname,$udom) = split(/:/,$student);
         my $sdata    = $classlist->{$student};
         my $section  = $sdata->[$secidx];
         my $uid       = $sdata->[$ididx];
@@ -2756,31 +2783,31 @@
         }
     }
     if ($chgtotal > 0) {
-        $response = "You requested a change in enrollment type for $chgtotal students.<br /><br />\n";
+        $response = &mt('You requested a change in enrollment type for [quant,_1,student].',$chgtotal).'<br /><br />'."\n";
         $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($chgok > 0) {
-            $response .= "The following $chgok changes were successful:<br />";
+            $response .= &mt('The following [quant,_1,change was,changes were] successful;',$chgtotal).':<br /><br />';
             $response .= &enrolltype_result(\%chg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }
         if ($chgfail > 0) {
-            $response .= "The following $chgfail students were not modified successfully:&nbsp;<br />";
+            $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$chgfail).':&nbsp;<br />';
             $response .= &enrolltype_result(\%nochg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }
         if ($othdom > 0) {
-            $response .= "The following $othdom students were not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto':<br />"; 
+            $response .= &mt("The following [quant,_1,student was,students were] not modified because students must be in the same LON-CAPA domain as the course, in order to be set to an enrollment type of 'auto'",$othdom).':<br />'; 
             $response .= &enrolltype_result(\%otherdom,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx);
         }
         $response .= "<br /><br />";
     }
     if ($locktotal > 0) {
-        $response .= "You requested locking/unlocking for $locktotal manually enrolled students.<br /><br />\n";
+        $response .= &mt('You requested locking/unlocking for [quant,_1,manually enrolled student]',$locktotal).'<br /><br />'."\n";
         $classlist = &Apache::loncoursedata::get_classlist($dom,$crs);
         if ($lockok > 0) {
-            $response .= "The following $lockok changes were successful:<br />";
+            $response .= &mt('The following [quant,_1,change was,changes were] successful',$lockok).':<br /><br />';
             $response .= &enrolltype_result(\%lockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
         }
         if ($lockfail > 0) {
-            $response .= "The following $lockfail students were not modified successfully:&nbsp;<br />";
+            $response .= &mt('The following [quant,_1,student was,students were] not modified successfully',$lockfail).':&nbsp;<br />';
             $response .= &enrolltype_result(\%nolockchg,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx);
         }
     }
@@ -2790,9 +2817,8 @@
 
 sub enrolltype_result {
     my ($changes,$classlist,$endidx,$startidx,$ididx,$secidx,$typeidx,$lockedidx) = @_;
-    my $reply = "
-            <table border='2'>
-             <tr>
+    my $reply = &Apache::loncommon::start_data_table().
+                &Apache::loncommon::start_data_table_header_row().'
               <th>username</th>
               <th>domain</th>
               <th>ID</th>
@@ -2800,11 +2826,11 @@
               <th>section</th>
               <th>start date</th>
               <th>end date</th>
-              <th>enrollment change</th>
-             </tr>";
-    foreach (sort keys %{$changes}) {
-        my $sdata  = $classlist->{$_};
-        my ($uname,$udom) = split/:/,$_;
+              <th>enrollment change</th>'."\n".
+                &Apache::loncommon::end_data_table_header_row();
+    foreach my $chg (sort keys %{$changes}) {
+        my $sdata  = $classlist->{$chg};
+        my ($uname,$udom) = split(/:/,$chg);
         my $section  = $sdata->[$secidx];
         my $uid      = $sdata->[$ididx];
         my $start    = $sdata->[$startidx];
@@ -2821,24 +2847,23 @@
             $end = &Apache::lonlocal::locallocaltime($end);
         }
         if (!defined($section) || ($section eq '')) {
-            $section eq '&nbsp;';
+            $section = '&nbsp;';
         }
         if (!defined($uid) || ($uid eq '')) {
-            $uid = '&nbsp';
+            $uid = '&nbsp;';
         }
-        $reply .= "
-             <tr>
-              <td>$uname</td>
-              <td>$udom</td>
-              <td>$uid</td>
-              <td>".&Apache::loncommon::plainname($uname,$udom)."</td>
-              <td>$section</td>
-              <td>$start</td>
-              <td>$end</td>
-              <td>$$changes{$_}</td>
-             </tr>";
+        $reply .= &Apache::loncommon::start_data_table_row().' 
+              <td>'.$uname.'</td>
+              <td>'.$udom.'</td>
+              <td>'.$uid.'</td>
+              <td>'.&Apache::loncommon::plainname($uname,$udom).'</td>
+              <td>'.$section.'</td>
+              <td>'.$start.'</td>
+              <td>'.$end.'</td>
+              <td>'.$$changes{$chg}.'</td>'."\n".
+             &Apache::loncommon::end_data_table_row();
     }
-    $reply .= "</table>";
+    $reply .= &Apache::loncommon::end_data_table();
     return $reply;
 }
 

--raeburn1197591654--