--- loncom/interface/lonstatistics.pm 2003/06/16 15:54:58 1.77 +++ loncom/interface/lonstatistics.pm 2003/06/20 18:50:17 1.78 @@ -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 @@ sub DisplayClasslist { my @Fields = ('fullname','username','domain','id','section'); # my $Str=''; + if (! @Students) { + if ($SelectedSections[0] eq 'all') { + if (lc($ENV{'form.Status'}) eq 'any') { + $Str .= '

There are no students in the course.

'; + } elsif (lc($ENV{'form.Status'}) eq 'active') { + $Str .= '

There are no currently enrolled students in '. + 'the course.

'; + } elsif (lc($ENV{'form.Status'}) eq 'expired') { + $Str .= '

There are no previously enrolled '. + 'students in the course.

'; + } + } 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 .= '

There are no students in '.$sections.'.

'; + } elsif (lc($ENV{'form.Status'}) eq 'active') { + $Str .= '

There are no currently enrolled students '. + 'in '.$sections.'.

'; + } elsif (lc($ENV{'form.Status'}) eq 'expired') { + $Str .= '

There are no previously enrolled students '. + 'in '.$sections.'.

'; + } + } + $Str.= ''. + 'Return to the chart.'; + $r->print($Str); + $r->rflush(); + return; + } + # "Click" is asinine but it is probably not my place to change the world. - $Str .= '

Click on a users name to view their chart

'; + $Str .= '

Click on a students name or username to view their chart

'; $Str .= '
'."\n"; $Str .= ''."\n"; foreach my $field (@Fields) { @@ -827,7 +865,7 @@ sub DisplayClasslist { # foreach my $field (@Fields) { $Str .= '
'; - if ($field eq 'fullname') { + if ($field eq 'fullname' || $field eq 'username') { $Str .= '