--- loncom/interface/Attic/lonchart.pm 2002/06/28 19:34:12 1.45 +++ loncom/interface/Attic/lonchart.pm 2002/06/28 21:12:46 1.46 @@ -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.46 2002/06/28 21:12:46 stredwic Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,7 +55,7 @@ use Apache::loncommon(); use HTML::TokeParser; use GDBM_File; -#my $jr; +my $jr; # ----- FORMAT PRINT DATA ---------------------------------------------- sub FormatStudentInformation { @@ -244,6 +244,38 @@ sub CreateTableHeadings { return $Str; } +sub CreateColumnSelectors { + my ($CacheData,$studentInformation,$headings,$spacePadding)=@_; + my $Str=''; + + $Str .= '
'."\n"; + $Str .= ''; + $Str .= '
'."\n"; + return $Str; + + for(my $index=0; $index<(scalar @$headings); $index++) { + my $data=$$headings[$index]; + $Str .= $data; + + my @dataLength=split(//,$data); + my $length=scalar @dataLength; + $Str .= (' 'x($CacheData->{$$studentInformation[$index].'Length'}- + $length)); + $Str .= $spacePadding; + } + + 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; + } + + return $Str; +} + sub CreateForm { my $OpSel1=''; my $OpSel2=''; @@ -393,6 +425,7 @@ sub ProcessTopResourceMap { my ($currentSequence, $currentResourceID, $lastResourceID); $currentResourceID=$hash{'ids_/res/'.$ENV{'request.course.uri'}}; + push(@currentResource, $currentResourceID); $lastResourceID=-1; $currentSequence=-1; my $topLevelSequenceNumber = $currentSequence; @@ -466,8 +499,6 @@ sub ProcessTopResourceMap { if($currentResourceID eq $lastResourceID) { #pop off last resource of sequence $currentResourceID=pop(@currentResource); - #pop to get last resource in previous sequence - $currentResourceID=pop(@currentResource); $lastResourceID=pop(@finishResource); if(defined($CacheData{$currentSequence.':problems'})) { @@ -519,10 +550,9 @@ sub ProcessTopResourceMap { foreach (split(/\,/,$hash{'to_'.$currentResourceID})) { push(@nextResources, $hash{'goesto_'.$_}); } - pop(@currentResource); push(@currentResource, @nextResources); - # Set the next resource to be popped(processed) - $currentResourceID=$currentResource[-1]; + # Set the next resource to be processed + $currentResourceID=pop(@currentResource); } unless (untie(%hash)) { @@ -892,6 +922,11 @@ sub BuildChart { if(!$c->aborted()) { $r->print('

'.(scalar @students). ' students

'); } if(!$c->aborted()) { $r->rflush(); } +# if(!$c->aborted()) { $r->print(&CreateColumnSelectors( +# \%CacheData, +# \@studentInformation, +# \@headings, +# $spacePadding)); } if(!$c->aborted()) { $r->print(&CreateTableHeadings( \%CacheData, \@studentInformation, @@ -938,7 +973,7 @@ sub BuildChart { sub handler { my $r=shift; -# $jr=$r; + $jr=$r; unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) { $ENV{'user.error.msg'}= $r->uri.":vgr:0:0:Cannot view grades for complete course";