--- loncom/interface/Attic/lonspreadsheet.pm	2002/07/15 12:26:51	1.97
+++ loncom/interface/Attic/lonspreadsheet.pm	2002/09/09 18:28:02	1.100.2.1
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.97 2002/07/15 12:26:51 www Exp $
+# $Id: lonspreadsheet.pm,v 1.100.2.1 2002/09/09 18:28:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,7 +71,7 @@ use Apache::lonnet;
 use Apache::Constants qw(:common :http);
 use GDBM_File;
 use HTML::TokeParser;
-
+use Apache::lonhtmlcommon;
 #
 # Caches for previously calculated spreadsheets
 #
@@ -768,6 +768,14 @@ sub expandnamed {
         }
         if ($#matches == 0) {
             $returnvalue = '$c{\''.$matches[0].'\'}';
+        } elsif ($#matches > 0) {
+            # more than one match.  Look for a concise one
+            $returnvalue =  "'non-unique parameter name : $expression'";
+            foreach (@matches) {
+                if (/^$expression$/) {
+                    $returnvalue = '$c{\''.$_.'\'}';
+                }
+            }
         } else {
             $returnvalue =  "'bad parameter name : $expression'";
         }
@@ -1652,6 +1660,8 @@ sub updateclasssheet {
             my ($end,$start)=split(/\:/,&Apache::lonnet::unescape($value));
             my $active=1;
             if (($end) && ($now>$end)) { $active=0; }
+            $active = 1 if ($ENV{'form.Status'} eq 'Any');
+            $active = !$active if ($ENV{'form.Status'} eq 'Expired');
             if ($active) {
                 my $rowlabel='';
                 $name=&Apache::lonnet::unescape($name);
@@ -1740,11 +1750,14 @@ sub updatestudentassesssheet {
     my $safeeval=shift;
     my %bighash;
     my $stype=&gettype($safeeval);
+    my $uname=&getuname($safeeval);
+    my $udom =&getudom($safeeval);
     my %current=();
-    unless ($updatedata{$ENV{'request.course.fn'}.'_'.$stype}) {
+    unless ($updatedata{
+        $ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}) {
 # -------------------------------------------------------------------- Tie hash
       if (tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
-                       &GDBM_READER,0640)) {
+                       &GDBM_READER(),0640)) {
 # --------------------------------------------------------- Get all assessments
 
 	my %allkeys=('timestamp' => 
@@ -1822,7 +1835,7 @@ sub updatestudentassesssheet {
         } elsif ($stype eq 'studentcalc') {
             %current=%allassess;
         }
-        $updatedata{$ENV{'request.course.fn'}.'_'.$stype}=
+        $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}=
 	    join('___;___',%current);
     } else {
         return 'Could not access course data';
@@ -1830,7 +1843,7 @@ sub updatestudentassesssheet {
 # ------------------------------------------------------ Get current from cache
     } else {
         %current=split(/\_\_\_\;\_\_\_/,
-		       $updatedata{$ENV{'request.course.fn'}.'_'.$stype});
+	     $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom});
     }
 # -------------------- Find discrepancies between the course row table and this
 #
@@ -2120,7 +2133,7 @@ sub loadassessment {
    my %c=();
 
    if (tie(%parmhash,'GDBM_File',
-           &getcfn($safeeval).'_parms.db',&GDBM_READER,0640)) {
+           &getcfn($safeeval).'_parms.db',&GDBM_READER(),0640)) {
     my %f=&getformulas($safeeval);
     foreach (keys(%f))  {
 	if ($_=~/^A/) {
@@ -2742,6 +2755,9 @@ ENDSCRIPT
     }
 
 # ------------------------------------------------------------------ Insertrows
+    $r->print(' Student Status: '.
+              &Apache::lonhtmlcommon::StatusOptions
+              ($ENV{'form.Status'},'sheet'));
 
    $r->print(<<ENDINSERTBUTTONS);
 <br>