--- loncom/interface/statistics/lonproblemanalysis.pm 2002/08/01 20:49:06 1.3 +++ loncom/interface/statistics/lonproblemanalysis.pm 2002/08/05 20:53:38 1.4 @@ -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 strict; 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 .= 'Unable to tie database.'; - return $Str; + $r->print('Unable to tie database.'); + 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 = ''; 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 @@ sub BuildAnalyzePage { next; } } + $count++; } + &Close_PrgWin($r); unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { $Str .= 'Unable to tie database.'; @@ -225,6 +230,41 @@ sub OptionResponseTable { return $Str; } +# Create progress +sub Create_PrgWin { + my ($r)=@_; + $r->print(< + popwin=open('','popwin','width=400,height=100'); + popwin.document.writeln(''+ + 'LON-CAPA Statistics'+ + '

Computation Progress

'+ + '
'+ + '
'+ + ''); + popwin.document.close(); + +ENDPOP + + $r->rflush(); +} + +# update progress +sub Update_PrgWin { + my ($totalStudents,$index,$name,$r)=@_; + $r->print(''); + $r->rflush(); +} + +# close Progress Line +sub Close_PrgWin { + my ($r)=@_; + $r->print(''); + $r->rflush(); +} + #---- END Problem Analysis Web Page ------------------------------------------ #---- Analyze Web Page -------------------------------------------------------