[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 20 Jun 2003 18:50:17 -0000
matthew Fri Jun 20 14:50:17 2003 EDT
Modified files:
/loncom/interface lonstatistics.pm
Log:
Somewhat related to bug 940 - trying to 'Select a single student' when there
are no students to select now gracefully tells the user there are no students
to select instead of giving them an empty table.
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.77 loncom/interface/lonstatistics.pm:1.78
--- loncom/interface/lonstatistics.pm:1.77 Mon Jun 16 11:54:58 2003
+++ loncom/interface/lonstatistics.pm Fri Jun 20 14:50:17 2003
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstatistics.pm,v 1.77 2003/06/16 15:54:58 matthew Exp $
+# $Id: lonstatistics.pm,v 1.78 2003/06/20 18:50:17 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -805,8 +805,46 @@
my @Fields = ('fullname','username','domain','id','section');
#
my $Str='';
+ if (! @Students) {
+ if ($SelectedSections[0] eq 'all') {
+ if (lc($ENV{'form.Status'}) eq 'any') {
+ $Str .= '<h2>There are no students in the course.</h2>';
+ } elsif (lc($ENV{'form.Status'}) eq 'active') {
+ $Str .= '<h2>There are no currently enrolled students in '.
+ 'the course.</h2>';
+ } elsif (lc($ENV{'form.Status'}) eq 'expired') {
+ $Str .= '<h2>There are no previously enrolled '.
+ 'students in the course.</h2>';
+ }
+ } else {
+ my $sections;
+ if (@SelectedSections == 1) {
+ $sections = 'section '.$SelectedSections[0];
+ } elsif (@SelectedSections > 2) {
+ $sections = 'sections '.join(', ',@SelectedSections);
+ $sections =~ s/, ([^,])*$/, and $1/;
+ } else {
+ $sections = 'sections '.join(' and ',@SelectedSections);
+ }
+ if (lc($ENV{'form.Status'}) eq 'any') {
+ $Str .= '<h2>There are no students in '.$sections.'.</h2>';
+ } elsif (lc($ENV{'form.Status'}) eq 'active') {
+ $Str .= '<h2>There are no currently enrolled students '.
+ 'in '.$sections.'.</h2>';
+ } elsif (lc($ENV{'form.Status'}) eq 'expired') {
+ $Str .= '<h2>There are no previously enrolled students '.
+ 'in '.$sections.'.</h2>';
+ }
+ }
+ $Str.= '<a href="/adm/statistics?reportSelected=student_assessment">'.
+ 'Return to the chart.</a>';
+ $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 users name to view their chart</h2>';
+ $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";
foreach my $field (@Fields) {
@@ -827,7 +865,7 @@
#
foreach my $field (@Fields) {
$Str .= '<td>';
- if ($field eq 'fullname') {
+ if ($field eq 'fullname' || $field eq 'username') {
$Str .= '<a href="/adm/statistics?reportSelected=';
$Str .= &Apache::lonnet::escape('student_assessment');
$Str .= '&sort='.&Apache::lonnet::escape($ENV{'form.sort'});