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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 30 Jun 2006 03:33:52 -0000


albertel		Thu Jun 29 23:33:52 2006 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm 
  Log:
  - BUG#4885 
      - all section at top of modify list
      - section column added to display (and is sortable)
      - test nosection -> worked fine
  
  
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.30 loncom/interface/loncoursegroups.pm:1.31
--- loncom/interface/loncoursegroups.pm:1.30	Thu Jun 29 13:01:26 2006
+++ loncom/interface/loncoursegroups.pm	Thu Jun 29 23:33:50 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.30 2006/06/29 17:01:26 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.31 2006/06/30 03:33:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -89,6 +89,7 @@
     $idx{fullname} = &Apache::loncoursedata::CL_FULLNAME();
     $idx{udom} = &Apache::loncoursedata::CL_SDOM();
     $idx{uname} = &Apache::loncoursedata::CL_SNAME();
+    $idx{section} = &Apache::loncoursedata::CL_SECTION();
 
     my $rowColor1 = "#dddddd";
     my $rowColor2 = "#eeeeee";
@@ -1402,8 +1403,8 @@
     $r->print(&Apache::lonhtmlcommon::role_select_row(\@roles));
     if (@sections > 0) {
         @sections = sort {$a cmp $b} @sections;
-        unshift(@sections,'all'); # Put 'all' at the front of the list
         unshift(@sections,'none'); # Put 'no sections' next
+        unshift(@sections,'all'); # Put 'all' at the front of the list
         $r->print('<td>&nbsp;</td>
                    <td colspan="3" align="center" valign="top">'.
         &sections_selection(\@sections,'sectionpick').'</td>');
@@ -1425,11 +1426,11 @@
     }
     foreach my $sec (@{$sections}) {
         if ($sec eq 'all') {
-            $section_sel .= '  <option value="'.$sec.'" />all sections'."\n";
+            $section_sel .= '  <option value="'.$sec.'" selected="selected">'.&mt('all sections').'</option>'."\n";
         } elsif ($sec eq 'none') {
-            $section_sel .= '  <option value="'.$sec.'" />no section'."\n"; 
+            $section_sel .= '  <option value="'.$sec.'">'.&mt('no section').'</option>'."\n"; 
         } else {
-            $section_sel .= '  <option value="'.$sec.'" />'.$sec."\n";
+            $section_sel .= '  <option value="'.$sec.'">'.$sec."</option>\n";
         }
     }
     my $output = '
@@ -1766,6 +1767,7 @@
      </td>
      <td><b><a href="javascript:changeSort('."'domain'".')">'.&mt('Domain').'</a></b></td>
      <td><b><a href="javascript:changeSort('."'id'".')">ID</a></b></td>
+     <td><b><a href="javascript:changeSort('."'section'".')">Section</a></b></td>
 ');
         if (@{$available} > 0) {
             $r->print('<td><b>'.$lt{'func'}.'</b></td>');
@@ -1794,6 +1796,8 @@
                 push(@{$Sortby{$members{$user}[$$idx{udom}]}},$user);
             } elsif ($env{'form.sortby'} eq 'id') {
                 push(@{$Sortby{$members{$user}[$$idx{id}]}},$user);
+            } elsif ($env{'form.sortby'} eq 'section') {
+                push(@{$Sortby{$members{$user}[$$idx{section}]}},$user);
             } else {
                 push(@{$Sortby{$members{$user}[$$idx{fullname}]}},$user);
             }
@@ -1811,10 +1815,12 @@
                 my $fullname = $members{$user}[$$idx{fullname}];
                 my $udom = $members{$user}[$$idx{udom}];
                 my $uname = $members{$user}[$$idx{uname}];
+                my $section = $members{$user}[$$idx{section}];
                 $r->print('<tr bgcolor="'.$rowColor.'"><td align="right">
    <input type="checkbox" name="member" value="'.$user.'" /></td><td><small>'.
     $fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'.
-    $udom.'</small></td><td><small>'.$id.'</small></td>');
+    $udom.'</small></td><td><small>'.$id.'</small></td>'.
+			  '<td><small>'.$section.'</small></td>');
                 if (@{$available} > 0) {
                     $r->print('<td align="center"><nobr><small>'.
                               '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');