[LON-CAPA-cvs] cvs: loncom /interface lonchart.pm
stredwic
lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jun 2002 21:12:46 -0000
stredwic Fri Jun 28 17:12:46 2002 EDT
Modified files:
/loncom/interface lonchart.pm
Log:
See bug 218. The problems in the top level sequence now get a heading for
their column. Changed the pop order on my artifical stack.
Index: loncom/interface/lonchart.pm
diff -u loncom/interface/lonchart.pm:1.45 loncom/interface/lonchart.pm:1.46
--- loncom/interface/lonchart.pm:1.45 Fri Jun 28 15:34:12 2002
+++ loncom/interface/lonchart.pm Fri Jun 28 17:12:46 2002
@@ -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 HTML::TokeParser;
use GDBM_File;
-#my $jr;
+my $jr;
# ----- FORMAT PRINT DATA ----------------------------------------------
sub FormatStudentInformation {
@@ -244,6 +244,38 @@
return $Str;
}
+sub CreateColumnSelectors {
+ my ($CacheData,$studentInformation,$headings,$spacePadding)=@_;
+ my $Str='';
+
+ $Str .= '<form name="stat" method="post" action="/adm/chart" >'."\n";
+ $Str .= '<input type="submit" name="sort" value="Refresh Chart"/>';
+ $Str .= '</form>'."\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 @@
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 @@
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 @@
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 @@
if(!$c->aborted()) { $r->print('<h3>'.(scalar @students).
' students</h3>'); }
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 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";