[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm /interface/statistics lonproblemanalysis.pm lonproblemstatistics.pm lonstudentassessment.pm

stredwic lon-capa-cvs@mail.lon-capa.org
Mon, 05 Aug 2002 20:53:38 -0000


This is a MIME encoded message

--stredwic1028580818
Content-Type: text/plain

stredwic		Mon Aug  5 16:53:38 2002 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
    /loncom/interface/statistics	lonproblemanalysis.pm 
                                	lonproblemstatistics.pm 
                                	lonstudentassessment.pm 
  Log:
  Added in some flushes and changed where some of the modules print.  Also,
  fixed download all so that if you stop it, and then select something
  else it won't continue to download.
  
  
--stredwic1028580818
Content-Type: text/plain
Content-Disposition: attachment; filename="stredwic-20020805165338.txt"

Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.38 loncom/interface/lonstatistics.pm:1.39
--- loncom/interface/lonstatistics.pm:1.38	Thu Aug  1 16:49:06 2002
+++ loncom/interface/lonstatistics.pm	Mon Aug  5 16:53:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.38 2002/08/01 20:49:06 stredwic Exp $
+# $Id: lonstatistics.pm,v 1.39 2002/08/05 20:53:38 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -364,13 +364,17 @@
         &Apache::loncoursedata::ProcessStudentData(\%cache, $courseData, $who);
         $cache{'download'} = 'false';
     } elsif($cache{'DownloadAll'} ne 'false') {
+        $cache{'DownloadAll'} = 'false';
         my @allStudents;
         if($cache{'DownloadAll'} eq 'sorted') {
             @allStudents = @$students;
         } else {
             @allStudents = split(':::', $cache{'NamesOfStudents'});
         }
+        &Create_PrgWin($r);
+        my $count=1;
         foreach (@allStudents) {
+            &Update_PrgWin(scalar(@allStudents),$count,$_,$r);
             my $courseData = 
                 &Apache::loncoursedata::DownloadCourseInformation(
                                              $_, $courseID, 
@@ -381,8 +385,9 @@
                 untie(%cache);
                 return 'aborted'; 
             }
+            $count++;
         }
-        $cache{'DownloadAll'} = 'false';
+        &Close_PrgWin($r);
     }
 
     if($c->aborted()) {
@@ -433,7 +438,7 @@
 
 
 sub BuildClasslist {
-    my ($cacheDB,$students,$studentInformation,$headings)=@_;
+    my ($cacheDB,$students,$studentInformation,$headings,$r)=@_;
 
     my %cache;
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
@@ -446,9 +451,11 @@
 
     my $displayString = '<td align="left"><a href="/adm/statistics?';
     $displayString .= 'sort=LINKDATA">DISPLAYDATA&nbsp</a></td>'."\n";
-    $Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache, $studentInformation,
+    $Str .= &Apache::lonhtmlcommon::CreateHeadings(\%cache, 
+                                                   $studentInformation,
                                                    $headings, $displayString);
     $Str .= '</tr>'."\n";
+
     my $alternate=0;
     foreach (@$students) {
         my ($username, $domain) = split(':', $_);
@@ -483,10 +490,12 @@
 
     $Str .= '</tr>'."\n";
     $Str .= '</table></td></tr></table>'."\n";
+    $r->print($Str);
+    $r->rflush();
 
     untie(%cache);
 
-    return $Str;
+    return;
 }
 
 sub CreateMainMenu {
@@ -573,6 +582,7 @@
         $r->print('<form name="Statistics" ');
         $r->print('method="post" action="/adm/statistics">');
         $r->print(&CreateMainMenu($cache{'Status'}, \%reports));
+        $r->rflush();
         untie(%cache);
     } else {
         $r->print('<html><body>Unable to tie database.</body></html>');
@@ -587,29 +597,26 @@
                                                                   $courseID, 
                                                                   $c,$r);
     } elsif($GoToPage eq 'Problem Analysis') {
-        $r->print(
-              &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB));
+        &Apache::lonproblemanalysis::BuildProblemAnalysisPage($cacheDB, $r);
     } elsif($GoToPage eq 'Student Assessment') {
-        $r->print(
-            &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
+        &Apache::lonstudentassessment::BuildStudentAssessmentPage($cacheDB,
                                                           $students,
                                                           $courseID,
                                                           'Statistics',
                                                           \@headings,
                                                           $spacing,
                                                           \@studentInformation,
-                                                          $r, $c));
+                                                          $r, $c);
     } elsif($GoToPage eq 'Analyze') {
-        $r->print(&Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, 
-                                                                $students, 
-                                                                $courseID,$r));
+        &Apache::lonproblemanalysis::BuildAnalyzePage($cacheDB, $students, 
+                                                      $courseID, $r);
     } elsif($GoToPage eq 'DoDiffGraph') {
         &Apache::lonproblemstatistics::BuildDiffGraph($r);
     } elsif($GoToPage eq 'PercentWrongGraph') {
         &Apache::lonproblemstatistics::BuildWrongGraph($r);
     } elsif($GoToPage eq 'Class list') {
-        $r->print(&BuildClasslist($cacheDB, $students, \@studentInformation,
-                                  \@headings));
+        &BuildClasslist($cacheDB, $students, \@studentInformation,
+                        \@headings, $r);
     }
 
     $r->print('</form>'."\n");
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.3 loncom/interface/statistics/lonproblemanalysis.pm:1.4
--- loncom/interface/statistics/lonproblemanalysis.pm:1.3	Thu Aug  1 16:49:06 2002
+++ loncom/interface/statistics/lonproblemanalysis.pm	Mon Aug  5 16:53:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonproblemanalysis.pm,v 1.3 2002/08/01 20:49:06 stredwic Exp $
+# $Id: lonproblemanalysis.pm,v 1.4 2002/08/05 20:53:38 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -41,35 +41,38 @@
 use Apache::lonnet();
 use GDBM_File;
 
