--- loncom/interface/spreadsheet/Spreadsheet.pm 2003/08/26 19:14:06 1.21 +++ loncom/interface/spreadsheet/Spreadsheet.pm 2003/09/05 01:06:45 1.22 @@ -1,5 +1,5 @@ # -# $Id: Spreadsheet.pm,v 1.21 2003/08/26 19:14:06 matthew Exp $ +# $Id: Spreadsheet.pm,v 1.22 2003/09/05 01:06:45 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -48,6 +48,8 @@ Spreadsheet package Apache::Spreadsheet; use strict; +use warnings FATAL=>'all'; +no warnings 'uninitialized'; use Apache::Constants qw(:common :http); use Apache::lonnet; use Safe; @@ -90,7 +92,7 @@ sub new { type => $stype, symb => $usymb, errorlog => '', - maxrow => '', + maxrow => 0, cid => $ENV{'request.course.id'}, cnum => $ENV{'course.'.$ENV{'request.course.id'}.'.num'}, cdom => $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, @@ -248,6 +250,7 @@ sub load_spreadsheet_expirationdates { sub check_expiration_time { my $self = shift; my ($time)=@_; + return 0 if (! defined($time)); my ($key1,$key2,$key3,$key4,$key5); # Description of keys # @@ -1144,6 +1147,7 @@ sub display { } elsif ($outputmode eq 'csv') { $self->outsheet_csv($r); } + $self->cleanup(); return; } @@ -1575,7 +1579,7 @@ sub load { sub set_row_sources { my $self = shift; while (my ($cell,$value) = each(%{$self->{'formulas'}})) { - next if ($cell !~ /^A(\d+)/ && $1 > 0); + next if ($cell !~ /^A(\d+)/ || $1 < 1); my $row = $1; $self->{'row_source'}->{$row} = $value; } @@ -1637,8 +1641,10 @@ sub save { return $reply if ($reply ne 'ok'); } if ($self->is_default()) { - &Apache::lonnet::expirespread('','',$self->{'type'},''); - if ($self->{'type'} eq 'assesscalc') { + if ($self->{'type'} eq 'studentcalc') { + &Apache::lonnet::expirespread('','','studentcalc',''); + } elsif ($self->{'type'} eq 'assesscalc') { + &Apache::lonnet::expirespread('','','assesscalc',''); &Apache::lonnet::expirespread('','','studentcalc',''); } }