Diff for /loncom/interface/lonstatistics.pm between versions 1.40 and 1.41

version 1.40, 2002/08/06 17:39:15 version 1.41, 2002/08/13 00:37:18
Line 47  use Apache::lonhtmlcommon; Line 47  use Apache::lonhtmlcommon;
 use Apache::lonproblemanalysis;  use Apache::lonproblemanalysis;
 use Apache::lonproblemstatistics;  use Apache::lonproblemstatistics;
 use Apache::lonstudentassessment;  use Apache::lonstudentassessment;
 use Apache::lonchart;  
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
   
Line 72  sub ProcessFormData{ Line 71  sub ProcessFormData{
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['sort','download',                                              ['sort','download',
                                              'reportSelected',                                               'reportSelected',
                                              'StudentAssessmentStudent']);                                               'StudentAssessmentStudent',
                                                'ProblemStatisticsSort']);
     &CheckFormElement($cache, 'Status', 'Status', 'Active');      &CheckFormElement($cache, 'Status', 'Status', 'Active');
     &CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list');      &CheckFormElement($cache, 'postdata', 'reportSelected', 'Class list');
     &CheckFormElement($cache, 'reportSelected', 'reportSelected',       &CheckFormElement($cache, 'reportSelected', 'reportSelected', 
Line 121  sub ProcessFormData{ Line 121  sub ProcessFormData{
                       'ProblemStatisticsAscend', 'Ascending');                        'ProblemStatisticsAscend', 'Ascending');
     &CheckFormElement($cache, 'ProblemStatisticsMaps',       &CheckFormElement($cache, 'ProblemStatisticsMaps', 
                       'ProblemStatisticsMaps', 'All Maps');                        'ProblemStatisticsMaps', 'All Maps');
       &CheckFormElement($cache, 'ProblemStatisticsSort',
                         'ProblemStatisticsSort', 'Homework Sets Order');
   
     # Search only form elements      # Search only form elements
     my @headingColumns=();      my @headingColumns=();
Line 356  sub PrepareData { Line 358  sub PrepareData {
     $cache{'updateTime:columnWidth'}=24;      $cache{'updateTime:columnWidth'}=24;
   
     if($cache{'download'} ne 'false') {      if($cache{'download'} ne 'false') {
         my $who = $cache{'download'};          my @who = ($cache{'download'});
         my $courseData =   
             &Apache::loncoursedata::DownloadCourseInformation(  
                                              $who, $courseID,   
                                              $cache{$who.':lastDownloadTime'});  
         &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who);  
         $cache{'download'} = 'false';          $cache{'download'} = 'false';
           if(&Apache::loncoursedata::DownloadStudentCourseData(\@who, 'false', 
                                                                $cacheDB, 'true', 
                                                                'false', $courseID,
                                                                $r, $c) ne 'OK') {
               untie(%cache);
               return 'Stop at download individual';
           }
     } elsif($cache{'DownloadAll'} ne 'false') {      } elsif($cache{'DownloadAll'} ne 'false') {
         $cache{'DownloadAll'} = 'false';          $cache{'DownloadAll'} = 'false';
         my @allStudents;          my @allStudents;
Line 371  sub PrepareData { Line 375  sub PrepareData {
         } else {          } else {
             @allStudents = split(':::', $cache{'NamesOfStudents'});              @allStudents = split(':::', $cache{'NamesOfStudents'});
         }          }
         &Create_PrgWin($r);          if(&Apache::loncoursedata::DownloadStudentCourseData(\@allStudents, 
         my $count=1;                                                               'false', 
         foreach (@allStudents) {                                                               $cacheDB, 'true', 
             &Update_PrgWin(scalar(@allStudents),$count,$_,$r);                                                               'true', $courseID,
             my $courseData =                                                                $r, $c) ne 'OK') {
                 &Apache::loncoursedata::DownloadCourseInformation(              untie(%cache);
                                              $_, $courseID,               return 'Stop at download all';
                                              $cache{$_.':lastDownloadTime'});  
             &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData,   
                                                        $_);  
             if($c->aborted()) {  
                 untie(%cache);  
                 return 'aborted';   
             }  
             $count++;  
         }          }
         &Close_PrgWin($r);  
     }      }
   
     if($c->aborted()) {      if($c->aborted()) {
Line 400  sub PrepareData { Line 395  sub PrepareData {
     return ('OK', $students);      return ('OK', $students);
 }  }
   
   
 # Create progress  
 sub Create_PrgWin {  
     my ($r)=@_;  
     $r->print(<<ENDPOP);  
     <script>  
     popwin=open('','popwin','width=400,height=100');  
     popwin.document.writeln('<html><body bgcolor="#88DDFF">'+  
       '<title>LON-CAPA Statistics</title>'+  
       '<h4>Computation Progress</h4>'+  
       '<form name=popremain>'+  
       '<input type=text size=35 name=remaining value=Starting></form>'+  
       '</body></html>');  
     popwin.document.close();  
     </script>  
 ENDPOP  
   
     $r->rflush();  
 }  
   
 # update progress  
 sub Update_PrgWin {  
     my ($totalStudents,$index,$name,$r)=@_;  
     $r->print('<script>popwin.document.popremain.remaining.value="'.  
               'Computing '.$index.'/'.$totalStudents.': '.  
               $name.'";</script>');  
     $r->rflush();  
 }  
   
 # close Progress Line  
 sub Close_PrgWin {  
     my ($r)=@_;  
     $r->print('<script>popwin.close()</script>');  
     $r->rflush();   
 }  
   
   
 sub BuildClasslist {  sub BuildClasslist {
     my ($cacheDB,$students,$studentInformation,$headings,$r)=@_;      my ($cacheDB,$students,$studentInformation,$headings,$r)=@_;
   
Line 556  sub BuildStatistics { Line 514  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";
   
       $r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));
   
     my ($returnValue, $students) = &PrepareData($c, $cacheDB,       my ($returnValue, $students) = &PrepareData($c, $cacheDB, 
                                                 \@studentInformation,                                                   \@studentInformation, 
                                                 \@headings,$r);                                                  \@headings,$r);
     if($returnValue ne 'OK') {      if($returnValue ne 'OK') {
         $r->print('<html><body>'.$returnValue."\n".'</body></html>');          $r->print($returnValue."\n".'</body></html>');
         return OK;          return OK;
     }      }
       if(!$c->aborted()) {
           &Apache::loncoursedata::CheckForResidualDownload($cacheDB, 
                                                            'true', 'true',
                                                            $courseID,
                                                            $r, $c);
       }
   
     my $GoToPage;      my $GoToPage;
     if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {      if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
Line 578  sub BuildStatistics { Line 544  sub BuildStatistics {
             $reports{'problem_analysis'} = 'Problem Analysis';              $reports{'problem_analysis'} = 'Problem Analysis';
         }          }
   
         $r->print(&Apache::lonhtmlcommon::Title('LON-CAPA Statistics'));  
         $r->print('<form name="Statistics" ');          $r->print('<form name="Statistics" ');
         $r->print('method="post" action="/adm/statistics">');          $r->print('method="post" action="/adm/statistics">');
         $r->print(&CreateMainMenu($cache{'Status'}, \%reports));          $r->print(&CreateMainMenu($cache{'Status'}, \%reports));

Removed from v.1.40  
changed lines
  Added in v.1.41


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