-my $jr;
+#my $jr;
 
 sub BuildProblemAnalysisPage {
-    my ($cacheDB)=@_;
+    my ($cacheDB, $r)=@_;
 
     my %cache;
-    my $Str = '';
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
-        $Str .= '<html><body>Unable to tie database.</body></html>';
-        return $Str;
+        $r->print('<html><body>Unable to tie database.</body></html>');
+        return;
     }
 
-    $Str .= &IntervalOptions($cache{'Interval'});
-    $Str .= &OptionResponseTable($cache{'OptionResponses'}, \%cache);
+    $r->print(&IntervalOptions($cache{'Interval'}));
+    $r->rflush();
+    $r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache));
 
     untie(%cache);
 
-    return $Str;
+    return;
 }
 
 sub BuildAnalyzePage {
     my ($cacheDB, $students, $courseID,$r)=@_;
 
-    $jr = $r;
+#    $jr = $r;
     my $c = $r->connection;
 
     my $Str = '</form>';
     my %cache;
+    &Create_PrgWin($r);
+    my $count=0;
     foreach (@$students) {
+        &Update_PrgWin(scalar(@$students),$count,$_,$r);
         if($c->aborted) {
             return $Str;
         }
@@ -90,7 +93,9 @@
                 next;
             }
         }
+        $count++;
     }
+    &Close_PrgWin($r);
 
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
         $Str .= '<html><body>Unable to tie database.</body></html>';
@@ -225,6 +230,41 @@
     return $Str;
 }
 
+# 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(); 
+}
+ 
 #---- END Problem Analysis Web Page ------------------------------------------
 
 #---- Analyze Web Page -------------------------------------------------------
Index: loncom/interface/statistics/lonproblemstatistics.pm
diff -u loncom/interface/statistics/lonproblemstatistics.pm:1.12 loncom/interface/statistics/lonproblemstatistics.pm:1.13
--- loncom/interface/statistics/lonproblemstatistics.pm:1.12	Mon Aug  5 14:10:08 2002
+++ loncom/interface/statistics/lonproblemstatistics.pm	Mon Aug  5 16:53:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonproblemstatistics.pm,v 1.12 2002/08/05 18:10:08 minaeibi Exp $
+# $Id: lonproblemstatistics.pm,v 1.13 2002/08/05 20:53:38 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -70,9 +70,13 @@
     $Ptr .= '</table>';
     $Ptr .= &ProblemStatisticsLegend();
     $r->print($Ptr);
+    $r->rflush();
 
     untie(%cache);
+    &Create_PrgWin($r);
+    my $count=0;
     foreach (@$students) {
+        &Update_PrgWin(scalar(@$students),$count,$_,$r);
         my $courseData = 
             &Apache::loncoursedata::DownloadCourseInformation($_, $courseID);
         last if ($c->aborted());
@@ -81,7 +85,9 @@
                                                        $courseData, $_);
             untie(%cache);
         }
+        $count++;
     }
+    &Close_PrgWin($r);
     if($c->aborted()) { return; }
 
     unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER,0640)) {
@@ -178,6 +184,40 @@
 }
 
 
+# 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(); 
+}
  
 # ------ Dump the Student's DB file and handling the data for statistics table 
 sub ExtractStudentData {
Index: loncom/interface/statistics/lonstudentassessment.pm
diff -u loncom/interface/statistics/lonstudentassessment.pm:1.6 loncom/interface/statistics/lonstudentassessment.pm:1.7
--- loncom/interface/statistics/lonstudentassessment.pm:1.6	Thu Aug  1 16:49:06 2002
+++ loncom/interface/statistics/lonstudentassessment.pm	Mon Aug  5 16:53:38 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstudentassessment.pm,v 1.6 2002/08/01 20:49:06 stredwic Exp $
+# $Id: lonstudentassessment.pm,v 1.7 2002/08/05 20:53:38 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -86,6 +86,7 @@
                                             $students);
     $r->print(&CreateInterface(\%cache, $selectedName, $students, $formName,
                                $doNotShow));
+    $r->rflush();
 
     my $Str = '';
     if($selectedName eq 'No Student Selected') {
@@ -136,6 +137,7 @@
                                                          'preformatted'));
             $r->print(&StudentReport(\%cache, $_, $spacing, $sequenceKeys));
             $r->print("\n");
+            $r->rflush();
             untie(%cache);
         }
     }

--stredwic1028580818--