Diff for /loncom/interface/lonstatistics.pm between versions 1.30 and 1.31

version 1.30, 2002/07/24 14:52:32 version 1.31, 2002/07/25 19:30:24
Line 31 Line 31
 # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei  # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002  # 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  # 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
 #  #
 ###  ###
   
Line 51  use Apache::lonchart; Line 51  use Apache::lonchart;
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
   
 my $r;  
 my %color;  
   
 sub CheckFormElement {  sub CheckFormElement {
     my ($cache, $ENVName, $cacheName, $default)=@_;      my ($cache, $ENVName, $cacheName, $default)=@_;
Line 303  sub PrepareData { Line 301  sub PrepareData {
     return ('OK', $students);      return ('OK', $students);
 }  }
   
   
 # Create progress  # Create progress
 sub Create_PrgWin {  sub Create_PrgWin {
       my ($r)=@_;
     $r->print(<<ENDPOP);      $r->print(<<ENDPOP);
     <script>      <script>
     popwin=open('','popwin','width=400,height=100');      popwin=open('','popwin','width=400,height=100');
Line 323  ENDPOP Line 323  ENDPOP
   
 # update progress  # update progress
 sub Update_PrgWin {  sub Update_PrgWin {
     my ($totalStudents,$index,$name)=@_;      my ($totalStudents,$index,$name,$r)=@_;
     $r->print('<script>popwin.document.popremain.remaining.value="'.      $r->print('<script>popwin.document.popremain.remaining.value="'.
               'Computing '.$index.'/'.$totalStudents.': '.                'Computing '.$index.'/'.$totalStudents.': '.
               $name.'";</script>');                $name.'";</script>');
Line 332  sub Update_PrgWin { Line 332  sub Update_PrgWin {
   
 # close Progress Line  # close Progress Line
 sub Close_PrgWin {  sub Close_PrgWin {
       my ($r)=@_;
     $r->print('<script>popwin.close()</script>');      $r->print('<script>popwin.close()</script>');
     $r->rflush();       $r->rflush(); 
 }  }
Line 339  sub Close_PrgWin { Line 340  sub Close_PrgWin {
 # For loading the colored table for display or un-colored for print  # For loading the colored table for display or un-colored for print
 sub setbgcolor {  sub setbgcolor {
     my $PrintTable=shift;      my $PrintTable=shift;
     undef %color;      my %color;
     if ($PrintTable){      if ($PrintTable){
  $color{"gb"}="#FFFFFF";   $color{"gb"}="#FFFFFF";
  $color{"red"}="#FFFFFF";   $color{"red"}="#FFFFFF";
Line 354  sub setbgcolor { Line 355  sub setbgcolor {
  $color{"purple"}="#FFDDFF";   $color{"purple"}="#FFDDFF";
     }      }
   
     return;      return \%color;
 }  }
   
 sub BuildClasslist {  sub BuildClasslist {
Line 440  sub BuildStatistics { Line 441  sub BuildStatistics {
     my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".      my $cacheDB = "/home/httpd/perl/tmp/$ENV{'user.name'}".
                   "_$ENV{'user.domain'}_$courseID\_statistics.db";                    "_$ENV{'user.domain'}_$courseID\_statistics.db";
   
     &setbgcolor(0);      my %color=&setbgcolor(0);
     my ($returnValue, $students) = &PrepareData($c, $cacheDB);      my ($returnValue, $students) = &PrepareData($c, $cacheDB);
     if($returnValue ne 'OK') {      if($returnValue ne 'OK') {
         $r->print('<html><body>'.$returnValue."\n".'</body></html>');          $r->print('<html><body>'.$returnValue."\n".'</body></html>');
Line 478  sub BuildStatistics { Line 479  sub BuildStatistics {
         &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB,           &Apache::lonproblemstatistics::BuildProblemStatisticsPage($cacheDB, 
                                                                   $students,                                                                     $students, 
                                                                   $courseID,                                                                     $courseID, 
                                                                   $c,$r));                                                                    $c,$r,
     \%color));
     } elsif($GoToPage eq 'Problem Analysis') {      } elsif($GoToPage eq 'Problem Analysis') {
         $r->print(          $r->print(
               &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB));                &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB));
Line 493  sub BuildStatistics { Line 495  sub BuildStatistics {
                                                                 $students,                                                                   $students, 
                                                                 $courseID));                                                                  $courseID));
     } elsif($GoToPage eq 'DoDiffGraph') {      } elsif($GoToPage eq 'DoDiffGraph') {
         &Apache::lonproblemstatistics::BuildDiffGraph($courseID);          &Apache::lonproblemstatistics::BuildDiffGraph($r);
     } elsif($GoToPage eq 'PercentWrongGraph') {      } elsif($GoToPage eq 'PercentWrongGraph') {
         &Apache::lonproblemstatistics::BuildWrongGraph($courseID);          &Apache::lonproblemstatistics::BuildWrongGraph($r);
     } elsif($GoToPage eq 'Class list') {      } elsif($GoToPage eq 'Class list') {
         $r->print(&BuildClasslist($cacheDB, $students, \@studentInformation,          $r->print(&BuildClasslist($cacheDB, $students, \@studentInformation,
                                   \@headings, $spacePadding));                                    \@headings, $spacePadding));
Line 511  sub BuildStatistics { Line 513  sub BuildStatistics {
 # ================================================================ Main Handler  # ================================================================ Main Handler
   
 sub handler {  sub handler {
     $r=shift;      my $r=shift;
   
     unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {      unless(&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) {
         $ENV{'user.error.msg'}=          $ENV{'user.error.msg'}=
Line 546  sub handler { Line 548  sub handler {
 }  }
 1;  1;
 __END__  __END__
   

Removed from v.1.30  
changed lines
  Added in v.1.31


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>