--- loncom/interface/Attic/lonspreadsheet.pm 2002/07/15 12:26:51 1.97 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/08/29 15:35:01 1.103 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.97 2002/07/15 12:26:51 www Exp $ +# $Id: lonspreadsheet.pm,v 1.103 2002/08/29 15:35:01 matthew 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 # @@ -146,7 +146,7 @@ undef %v; undef %t; undef %f; undef %c; -undef %rl; +undef %rowlabel; undef @os; $maxrow=0; @@ -721,6 +721,53 @@ sub SUMMIN { return $sum; } +#------------------------------------------------------- + +=item MINPARM(parametername) + +Returns the minimum value of the parameters matching the parametername. +parametername should be a string such as 'duedate'. + +=cut + +#------------------------------------------------------- +sub MINPARM { + my ($expression) = @_; + my $min = undef; + study($expression); + foreach $parameter (keys(%c)) { + next if ($parameter !~ /$expression/); + if ((! defined($min)) || ($min > $c{$parameter})) { + $min = $c{$parameter} + } + } + return $min; +} + +#------------------------------------------------------- + +=item MAXPARM(parametername) + +Returns the maximum value of the parameters matching the input parameter name. +parametername should be a string such as 'duedate'. + +=cut + +#------------------------------------------------------- +sub MAXPARM { + my ($expression) = @_; + my $max = undef; + study($expression); + foreach $parameter (keys(%c)) { + next if ($parameter !~ /$expression/); + if ((! defined($min)) || ($max < $c{$parameter})) { + $max = $c{$parameter} + } + } + return $max; +} + +#-------------------------------------------------------- sub expandnamed { my $expression=shift; if ($expression=~/^\&/) { @@ -768,6 +815,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'"; } @@ -896,8 +951,8 @@ sub outrowassess { my @cols=(); if ($n) { my ($usy,$ufn)=split(/\_\_\&\&\&\_\_/,$f{'A'.$n}); - if ($rl{$usy}) { - $cols[0]=$rl{$usy}.'
'. + if ($rowlabel{$usy}) { + $cols[0]=$rowlabel{$usy}.'
'. '