version 1.3, 2002/08/01 20:49:06
|
version 1.4, 2002/08/05 20:53:38
|
Line 41 use strict;
|
Line 41 use strict;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use GDBM_File; |
use GDBM_File; |
|
|
my $jr; |
#my $jr; |
|
|
sub BuildProblemAnalysisPage { |
sub BuildProblemAnalysisPage { |
my ($cacheDB)=@_; |
my ($cacheDB, $r)=@_; |
|
|
my %cache; |
my %cache; |
my $Str = ''; |
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$Str .= '<html><body>Unable to tie database.</body></html>'; |
$r->print('<html><body>Unable to tie database.</body></html>'); |
return $Str; |
return; |
} |
} |
|
|
$Str .= &IntervalOptions($cache{'Interval'}); |
$r->print(&IntervalOptions($cache{'Interval'})); |
$Str .= &OptionResponseTable($cache{'OptionResponses'}, \%cache); |
$r->rflush(); |
|
$r->print(&OptionResponseTable($cache{'OptionResponses'}, \%cache)); |
|
|
untie(%cache); |
untie(%cache); |
|
|
return $Str; |
return; |
} |
} |
|
|
sub BuildAnalyzePage { |
sub BuildAnalyzePage { |
my ($cacheDB, $students, $courseID,$r)=@_; |
my ($cacheDB, $students, $courseID,$r)=@_; |
|
|
$jr = $r; |
# $jr = $r; |
my $c = $r->connection; |
my $c = $r->connection; |
|
|
my $Str = '</form>'; |
my $Str = '</form>'; |
my %cache; |
my %cache; |
|
&Create_PrgWin($r); |
|
my $count=0; |
foreach (@$students) { |
foreach (@$students) { |
|
&Update_PrgWin(scalar(@$students),$count,$_,$r); |
if($c->aborted) { |
if($c->aborted) { |
return $Str; |
return $Str; |
} |
} |
Line 90 sub BuildAnalyzePage {
|
Line 93 sub BuildAnalyzePage {
|
next; |
next; |
} |
} |
} |
} |
|
$count++; |
} |
} |
|
&Close_PrgWin($r); |
|
|
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
unless(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$Str .= '<html><body>Unable to tie database.</body></html>'; |
$Str .= '<html><body>Unable to tie database.</body></html>'; |
Line 225 sub OptionResponseTable {
|
Line 230 sub OptionResponseTable {
|
return $Str; |
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 ------------------------------------------ |
#---- END Problem Analysis Web Page ------------------------------------------ |
|
|
#---- Analyze Web Page ------------------------------------------------------- |
#---- Analyze Web Page ------------------------------------------------------- |