--- loncom/interface/Attic/lonchart.pm 2002/07/01 13:59:13 1.47 +++ loncom/interface/Attic/lonchart.pm 2002/07/02 15:13:06 1.50 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonchart.pm,v 1.47 2002/07/01 13:59:13 stredwic Exp $ +# $Id: lonchart.pm,v 1.50 2002/07/02 15:13:06 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -59,16 +59,20 @@ my $jr; # ----- FORMAT PRINT DATA ---------------------------------------------- sub FormatStudentInformation { - my ($cache,$name,$studentInformation,$spacePadding)=@_; - my $Str='
'; + my ($cache,$name,$studentInformation,$reselected,$spacePadding)=@_; + my $Str=''; - foreach (@$studentInformation) { - my $data=$cache->{$name.':'.$_}; + for(my $index=0; $index<(scalar @$studentInformation); $index++) { + if(!&ShouldShowColumn($reselected, '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; } @@ -76,7 +80,7 @@ sub FormatStudentInformation { } sub FormatStudentData { - my ($name,$coid,$studentInformation,$spacePadding,$ChartDB)=@_; + my ($reselected,$name,$coid,$studentInformation,$spacePadding,$ChartDB)=@_; my ($sname,$sdom) = split(/\:/,$name); my $Str; my %CacheData; @@ -87,26 +91,19 @@ sub FormatStudentData { # Handle Student information ------------------------------------------ # Handle user data $Str=&FormatStudentInformation(\%CacheData, $name, $studentInformation, - $spacePadding); + $reselected, $spacePadding); # Handle errors if($CacheData{$name.':error'} =~ /environment/) { + $Str .= ''; return $Str; -# my $errorMessage = $CacheData{$name.':error'}; -# return '
'; untie(%CacheData); - $Str .= '
'; for(my $index=0; $index<(scalar @$headings); $index++) { + if(!&ShouldShowColumn($reselected, 'heading', $index)) { + next; + } + my $data=$$headings[$index]; $Str .= $data; @@ -230,7 +235,12 @@ sub CreateTableHeadings { } foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { - $Str .= $CacheData->{$sequence.':title'}; + if(!&ShouldShowColumn($reselected, 'sequence', $sequence)) { + next; + } + + my $name = $CacheData->{$sequence.':title'}; + $Str .= $name; my @titleLength=split(//,$CacheData->{$sequence.':title'}); my $leftover=$CacheData->{$sequence.':columnWidth'}- (scalar @titleLength); @@ -244,36 +254,90 @@ sub CreateTableHeadings { return $Str; } -sub CreateColumnSelectors { - my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; - my $Str=''; +sub CreateColumnSelectionBox { + my ($CacheData,$studentInformation,$headings,$reselected,$spacePadding)=@_; - $Str .= ''."\n"; - return $Str; + my $missing=0; + my $notThere='
'; + for(my $index=0; $index<(scalar @$headings); $index++) { + if(!&ShouldShowColumn($reselected, 'heading', $index)) { + next; + } + $name = $headings->[$index]; + $length=$CacheData->{$$studentInformation[$index].'Length'}; + $position=int($length/2); + $present .= (' 'x($position)); + $present .= ''; + $position+=2; + $present .= (' 'x($length-$position)); + $present .= $spacePadding; + $found++; } foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { - $Str .= $CacheData->{$sequence.':title'}; - my @titleLength=split(//,$CacheData->{$sequence.':title'}); - my $leftover=$CacheData->{$sequence.':columnWidth'}- - (scalar @titleLength); - $Str .= (' 'x$leftover); - $Str .= $spacePadding; + if(!&ShouldShowColumn($reselected, 'sequence', $sequence)) { + next; + } + $name = $CacheData->{$sequence.':title'}; + $length=$CacheData->{$sequence.':columnWidth'}; + $position=int($length/2); + $present .= (' 'x($position)); + $present .= ''; + $position+=2; + $present .= (' 'x($length-$position)); + $present .= $spacePadding; + $found++; } - return $Str; + if($found) { + $present .= ''; + $present = $present; + } else { + $present = ''; + } + + return $present.''."\n";; } sub CreateForm { @@ -285,42 +349,46 @@ sub CreateForm { elsif ($Status eq 'Expired' ) { $OpSel2 = 'selected'; } else { $OpSel1 = 'selected'; } - my $Ptr = '