--- loncom/interface/statistics/lonstudentassessment.pm 2005/03/14 20:28:22 1.119 +++ loncom/interface/statistics/lonstudentassessment.pm 2005/03/21 19:47:54 1.120 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentassessment.pm,v 1.119 2005/03/14 20:28:22 matthew Exp $ +# $Id: lonstudentassessment.pm,v 1.120 2005/03/21 19:47:54 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -353,7 +353,7 @@ sub CreateInterface { &mt('Clear Caches').'" />'; $Str .= ' 'x5; $Str .= - &mt('Status[_1]', + &mt('Status [_1]', ''); $Str .= '
'; return $Str; @@ -1052,23 +1052,9 @@ sub excel_initialize { # Put a description of the sections listed my $sectionstring = ''; my @Sections = &Apache::lonstatistics::get_selected_sections(); - if (scalar(@Sections) > 1) { - if (scalar(@Sections) > 2) { - my $last = pop(@Sections); - $sectionstring = "Sections ".join(', ',@Sections).', and '.$last; - } else { - $sectionstring = "Sections ".join(' and ',@Sections); - } - } else { - if ($Sections[0] eq 'all') { - $sectionstring = "All sections"; - } else { - $sectionstring = "Section ".$Sections[0]; - } - } - $excel_sheet->write($header_row,$cols_output++,$sectionstring, + $excel_sheet->write($header_row,$cols_output++, + &Apache::lonstatistics::section_and_enrollment_description('plain text'), $format->{'h3'}); - $cols_output += scalar(@Sections); # # Put the date in there too $excel_sheet->write($header_row,$cols_output++, @@ -1559,22 +1545,18 @@ END 'inline',undef,'Statistics','stats_status'); # # Open a file - $filename = '/prtspool/'. - $ENV{'user.name'}.'_'.$ENV{'user.domain'}.'_'. - time.'_'.rand(1000000000).'.csv'; - unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) { - $r->log_error("Couldn't open $filename for output $!"); - $r->print("Problems occured in writing the csv file. ". - "This error has been logged. ". - "Please alert your LON-CAPA administrator."); - $outputfile = undef; - } + ($outputfile,$filename) = &Apache::loncommon::create_text_file($r,'csv'); + if (! defined($outputfile)) { return ''; } # # Datestamp my $description = $ENV{'course.'.$ENV{'request.course.id'}.'.description'}; print $outputfile '"'.&Apache::loncommon::csv_translate($description).'",'. '"'.&Apache::loncommon::csv_translate(scalar(localtime(time))).'"'. "\n"; + print $outputfile '"'. + &Apache::loncommon::csv_translate + (&Apache::lonstatistics::section_and_enrollment_description()). + '"'."\n"; foreach my $item ('shortdesc','non_html_notes') { next if (! exists($chosen_output->{$item})); print $outputfile