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

matthew lon-capa-cvs@mail.lon-capa.org
Tue, 24 Feb 2004 20:47:14 -0000


matthew		Tue Feb 24 15:47:14 2004 EDT

  Modified files:              
    /loncom/interface/spreadsheet	assesscalc.pm Spreadsheet.pm 
                                 	lonspreadsheet.pm 
  Log:
  These fixes should go on S10 as soon as possible.
  
  Spreadsheet.pm: Fix to handle the case when a spreadsheet object is 
  created without a valid username/domain passed to new().
  
  assesscalc.pm: Fix to ignore stored data which does not contain the username
  and domain.
  
  lonspreadsheet.pm: Fix to not do stupid things that got us in this mess
  in the first place (only accept form parameters which have values and do not
  send out form parameters without values).
  
  
Index: loncom/interface/spreadsheet/assesscalc.pm
diff -u loncom/interface/spreadsheet/assesscalc.pm:1.32 loncom/interface/spreadsheet/assesscalc.pm:1.33
--- loncom/interface/spreadsheet/assesscalc.pm:1.32	Tue Feb  3 17:44:02 2004
+++ loncom/interface/spreadsheet/assesscalc.pm	Tue Feb 24 15:47:14 2004
@@ -1,5 +1,5 @@
 #
-# $Id: assesscalc.pm,v 1.32 2004/02/03 22:44:02 matthew Exp $
+# $Id: assesscalc.pm,v 1.33 2004/02/24 20:47:14 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -876,6 +876,10 @@
         # We only got one key, so we will access it directly.
         while (my ($key,$sheetdata) = each(%tmp)) {
             my ($sname,$sdom,$sheettype,$symb) = split(':',$key);
+            if (! defined($sname) || $sname eq '' ||
+                ! defined($sdom)  || $sdom eq '' ) {
+                next;
+            }
             if ($symb =~ /\.time$/) {
                 $symb =~ s/\.time$//;
                 $Exportrows{$symb}->{'time'} = $sheetdata;
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.35 loncom/interface/spreadsheet/Spreadsheet.pm:1.36
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.35	Tue Feb 24 12:02:04 2004
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Tue Feb 24 15:47:14 2004
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.35 2004/02/24 17:02:04 albertel Exp $
+# $Id: Spreadsheet.pm,v 1.36 2004/02/24 20:47:14 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -86,6 +86,12 @@
     my ($stype) = ($class =~ /Apache::(.*)$/);
     #
     my ($name,$domain,$filename,$usymb)=@_;
+    if (! defined($name) || $name eq '') {
+        $name = $ENV{'user.name'};
+    }
+    if (! defined($domain) || $domain eq '') {
+        $domain = $ENV{'user.domain'};
+    }
     #
     my $self = {
         name     => $name,
Index: loncom/interface/spreadsheet/lonspreadsheet.pm
diff -u loncom/interface/spreadsheet/lonspreadsheet.pm:1.33 loncom/interface/spreadsheet/lonspreadsheet.pm:1.34
--- loncom/interface/spreadsheet/lonspreadsheet.pm:1.33	Fri Feb 20 12:17:32 2004
+++ loncom/interface/spreadsheet/lonspreadsheet.pm	Tue Feb 24 15:47:14 2004
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.33 2004/02/20 17:17:32 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.34 2004/02/24 20:47:14 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -256,10 +256,15 @@
     $symb = $ENV{'form.usymb'} if (exists($ENV{'form.usymb'}));
     my $name   = $ENV{'user.name'};
     my $domain = $ENV{'user.domain'};
-    if (exists($ENV{'form.sname'})) {
+    if (exists($ENV{'form.sname'}) && $ENV{'form.sname'} ne '') {
         $name   = $ENV{'form.sname'};
         $domain = $ENV{'form.sdomain'};
     }
+    $ENV{'form.sname'} = $name;
+    $ENV{'form.sdomain'} = $domain;
+    #
+    &Apache::lonnet::logthis('name   = "'.$name.'"');
+    &Apache::lonnet::logthis('domain = "'.$domain.'"');
     ##
     ## Check permissions
     my $allowed_to_edit = &Apache::lonnet::allowed('mgr',