[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 05 Sep 2002 14:38:58 -0000


matthew		Thu Sep  5 10:38:58 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  Finishing up earlier work trying to reduce use of $safeeval->reval().  More
  to do.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.106 loncom/interface/lonspreadsheet.pm:1.107
--- loncom/interface/lonspreadsheet.pm:1.106	Sun Sep  1 14:06:52 2002
+++ loncom/interface/lonspreadsheet.pm	Thu Sep  5 10:38:57 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.106 2002/09/01 18:06:52 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.107 2002/09/05 14:38:57 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1395,12 +1395,13 @@
 #
 
 sub readsheet {
-    my ($safeeval,$fn)=@_;
-    my $stype = &gettype($safeeval);
-    my $cnum  = &getcnum($safeeval);
-    my $cdom  = &getcdom($safeeval);
-    my $chome = &getchome($safeeval);
-
+    my ($safeeval,$sheetdata,$fn)=@_;
+    #
+    my $stype = $sheetdata->{'sheettype'};
+    my $cnum  = $sheetdata->{'cnum'};
+    my $cdom  = $sheetdata->{'cdom'};
+    my $chome = $sheetdata->{'chome'};
+    #
     if (! defined($fn)) {
         # There is no filename. Look for defaults in course and global, cache
         unless ($fn=$defaultsheets{$cnum.'_'.$cdom.'_'.$stype}) {
@@ -1822,7 +1823,7 @@
              '_discussion' =>'<a href="/adm/assesscalc?usymb=_discussion'.
              $adduserstr.'">Discussion</a>'
              );
-        foreach (keys(%bighash)) {
+        while (($_,undef) = each(%bighash)) {
             next if ($_!~/^src\_(\d+)\.(\d+)$/);
             my $mapid=$1;
             my $resid=$2;
@@ -2292,7 +2293,7 @@
         # Not cached
         #        
         my ($thissheet,$sheetdata)=&makenewsheet($uname,$udom,$stype,$usymb);
-        &readsheet($thissheet,$fn);
+        &readsheet($thissheet,$sheetdata,$fn);
         &updatesheet($thissheet,$sheetdata);
         &loadrows($thissheet,$sheetdata);
         &calcsheet($thissheet,$sheetdata); 
@@ -2540,7 +2541,7 @@
         &setfilename($asheet,$ENV{'form.ufn'});
         &tmpread($asheet);
     } else {
-        &readsheet($asheet,$ENV{'form.ufn'});
+        &readsheet($asheet,$asheetdata,$ENV{'form.ufn'});
     }
     # Print out user information
     unless ($asheetdata->{'sheettype'} eq 'classcalc') {