--- loncom/interface/Attic/lonchart.pm 2002/06/28 19:34:12 1.45 +++ loncom/interface/Attic/lonchart.pm 2002/07/03 14:11:14 1.54 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonchart.pm,v 1.45 2002/06/28 19:34:12 stredwic Exp $ +# $Id: lonchart.pm,v 1.54 2002/07/03 14:11:14 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,6 +46,10 @@ # ### +=pod + +=cut + package Apache::lonchart; use strict; @@ -60,15 +64,19 @@ use GDBM_File; sub FormatStudentInformation { my ($cache,$name,$studentInformation,$spacePadding)=@_; - my $Str='
'; + my $Str=''; - foreach (@$studentInformation) { - my $data=$cache->{$name.':'.$_}; + for(my $index=0; $index<(scalar @$studentInformation); $index++) { + if(!&ShouldShowColumn($cache, 'heading'.$index)) { + next; + } + my $data=$cache->{$name.':'.$studentInformation->[$index]}; $Str .= $data; my @dataLength=split(//,$data); my $length=scalar @dataLength; - $Str .= (' 'x($cache->{$_.'Length'}-$length)); + $Str .= (' 'x($cache->{$studentInformation->[$index].'Length'}- + $length)); $Str .= $spacePadding; } @@ -91,22 +99,15 @@ sub FormatStudentData { # Handle errors if($CacheData{$name.':error'} =~ /environment/) { + $Str .= ''; return $Str; -# my $errorMessage = $CacheData{$name.':error'}; -# return '
'; untie(%CacheData); - $Str .= '
'; + my $Str=''; for(my $index=0; $index<(scalar @$headings); $index++) { + if(!&ShouldShowColumn($CacheData, 'heading'.$index)) { + next; + } + + $Str .= ' '; return $Str; } +sub CreateColumnSelectionBox { + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; + + my $missing=0; + my $notThere=''; } foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { - $Str .= $CacheData->{$sequence.':title'}; + if(!&ShouldShowColumn($CacheData, 'sequence'.$sequence)) { + next; + } + + $Str .= ' '; my $data=$$headings[$index]; $Str .= $data; @@ -227,68 +239,162 @@ sub CreateTableHeadings { $Str .= (' 'x($CacheData->{$$studentInformation[$index].'Length'}- $length)); $Str .= $spacePadding; + $Str .= ''; } - $Str .= 'Total Solved/Total Problems'; - $Str .= ''; + $Str .= ' '; + my $name = $CacheData->{$sequence.':title'}; + $Str .= $name; my @titleLength=split(//,$CacheData->{$sequence.':title'}); my $leftover=$CacheData->{$sequence.':columnWidth'}- (scalar @titleLength); $Str .= (' 'x$leftover); $Str .= $spacePadding; + $Str .= ''; + $Str .= ' Total Solved/Total ProblemsSelect column to view:'; + my $name; + $notThere .= ' '; + $notThere .= ''; + } else { + $notThere=' '; +} + +sub CreateColumnSelectors { + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; + + my $found=0; + my ($name, $length, $position); + + my $present=' '; + } + + return $notThere.' Note: Uncheck the boxes above a column to '; + $present .= 'remove that column from the display.'."\n"; + + $present .= '
'; + $present .= ''; + $present .= ' | '; + $found++; + } + + foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { + if(!&ShouldShowColumn($CacheData, 'sequence'.$sequence)) { + next; + } + $present .= ''; + $present .= ''; + $present .= ' | '; + $found++; + } + + if(!$found) { + $present = ''; + } + + return $present.'