--- loncom/interface/lonstatistics.pm 2006/05/18 01:08:50 1.135 +++ loncom/interface/lonstatistics.pm 2008/09/16 15:40:15 1.141 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstatistics.pm,v 1.135 2006/05/18 01:08:50 raeburn Exp $ +# $Id: lonstatistics.pm,v 1.141 2008/09/16 15:40:15 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -76,6 +76,7 @@ use Apache::lonpercentage; use Apache::lonstudentsubmissions(); use Apache::lonsurveyreports(); use Apache::longradinganalysis(); +use LONCAPA; ####################################################### ####################################################### @@ -311,7 +312,11 @@ sub PrepareClasslist { if ($env{'request.course.sec'} !~ /^\s*$/) { @Sections = ($env{'request.course.sec'}); } else { - @Sections = sort {$a cmp $b} keys(%Sections); + @Sections = sort { + if ($a == $a && $b == $b ) { return $a <=> $b; } + return $a cmp $b; + } keys(%Sections); + unshift(@Sections,'all'); # Put 'all' at the front of the list } # Sort the groups @@ -430,7 +435,7 @@ sub get_selected_groups { =item §ion_and_enrollment_description Returns a string describing the currently selected section(s), group(s) and -enrollment status. +access status. Inputs: mode = 'plaintext' or 'localized' (defaults to 'localized') 'plaintext' is used for example in Excel spreadsheets. @@ -447,9 +452,9 @@ sub section_and_enrollment_description { my @groups = &Apache::lonstatistics::get_selected_groups(); my $description; if ($mode eq 'localized') { - $description = &mt('Unable to determine section, groups and enrollment'); + $description = &mt('Unable to determine section, groups and access status'); } elsif ($mode eq 'plaintext') { - $description = 'Unable to determine section, groups and enrollment'; + $description = 'Unable to determine section, groups and access status'; } else { $description = 'Bad parameter passed to lonstatistics::section_and_enrollment_description'; &Apache::lonnet::logthis($description); @@ -457,9 +462,9 @@ sub section_and_enrollment_description { $description = §ion_or_group_text($mode,'section',@sections). ' '.§ion_or_group_text($mode,'group',@groups); if ($mode eq 'localized') { - $description .= &mt(' [_1] enrollment status.',$env{'form.Status'}); + $description .= &mt(' [_1] access status.',$env{'form.Status'}); } elsif ($mode eq 'plaintext') { - $description .= ' '.$env{'form.Status'}.' enrollment status.'; + $description .= ' '.$env{'form.Status'}.' access status.'; } return $description; } @@ -702,8 +707,13 @@ sub selected_sequences_with_assessments # my @sequences = $navmap->retrieveResources(undef, sub { shift->is_map(); },1,0,1); + my $toplevelseq = $navmap->getById('0.0'); + if (!grep(/^\Q$toplevelseq\E$/,@sequences)) { + unshift(@sequences,$toplevelseq); + } + my @sequences_with_assessments; - for my $sequence ($navmap->getById('0.0'), @sequences) { + foreach my $sequence (@sequences) { if ($navmap->hasResource($sequence,sub { shift->is_problem(); },0,1)){ push(@sequences_with_assessments,$sequence); } @@ -929,7 +939,7 @@ sub DisplayClasslist { $Str .= '
'. &mt('There are no currently enrolled students in the course.'). - ''; + '
'; } elsif (lc($env{'form.Status'}) eq 'expired') { - $Str .= ''. &mt('There are no previously enrolled students in the course.'). - ''; + '
'; + } elsif (lc($env{'form.Status'}) eq 'future') { + $Str .= ''. + &mt('There are no students with future access in the course.'). + '
'; + } else { # 'any' and any others + $Str .= ''. + &mt('There are no students in the course.'). + '
'; } } else { - my $sections; - if (lc($env{'form.Status'}) eq 'any') { - $Str .= ''. &mt('There are no currently enrolled students in the selected sections.'). - ''; + '
'; } elsif (lc($env{'form.Status'}) eq 'expired') { - $Str .= ''. &mt('There are no previously enrolled students in the selected sections.'). - ''; + '
'; + } elsif (lc($env{'form.Status'}) eq 'future') { + $Str .= ''. + &mt('There are no students with future access in the selected sections.'). + '
'; + } else { # 'any' and any others + $Str .= ''. + &mt('There are no students in the selected sections.'). + '
'; } } - $Str.= ''. - &mt('Click here to return to the chart').''; + $Str.= '' + .'' + .&mt('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 .= ''."\n";
- $Str .= '
|
'. - &mt('Please notify the server administrator '). - ''.$serveradmin.'
'); + ''); + $r->print('' + .&mt('Please notify the server administrator [_1]', + ,''.$serveradmin.'') + .'
'); $r->print(''. &mt('Course Statistics and Charts cannot be '. 'retrieved until the database is restarted. '.