--- loncom/interface/Attic/lonchart.pm 2002/06/28 18:06:14 1.44
+++ loncom/interface/Attic/lonchart.pm 2002/07/01 13:59:13 1.47
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# (Publication Handler
#
-# $Id: lonchart.pm,v 1.44 2002/06/28 18:06:14 stredwic Exp $
+# $Id: lonchart.pm,v 1.47 2002/07/01 13:59:13 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";
+ 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='';
@@ -267,9 +299,12 @@ sub CreateForm {
''."\n".
''."\n".
' '."\n";
- $Ptr .= ' ';
+ $Ptr .= '
';
$Ptr .= '';
$Ptr .= "\n";
+ $Ptr .= ' ';
+ $Ptr .= '';
+ $Ptr .= "\n";
$Ptr .= ''."\n";
return $Ptr;
@@ -390,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;
@@ -463,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'})) {
@@ -479,9 +513,12 @@ sub ProcessTopResourceMap {
$hash{'title_'.$currentResourceID};
my $totalProblems=0;
- foreach (split(/\:/,$CacheData{$currentSequence.
+ foreach my $currentProblem (split(/\:/,
+ $CacheData{$currentSequence.
':problems'})) {
- foreach ($CacheData{$currentSequence.':'.$_.':parts'}) {
+ foreach (split(/\:/,$CacheData{$currentSequence.':'.
+ $currentProblem.
+ ':parts'})) {
$totalProblems++;
}
}
@@ -516,10 +553,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)) {
@@ -889,6 +925,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,
@@ -935,7 +976,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";