[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm
minaeibi
lon-capa-cvs@mail.lon-capa.org
Thu, 25 Jul 2002 19:30:24 -0000
minaeibi Thu Jul 25 15:30:24 2002 EDT
Modified files:
/loncom/interface lonstatistics.pm
Log:
removing global variables
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.30 loncom/interface/lonstatistics.pm:1.31
--- loncom/interface/lonstatistics.pm:1.30 Wed Jul 24 10:52:32 2002
+++ loncom/interface/lonstatistics.pm Thu Jul 25 15:30:24 2002
@@ -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 HTML::TokeParser;
use GDBM_File;
-my $r;
-my %color;
sub CheckFormElement {
my ($cache, $ENVName, $cacheName, $default)=@_;
@@ -303,8 +301,10 @@
return ('OK', $students);
}
+
# Create progress
sub Create_PrgWin {
+ my ($r)=@_;
$r->print(<<ENDPOP);
<script>
popwin=open('','popwin','width=400,height=100');
@@ -323,7 +323,7 @@
# update progress
sub Update_PrgWin {
- my ($totalStudents,$index,$name)=@_;
+ my ($totalStudents,$index,$name,$r)=@_;
$r->print('<script>popwin.document.popremain.remaining.value="'.
'Computing '.$index.'/'.$totalStudents.': '.
$name.'";</script>');
@@ -332,6 +332,7 @@
# close Progress Line
sub Close_PrgWin {
+ my ($r)=@_;
$r->print('<script>popwin.close()</script>');
$r->rflush();
}
@@ -339,7 +340,7 @@
# 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 @@
$color{"purple"}="#FFDDFF";
}
- return;
+ return \%color;
}
sub BuildClasslist {
@@ -440,7 +441,7 @@
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('<html><body>'.$returnValue."\n".'</body></html>');
@@ -478,7 +479,8 @@
&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 @@
$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 @@
# ================================================================ 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 @@
}
1;
__END__
+