--- loncom/interface/Attic/lonchart.pm 2002/07/01 21:12:06 1.49 +++ loncom/interface/Attic/lonchart.pm 2002/07/02 22:06:53 1.53 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonchart.pm,v 1.49 2002/07/01 21:12:06 stredwic Exp $ +# $Id: lonchart.pm,v 1.53 2002/07/02 22:06:53 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,6 +46,10 @@ # ### +=pod + +=cut + package Apache::lonchart; use strict; @@ -55,15 +59,15 @@ use Apache::loncommon(); use HTML::TokeParser; use GDBM_File; -my $jr; +#my $jr; # ----- FORMAT PRINT DATA ---------------------------------------------- sub FormatStudentInformation { - my ($cache,$name,$studentInformation,$reselected,$spacePadding)=@_; - my $Str='
'; + my ($cache,$name,$studentInformation,$spacePadding)=@_; + my $Str=''; for(my $index=0; $index<(scalar @$studentInformation); $index++) { - if(!&ShouldShowColumn($reselected, 'heading', $index)) { + if(!&ShouldShowColumn($cache, 'heading'.$index)) { next; } my $data=$cache->{$name.':'.$studentInformation->[$index]}; @@ -80,7 +84,7 @@ sub FormatStudentInformation { } sub FormatStudentData { - my ($reselected,$name,$coid,$studentInformation,$spacePadding,$ChartDB)=@_; + my ($name,$coid,$studentInformation,$spacePadding,$ChartDB)=@_; my ($sname,$sdom) = split(/\:/,$name); my $Str; my %CacheData; @@ -91,26 +95,19 @@ sub FormatStudentData { # Handle Student information ------------------------------------------ # Handle user data $Str=&FormatStudentInformation(\%CacheData, $name, $studentInformation, - $reselected, $spacePadding); + $spacePadding); # Handle errors if($CacheData{$name.':error'} =~ /environment/) { + $Str .= ''; return $Str; -# my $errorMessage = $CacheData{$name.':error'}; -# return '
'; untie(%CacheData); - $Str .= '
'; + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; + my $Str=''; for(my $index=0; $index<(scalar @$headings); $index++) { - if(!&ShouldShowColumn($reselected, 'heading', $index)) { + if(!&ShouldShowColumn($CacheData, 'heading'.$index)) { next; } + $Str .= ' '; return $Str; } sub CreateColumnSelectionBox { - my ($CacheData,$studentInformation,$headings,$reselected,$spacePadding)=@_; + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; my $missing=0; - my $notThere=''; } foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { - if(!&ShouldShowColumn($reselected, 'sequence', $sequence)) { + if(!&ShouldShowColumn($CacheData, 'sequence'.$sequence)) { next; } + $Str .= ' '; my $data=$$headings[$index]; $Str .= $data; @@ -239,13 +239,15 @@ 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'}); @@ -253,25 +255,26 @@ sub CreateTableHeadings { (scalar @titleLength); $Str .= (' 'x$leftover); $Str .= $spacePadding; + $Str .= 'Total Solved/Total Problems '; + $Str .= '
Select column to view:
'; + my $notThere='Select column to view:'; my $name; - $notThere .= '  '; + $notThere .= ' '; $notThere .= '
'; + $notThere .= ''; } else { - $notThere=''; + $notThere=''; } sub CreateColumnSelectors { - my ($CacheData,$studentInformation,$headings,$reselected,$spacePadding)=@_; + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; my $found=0; my ($name, $length, $position); - my $present=' '; } - return $notThere; + return $notThere.' '; + my $present='
'; $name = $headings->[$index]; - $length=$CacheData->{$$studentInformation[$index].'Length'}; - $position=int($length/2); - $present .= (' 'x($position)); $present .= ''; - $position+=2; - $present .= (' 'x($length-$position)); - $present .= $spacePadding; + $present .= ' | '; $found++; } foreach my $sequence (split(/\:/,$CacheData->{'orderedSequences'})) { - if(!&ShouldShowColumn($reselected, 'sequence', $sequence)) { + if(!&ShouldShowColumn($CacheData, 'sequence'.$sequence)) { next; } + $present .= ''; $name = $CacheData->{$sequence.':title'}; - $length=$CacheData->{$sequence.':columnWidth'}; - $position=int($length/2); - $present .= (' 'x($position)); $present .= ''; - $position+=2; - $present .= (' 'x($length-$position)); - $present .= $spacePadding; + $present .= ' | '; $found++; } if($found) { - $present .= ''; $present = $present; } else { - $present = ''; + $present = ''; } - return $present.''."\n";; + return $present.' |