--- loncom/interface/statistics/lonstudentassessment.pm 2005/04/19 01:28:25 1.124
+++ loncom/interface/statistics/lonstudentassessment.pm 2005/08/26 21:53:23 1.125
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentassessment.pm,v 1.124 2005/04/19 01:28:25 matthew Exp $
+# $Id: lonstudentassessment.pm,v 1.125 2005/08/26 21:53:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -622,17 +622,21 @@ Return a line of the chart for a student
my @sequences;
my $navmap; # Have to keep this around since weakref is a bit zealous
+sub html_cleanup {
+ undef(%prog_state);
+ undef(%width);
+ #
+ undef($navmap);
+ undef(@sequences);
+}
+
sub html_initialize {
my ($r) = @_;
#
$padding = ' 'x3;
$count = 0;
$nodata_count = 0;
- undef(%prog_state);
- undef(%width);
- #
- undef($navmap);
- undef(@sequences);
+ &html_cleanup();
($navmap,@sequences) =
&Apache::lonstatistics::selected_sequences_with_assessments();
if (! ref($navmap)) {
@@ -856,7 +860,7 @@ sub html_finish {
}
$r->rflush();
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
- undef($navmap);
+ &html_cleanup();
return;
}
@@ -963,8 +967,7 @@ my %formula_data;
my $navmap;
my @sequences;
-sub excel_initialize {
- my ($r) = @_;
+sub excel_cleanup {
#
undef ($excel_sheet);
undef ($excel_workbook);
@@ -980,6 +983,12 @@ sub excel_initialize {
#
undef($navmap);
undef(@sequences);
+}
+
+sub excel_initialize {
+ my ($r) = @_;
+
+ &excel_cleanup();
($navmap,@sequences) =
&Apache::lonstatistics::selected_sequences_with_assessments();
if (! ref($navmap)) {
@@ -1465,14 +1474,12 @@ sub excel_outputstudent {
sub excel_finish {
my ($r) = @_;
if ($request_aborted || ! defined($navmap) || ! defined($excel_sheet)) {
+ &excel_cleanup();
return;
}
#
# Write the excel file
$excel_workbook->close();
- my $c = $r->connection();
- #
- return if($c->aborted());
#
# Close the progress window
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
@@ -1481,6 +1488,7 @@ sub excel_finish {
$r->print('
'.
'Your Excel spreadsheet.'."\n");
$r->rflush();
+ &excel_cleanup();
return;
}
@@ -1511,10 +1519,7 @@ my %prog_state; # progress window state
my $navmap;
my @sequences;
-sub csv_initialize{
- my ($r) = @_;
- #
- # Clean up
+sub csv_cleanup {
undef($outputfile);
undef($filename);
undef($request_aborted);
@@ -1522,6 +1527,12 @@ sub csv_initialize{
#
undef($navmap);
undef(@sequences);
+}
+
+sub csv_initialize{
+ my ($r) = @_;
+
+ &csv_cleanup();
($navmap,@sequences) =
&Apache::lonstatistics::selected_sequences_with_assessments();
if (! ref($navmap)) {
@@ -1707,13 +1718,11 @@ sub csv_outputstudent {
sub csv_finish {
my ($r) = @_;
if ($request_aborted || ! defined($navmap) || ! defined($outputfile)) {
+ &csv_cleanup();
return;
}
close($outputfile);
#
- my $c = $r->connection();
- return if ($c->aborted());
- #
# Close the progress window
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
#
@@ -1721,6 +1730,7 @@ sub csv_finish {
$r->print('
'.
''.&mt('Your csv file.').''."\n");
$r->rflush();
+ &csv_cleanup();
return;
}