[LON-CAPA-cvs] cvs: loncom /interface lonspreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 15 Nov 2002 18:59:28 -0000
matthew Fri Nov 15 13:59:28 2002 EDT
Modified files:
/loncom/interface lonspreadsheet.pm
Log:
Bugfix: 'Hide empty rows' now works.
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.140 loncom/interface/lonspreadsheet.pm:1.141
--- loncom/interface/lonspreadsheet.pm:1.140 Fri Nov 15 13:19:10 2002
+++ loncom/interface/lonspreadsheet.pm Fri Nov 15 13:59:28 2002
@@ -1,5 +1,5 @@
#
-# $Id: lonspreadsheet.pm,v 1.140 2002/11/15 18:19:10 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.141 2002/11/15 18:59:28 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1332,6 +1332,19 @@
foreach my $rownum (@Rows) {
my ($rowlabel,@rowdata) = &get_row($sheet,$rownum);
next if ($rowlabel =~ /^\s*$/);
+ next if (($sheet->{'sheettype'} eq 'assesscalc') &&
+ (! $ENV{'form.showall'}) &&
+ ($rowdata[0]->{'value'} =~ /^\s*$/));
+ if ($sheet->{'sheettype'} =~ /^(studentcalc|classcalc)$/) {
+ my $row_is_empty = 1;
+ foreach my $cell (@rowdata) {
+ if ($cell->{'value'} !~ /^\s*$/) {
+ $row_is_empty = 0;
+ last;
+ }
+ }
+ next if $row_is_empty;
+ }
#
my $defaultbg='#E0FF';
#
@@ -1753,7 +1766,8 @@
if ($fh=Apache::File->new($includedir.'/'.$dfn)) {
$sheetxml=join('',<$fh>);
} else {
- $sheetxml='<field row="0" col="A">"Error"</field>';
+ # $sheetxml='<field row="0" col="A">"Error"</field>';
+ $sheetxml='<field row="0" col="A"></field>';
}
%f=%{&parse_sheet(\$sheetxml)};
} elsif($fn=~/\/*\.spreadsheet$/) {
@@ -3115,7 +3129,7 @@
# Write the modified worksheet
$r->print('<b>Current sheet:</b> '.$sheet->{'filename'}.'</p>');
&tmpwrite($sheet);
- if ($sheet->{'sheettype'} eq 'studentcalc') {
+ if ($sheet->{'sheettype'} eq 'assesscalc') {
$r->print('<p>Show rows with empty A column: ');
} else {
$r->print('<p>Show empty rows: ');