[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm assesscalc.pm classcalc.pm lonspreadsheet.pm studentcalc.pm

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 05 Sep 2003 01:06:45 -0000


This is a MIME encoded message

--matthew1062724005
Content-Type: text/plain

matthew		Thu Sep  4 21:06:45 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	Spreadsheet.pm assesscalc.pm 
                                 	classcalc.pm lonspreadsheet.pm 
                                 	studentcalc.pm 
  Log:
  Minor modifications brought about due to making warnings fatal.
  
  
--matthew1062724005
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20030904210645.txt"

Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.21 loncom/interface/spreadsheet/Spreadsheet.pm:1.22
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.21	Tue Aug 26 15:14:06 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Thu Sep  4 21:06:45 2003
@@ -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 @@
 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 @@
         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 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 @@
     } elsif ($outputmode eq 'csv') {
         $self->outsheet_csv($r);
     }
+    $self->cleanup();
     return;
 }
 
@@ -1575,7 +1579,7 @@
 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 @@
             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','');
             }
         }
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.17 loncom/interface/spreadsheet/assesscalc.pm:1.18
--- loncom/interface/spreadsheet/assesscalc.pm:1.17	Tue Jul 29 01:22:56 2003
+++ loncom/interface/spreadsheet/assesscalc.pm	Thu Sep  4 21:06:45 2003
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.17 2003/07/29 05:22:56 albertel Exp $
+# $Id: assesscalc.pm,v 1.18 2003/09/05 01:06:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -44,6 +44,8 @@
 package Apache::assesscalc;
 
 use strict;
+use warnings FATAL=>'all';
+no warnings 'uninitialized';
 use Apache::Constants qw(:common :http);
 use Apache::lonnet;
 use Apache::loncommon;
@@ -167,7 +169,6 @@
     #
     # Course Parameters Cache
     if (! %courseopt) {
-        &Apache::lonnet::logthis("loading course options");
         $current_course = $ENV{'request.course.id'};
         undef(%courseopt);
         if (! defined($current_name) || ! defined($current_domain)) {
@@ -689,7 +690,7 @@
 ########################################################
 ########################################################
 sub load_cached_export_rows {
-    %Exportrows = undef;
+    undef(%Exportrows);
     my @tmp = &Apache::lonnet::dump('nohist_calculatedsheets_'.
                                     $ENV{'request.course.id'},
                                     $current_domain,$current_name,undef);
@@ -735,7 +736,9 @@
         ! exists($Exportrows{$symb}) || ! defined($Exportrows{$symb})  ||
         ! $self->check_expiration_time($Exportrows{$symb}->{'time'}) ||
         ! exists($Exportrows{$symb}->{$self->{'filename'}}) ||
-        ! defined($Exportrows{$symb}->{$self->{'filename'}})) {
+        ! defined($Exportrows{$symb}->{$self->{'filename'}}) ||
+        ! ref($Exportrows{$symb}->{$self->{'filename'}}) 
+        ) {
         $self->compute();
     }
     my @Data = @{$Exportrows{$symb}->{$self->{'filename'}}};
Index: loncom/interface/spreadsheet/classcalc.pm
diff -u loncom/interface/spreadsheet/classcalc.pm:1.10 loncom/interface/spreadsheet/classcalc.pm:1.11
--- loncom/interface/spreadsheet/classcalc.pm:1.10	Mon Jun 23 15:58:18 2003
+++ loncom/interface/spreadsheet/classcalc.pm	Thu Sep  4 21:06:45 2003
@@ -1,5 +1,5 @@
 #
-# $Id: classcalc.pm,v 1.10 2003/06/23 19:58:18 matthew Exp $
+# $Id: classcalc.pm,v 1.11 2003/09/05 01:06:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,6 +46,8 @@
 package Apache::classcalc;
 
 use strict;
+use warnings FATAL=>'all';
+no warnings 'uninitialized';
 use Apache::Constants qw(:common :http);
 use Apache::loncoursedata();
 use Apache::lonhtmlcommon();
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.22 loncom/interface/spreadsheet/lonspreadsheet.pm:1.23
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.22	Thu Sep  4 11:17:41 2003
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Thu Sep  4 21:06:45 2003
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.22 2003/09/04 15:17:41 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.23 2003/09/05 01:06:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -54,6 +54,8 @@
 package Apache::lonspreadsheet;
             
 use strict;
+use warnings FATAL=>'all';
+no warnings 'uninitialized';
 use Apache::classcalc();
 use Apache::studentcalc();
 use Apache::assesscalc();
@@ -168,6 +170,10 @@
     $load_dialog .= "</select>\n</td><td>&nbsp;</td></tr>\n</table>\n";
         #
     $result .=<<END;
+<!-- 
+    <fieldset title="File Dialogs" >
+    <legend>File Dialogs</legend>
+  -->
 <!-- load / save dialogs -->
 <table cellspacing="2">
 <tr>
@@ -180,6 +186,9 @@
     </td>
 </tr>
 </table>
+<!--
+    </fieldset>
+  -->
 END
     return ($result,$message);
 }
Index: loncom/interface/spreadsheet/studentcalc.pm
diff -u loncom/interface/spreadsheet/studentcalc.pm:1.16 loncom/interface/spreadsheet/studentcalc.pm:1.17
--- loncom/interface/spreadsheet/studentcalc.pm:1.16	Fri Aug  1 09:33:41 2003
+++ loncom/interface/spreadsheet/studentcalc.pm	Thu Sep  4 21:06:45 2003
@@ -1,5 +1,5 @@
 #
-# $Id: studentcalc.pm,v 1.16 2003/08/01 13:33:41 matthew Exp $
+# $Id: studentcalc.pm,v 1.17 2003/09/05 01:06:45 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -45,6 +45,9 @@
 ###################################################
 package Apache::studentcalc;
 
+use warnings FATAL=>'all';
+no warnings 'uninitialized';
+
 use strict;
 use Apache::Constants qw(:common :http);
 use Apache::lonnet;
@@ -98,8 +101,8 @@
 }
 
 sub clear_package {
-    @Sequences = undef;
-    %Exportrows = undef;
+    undef(@Sequences);
+    undef(%Exportrows);
 }
 
 sub get_title {
@@ -493,7 +496,7 @@
 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;
         (undef,$value) = split('__&&&__',$value);
         $value = 'Default' if (! defined($value));
@@ -510,7 +513,7 @@
         next if ($row == 0);
         my ($symb,undef) = split('__&&&__',$formula);
         $self->{'row_numbers'}->{$symb} = $row;
-        $self->{'maxrow'} = $1 if ($1 > $self->{'maxrow'});
+        $self->{'maxrow'} = $row if ($row > $self->{'maxrow'});
     }
 }
 
@@ -540,7 +543,7 @@
 #############################################
 #############################################
 sub load_cached_export_rows {
-    %Exportrows = undef;
+    undef(%Exportrows);
     my @tmp = &Apache::lonnet::dump('nohist_calculatedsheets',
 		     $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
 		     $ENV{'course.'.$ENV{'request.course.id'}.'.num'},undef);

--matthew1062724005--