--- loncom/interface/lonselstudent.pm	2006/05/15 22:01:12	1.2
+++ loncom/interface/lonselstudent.pm	2006/05/17 15:04:42	1.4
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # lonselstudent.pm : Reusable subs for student selection.
 #
-# $Id: lonselstudent.pm,v 1.2 2006/05/15 22:01:12 foxr Exp $
+# $Id: lonselstudent.pm,v 1.4 2006/05/17 15:04:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,19 +71,19 @@ sub get_people_in_class {
     #  Enumerate the course_personnel.
     #
     my @course_personnel;
-    for (sort keys %coursepersonnel) {
-	for my $role (split /,/, $coursepersonnel{$_}) {
+    for (sort(keys(%coursepersonnel))) {
+	for my $role (split(/,/, $coursepersonnel{$_})) {
 	    # extract the names so we can sort them
 	    my @people;
 	    
-	    for (split /,/, $role) {
-		push @people, [split /:/, $role];
+	    for (split(/,/, $role)) {
+		push(@people, [split(/:/, $role)]);
 	    }
 	    
-	    @people = sort { $a->[0] cmp $b->[0] } @people;
+	    @people = sort { $a->[0] cmp $b->[0] } (@people);
 	    
 	    for my $person (@people) {
-		push @course_personnel, [join(':', @$person), $person->[0], '', $_];
+		push(@course_personnel, [join(':', @$person), $person->[0], '', $_]);
 	    }
 	}
     }
@@ -102,14 +102,14 @@ sub get_people_in_class {
 
 
     my $classlist = &Apache::loncoursedata::get_classlist();
-    my @keys = keys %{$classlist};
+    my @keys = keys(%{$classlist});
     # Sort by: Section, name
     @keys = sort {
         if ($classlist->{$a}->[$section] ne $classlist->{$b}->[$section]) {
             return $classlist->{$a}->[$section] cmp $classlist->{$b}->[$section];
         }
         return $classlist->{$a}->[$fullname] cmp $classlist->{$b}->[$fullname];
-    } @keys;
+    } (@keys);
  
 
 
@@ -118,9 +118,9 @@ sub get_people_in_class {
 
 	if ( $classlist->{$_}->[$status] eq
 	    'Active') {
-	    push @current_members, [$_, $classlist->{$_}->[$fullname], 
+	    push(@current_members, [$_, $classlist->{$_}->[$fullname], 
 			     $classlist->{$_}->[$section],
-			     $classlist->{$_}->[$status], 'Student'];
+			     $classlist->{$_}->[$status], 'Student']);
 	} else {
 	    #  Need to figure out if this user is future or
 	    #  Expired... If the start date is in the future
@@ -128,13 +128,13 @@ sub get_people_in_class {
 	    
 	    my $now = time;
 	    if ($classlist->{$_}->[$start_date] > $now) {
-		push @future_members, [$_, $classlist->{$_}->[$fullname],
+		push(@future_members, [$_, $classlist->{$_}->[$fullname],
 					$classlist->{$_}->[$section],
-					"Future", "Student"];
+					"Future", "Student"]);
 	    } else {
-		push @expired_members, [$_, $classlist->{$_}->[$fullname],
+		push(@expired_members, [$_, $classlist->{$_}->[$fullname],
 					$classlist->{$_}->[$section],
-					"Expired", "Student"];
+					"Expired", "Student"]);
 	    }
 
 	}
@@ -330,12 +330,14 @@ SCRIPT
     #  True -> checkboxes.
     #  False -> radiobuttons.
 
-    $result .= "<table border=\"2\">\n";
-    $result .= '<tr><th></th><th align="center">Name</th>'."\n";
-    $result .= '    <th align="center">Section</th>'."\n";
-    $result .= '    <th align="center">Status</th>'."\n";
-    $result .= '    <th align="center">Role</th>'."\n";
-    $result .= '    <th align="center">Username : Domain</th></tr>'."\n";
+    $result .= &Apache::loncommon::start_data_table();
+    $result .= &Apache::loncommon::start_data_table_header_row();
+    $result .= '<th></th><th>Name</th>'."\n";
+    $result .= '    <th>Section</th>'."\n";
+    $result .= '    <th>Status</th>'."\n";
+    $result .= '    <th>Role</th>'."\n";
+    $result .= '    <th>Username : Domain</th>'."\n";
+    $result .= &Apache::loncommon::end_data_table_header_row();
 
     my $input_type;
     if ($multiselect) {
@@ -346,13 +348,14 @@ SCRIPT
 
     my $checked = 0;
     for my $student (@$students) {
-	$result .= '<tr><td><input type="'.$input_type.'"  name="'.
+	$result .= &Apache::loncommon::start_data_table_row().
+	    '<td><input type="'.$input_type.'"  name="'.
 	    $resultname.".forminput".'"';
 	my $user    = $student->[0];
 
 	# Figure out which students are checked by default...
 	
-	if(%$defaultusers) {
+	if (%$defaultusers) {
 	    if (exists ($defaultusers->{$user})) {
 		$result .= ' checked ="checked" ';
 		$checked = 1;
@@ -361,25 +364,27 @@ SCRIPT
 	    $result .= ' checked="checked" ';
 	    $checked = 1;	# First one for radio if no default specified.
 	}
-	$result .= ' value="'. HTML::Entities::encode($user .          ':'
-						      .$student->[2] . ':'
+	$result .= ' value="'.&HTML::Entities::encode($user .          ':'
+				 		      .$student->[2] . ':'
 						      .$student->[1] . ':'
 						      .$student->[3] . ':'
 						      .$student->[4] . ":"
 						      .$formprefix,   "<>&\"'")
 	    ."\" /></td><td>\n";
-	$result .= HTML::Entities::encode($student->[1], '<>&"')
+	$result .= &HTML::Entities::encode($student->[1], '<>&"')
 	        . '</td><td align="center" >'."\n";
-	$result .= HTML::Entities::encode($student->[2], '<>&"')
+	$result .= &HTML::Entities::encode($student->[2], '<>&"')
    	        . '</td><td align="center">'."\n";
-	$result .= HTML::Entities::encode($student->[3], '<>&"')
+	$result .= &HTML::Entities::encode($student->[3], '<>&"')
 	        . '</td><td align="center">'."\n";
-	$result .= HTML::Entities::encode($student->[4], '<>&"')
+	$result .= &HTML::Entities::encode($student->[4], '<>&"')
   	        . '</td><td align="center">'."\n";
-	$result .= HTML::Entities::encode($student->[0], '<>&"')
-	        . '</td></tr>'."\n";
+	$result .= &HTML::Entities::encode($student->[0], '<>&"')
+	        . '</td>'.&Apache::loncommon::end_data_table_row().
+		"\n";
     }
-    $result .=" </table> <br /> <hr />\n";
+    $result .= &Apache::loncommon::end_data_table().
+	" <br /> <hr />\n";
 
     return $result;
 }