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

bisitz lon-capa-cvs-allow@mail.lon-capa.org
Tue, 16 Sep 2008 15:40:17 -0000


bisitz		Tue Sep 16 11:40:17 2008 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
  Log:
  - Bugfix: Added missing info message about no students with future access
  - Changed style of info messages to standard style
  - Replaced "Select Student" table with LON-CAPA standard table and added proper headline
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.140 loncom/interface/lonstatistics.pm:1.141
--- loncom/interface/lonstatistics.pm:1.140	Tue Sep 16 08:32:18 2008
+++ loncom/interface/lonstatistics.pm	Tue Sep 16 11:40:15 2008
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstatistics.pm,v 1.140 2008/09/16 12:32:18 bisitz Exp $
+# $Id: lonstatistics.pm,v 1.141 2008/09/16 15:40:15 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -965,46 +965,55 @@
     my @selected_sections = &get_selected_sections();
     if (! @Students) {
         if ($selected_sections[0] eq 'all') { 
-            if (lc($env{'form.Status'}) eq 'any') {
-                $Str .= '<h2>'.
-                    &mt('There are no students in the course.').
-                    '</h2>';
-            } elsif (lc($env{'form.Status'}) eq 'active') {
-                $Str .= '<h2>'.
+            if (lc($env{'form.Status'}) eq 'active') {
+                $Str .= '<p class="LC_info">'.
                 &mt('There are no currently enrolled students in the course.').
-                    '</h2>';
+                    '</p>';
             } elsif (lc($env{'form.Status'}) eq 'expired') {
-                $Str .= '<h2>'.
+                $Str .= '<p class="LC_info">'.
                     &mt('There are no previously enrolled students in the course.').
-                        '</h2>';
+                        '</p>';
+            } elsif (lc($env{'form.Status'}) eq 'future') {
+                $Str .= '<p class="LC_info">'.
+                    &mt('There are no students with future access in the course.').
+                        '</p>';
+            } else { # 'any' and any others
+               $Str .= '<p class="LC_info">'.
+                    &mt('There are no students in the course.').
+                    '</p>';
             }
         } else { 
-            my $sections;
-            if (lc($env{'form.Status'}) eq 'any') {
-                $Str .= '<h2>'.
-                    &mt('There are no students in the selected sections.').
-                    '</h2>';
-            } elsif (lc($env{'form.Status'}) eq 'active') {
-                $Str .= '<h2>'.
+            if (lc($env{'form.Status'}) eq 'active') {
+                $Str .= '<p class="LC_info">'.
                     &mt('There are no currently enrolled students in the selected sections.').
-                    '</h2>';
+                    '</p>';
             } elsif (lc($env{'form.Status'}) eq 'expired') {
-                $Str .= '<h2>'.
+                $Str .= '<p class="LC_info">'.
                     &mt('There are no previously enrolled students in the selected sections.').
-                    '</h2>';
+                    '</p>';
+            } elsif (lc($env{'form.Status'}) eq 'future') {
+                $Str .= '<p class="LC_info">'.
+                    &mt('There are no students with future access in the selected sections.').
+                        '</p>';
+            } else { # 'any' and any others
+                $Str .= '<p class="LC_info">'.
+                    &mt('There are no students in the selected sections.').
+                    '</p>';
             }
         }
-        $Str.= '<a href="/adm/statistics?reportSelected=student_assessment">'.
-            &mt('Click here to return to the chart').'</a>';
+        $Str.= '<p>'
+              .'<a href="/adm/statistics?reportSelected=student_assessment">'
+              .&mt('Return to the chart').'</a>'
+              .'</p>';
         $r->print($Str);
         $r->rflush();
         return;
     }
 
-    # "Click" is asinine but it is probably not my place to change the world.
-    $Str .= '<h2>Click on a students name or username to view their chart</h2>';
-    $Str .= '<table border="0"><tr><td bgcolor="#777777">'."\n";
-    $Str .= '<table border="0" cellpadding="3"><tr bgcolor="#e6ffff">'."\n";
+    $Str .= '<h2>'.&mt('Select One Student').'</h2>'
+           .'<p>'.&mt("Click on a student's name or username to view their chart").'</p>'
+           .&Apache::loncommon::start_data_table()
+           .&Apache::loncommon::start_data_table_header_row();
     foreach my $field (@Fields) {
         $Str .= '<th><a href="/adm/statistics?'.
             'reportSelected=student_assessment&'.
@@ -1012,17 +1021,11 @@
             'sort='.$field.'">'.&mt($field).
             '</a></th>';
     }
-    $Str .= '</tr>'."\n";
+    $Str .= &Apache::loncommon::end_data_table_header_row();
     #
-    my $alternate = 0;
     foreach my $student (@Students) { # @Students is a package variable
         my $sname = $student->{'username'}.':'.$student->{'domain'};
-        if($alternate) {
-            $Str .= '<tr bgcolor="#ffffe6">';
-        } else {
-            $Str .= '<tr bgcolor="#ffffc6">';
-        }
-        $alternate = ($alternate + 1) % 2;
+        $Str .= &Apache::loncommon::start_data_table_row();
         #
         foreach my $field (@Fields) {
             $Str .= '<td>';
@@ -1041,9 +1044,9 @@
             }
             $Str .= '</td>';
         }
-        $Str .= "</tr>\n";
+        $Str .= &Apache::loncommon::end_data_table_row();
     }
-    $Str .= '</table></td></tr></table>'."\n";
+    $Str .= &Apache::loncommon::end_data_table();
     #
     $r->print($Str);
     $r->rflush();