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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 20 Mar 2003 19:10:27 -0000


matthew		Thu Mar 20 14:10:27 2003 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  Fixes bugs 1295 and 753 in unstable release (fixes have already been made
  to the lonspreadsheet.pm for version 0.6.2 of LON-CAPA.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.177 loncom/interface/lonspreadsheet.pm:1.178
--- loncom/interface/lonspreadsheet.pm:1.177	Tue Mar 11 10:00:47 2003
+++ loncom/interface/lonspreadsheet.pm	Thu Mar 20 14:10:27 2003
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.177 2003/03/11 15:00:47 albertel Exp $
+# $Id: lonspreadsheet.pm,v 1.178 2003/03/20 19:10:27 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -152,9 +152,9 @@
                                              $ENV{'form.ufn'} eq 'default')) {
         $ENV{'form.ufn'}='default_'.$1;
     }
-    if (!$ENV{'form.ufn'} || $ENV{'form.ufn'} eq 'default') {
-        $ENV{'form.ufn'}='course_default_'.$sheettype;
-    }
+#    if (!$ENV{'form.ufn'} || $ENV{'form.ufn'} eq 'default') {
+#        $ENV{'form.ufn'}='course_default_'.$sheettype;
+#    }
     #
     # Interactive loading of specific sheet?
     #
@@ -352,6 +352,7 @@
         $oldsheets{'course'} ne $sheet->{'cid'}) {
         undef %oldsheets;
         undef %loadedcaches;
+        &Apache::lonspreadsheet::Spreadsheet::clear_package_variables();
     }
     $oldsheets{'course'} = $sheet->{'cid'};
     #
@@ -534,6 +535,25 @@
 my %rowlabel_cache;
 #my %oldsheets;
 
+sub clear_package_variables {
+    undef %courseopt;
+    undef %useropt;
+    undef %parmhash;
+    undef %Section;
+    undef %expiredates;
+    undef $cachedassess;
+    undef %cachedstores;
+    undef %starttimes;
+    undef %usedtimes;
+    undef %numbertimes;
+    undef $includedir;
+    undef %spreadsheets;
+    undef %courserdatas;
+    undef %userrdatas;
+    undef %defaultsheets;
+    undef %rowlabel_cache;
+}
+
 sub complete_recalc {
     my $self = shift;
     undef %spreadsheets;
@@ -751,6 +771,15 @@
     #
     my ($uname,$udom,$stype,$usymb)=@_;
     #
+    if (! exists($Section{$uname.':'.$udom})) {
+        my $classlist = &Apache::loncoursedata::get_classlist();
+        #
+        foreach my $student (keys(%$classlist)) {
+            my ($studentDomain,$studentName,undef,undef,undef,$studentSection,
+                undef,undef) = @{$classlist->{$student}};
+            $Section{$studentName.':'.$studentDomain} = $studentSection;
+        }
+    }
     my $self = {
         uname => $uname,
         udom  => $udom,