--- loncom/interface/lonstatistics.pm 2002/07/24 14:52:32 1.30 +++ loncom/interface/lonstatistics.pm 2002/07/25 19:30:24 1.31 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # (Publication Handler # -# $Id: lonstatistics.pm,v 1.30 2002/07/24 14:52:32 stredwic Exp $ +# $Id: lonstatistics.pm,v 1.31 2002/07/25 19:30:24 minaeibi Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +31,7 @@ # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei # YEAR=2002 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei -# 5/12,5/14,5/15,5/19,5/26,7/16 Behrouz Minaei +# 5/12,5/14,5/15,5/19,5/26,7/16,25/7 Behrouz Minaei # ### @@ -51,8 +51,6 @@ use Apache::lonchart; use HTML::TokeParser; use GDBM_File; -my $r; -my %color; sub CheckFormElement { my ($cache, $ENVName, $cacheName, $default)=@_; @@ -303,8 +301,10 @@ sub PrepareData { return ('OK', $students); } + # Create progress sub Create_PrgWin { + my ($r)=@_; $r->print(< popwin=open('','popwin','width=400,height=100'); @@ -323,7 +323,7 @@ ENDPOP # update progress sub Update_PrgWin { - my ($totalStudents,$index,$name)=@_; + my ($totalStudents,$index,$name,$r)=@_; $r->print(''); @@ -332,6 +332,7 @@ sub Update_PrgWin { # close Progress Line sub Close_PrgWin { + my ($r)=@_; $r->print(''); $r->rflush(); } @@ -339,7 +340,7 @@ sub Close_PrgWin { # For loading the colored table for display or un-colored for print sub setbgcolor { my $PrintTable=shift; - undef %color; + my %color; if ($PrintTable){ $color{"gb"}="#FFFFFF"; $color{"red"}="#FFFFFF"; @@ -354,7 +355,7 @@ sub setbgcolor { $color{"purple"}="#FFDDFF"; } - return; + return \%color; } sub BuildClasslist { @@ -440,7 +441,7 @@ sub BuildStatistics { my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}". "_$ENV{'user.domain'}_$courseID\_statistics.db"; - &setbgcolor(0); + my %color=&setbgcolor(0); my ($returnValue, $students) = &PrepareData($c, $cacheDB); if($returnValue ne 'OK') { $r->print(''.$returnValue."\n".''); @@ -478,7 +479,8 @@ sub BuildStatistics { &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB, $students, $courseID, - $c,$r)); + $c,$r, + \%color)); } elsif($GoToPage eq 'Problem Analysis') { $r->print( &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB)); @@ -493,9 +495,9 @@ sub BuildStatistics { $students, $courseID)); } elsif($GoToPage eq 'DoDiffGraph') { - &Apache::lonproblemstatistics::BuildDiffGraph($courseID); + &Apache::lonproblemstatistics::BuildDiffGraph($r); } elsif($GoToPage eq 'PercentWrongGraph') { - &Apache::lonproblemstatistics::BuildWrongGraph($courseID); + &Apache::lonproblemstatistics::BuildWrongGraph($r); } elsif($GoToPage eq 'Class list') { $r->print(&BuildClasslist($cacheDB, $students, \@studentInformation, \@headings, $spacePadding)); @@ -511,7 +513,7 @@ sub BuildStatistics { # ================================================================ Main Handler sub handler { - $r=shift; + my $r=shift; unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) { $ENV{'user.error.msg'}= @@ -546,3 +548,4 @@ sub handler { } 1; __END__ +