version 1.2, 2002/07/30 21:31:48
|
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)) { |
$r->print('<html><body>Unable to tie database.</body></html>'); |
$Str .= '<html><body>Unable to tie database.</body></html>'; |
return; |
return $Str; |
|
} |
} |
|
|
$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; |
} |
} |
my $courseData = |
my $downloadTime=''; |
&Apache::loncoursedata::DownloadCourseInformation($_, |
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) { |
$courseID); |
$downloadTime = $cache{$_.':lastDownloadTime'}; |
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT,0640)) { |
|
&Apache::loncoursedata::ProcessStudentData(\%cache, |
|
$courseData, $_); |
|
untie(%cache); |
untie(%cache); |
} else { |
|
last if($c->aborted()); |
|
next; |
|
} |
} |
|
if($downloadTime eq 'Not downloaded') { |
|
my $courseData = |
|
&Apache::loncoursedata::DownloadCourseInformation($_, |
|
$courseID); |
|
if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) { |
|
&Apache::loncoursedata::ProcessStudentData(\%cache, |
|
$courseData, $_); |
|
untie(%cache); |
|
} else { |
|
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>'; |
return $Str; |
return $Str; |
} |
} |
Line 108 sub BuildAnalyzePage {
|
Line 119 sub BuildAnalyzePage {
|
return $Str; |
return $Str; |
} |
} |
|
|
|
if($c->aborted()) { untie(%cache); return $Str; } |
|
|
#compute the intervals |
#compute the intervals |
&Interval($part, $problem, $interval, $analyzeData->{'concepts'}, |
&Interval($part, $problem, $interval, $analyzeData->{'concepts'}, |
\%ConceptData); |
\%ConceptData); |
|
|
$title =~ s/\ /"_"/eg; |
$title =~ s/\ /"_"/eg; |
$Str .= '<br><b>'.$uri.'</b>'; |
$Str .= '<br><b>'.$uri.'</b>'; |
|
|
|
if($c->aborted()) { untie(%cache); return $Str; } |
|
|
#Java script Progress window |
#Java script Progress window |
# &Create_PrgWin(); |
# &Create_PrgWin(); |
# &Update_PrgWin("Starting-to-analyze-problem"); |
# &Update_PrgWin("Starting-to-analyze-problem"); |
for(my $index=0; $index<(scalar @$students); $index++) { |
for(my $index=0; $index<(scalar @$students); $index++) { |
|
if($c->aborted()) { untie(%cache); return $Str; } |
# &Update_PrgWin($index); |
# &Update_PrgWin($index); |
# &OpStatus($problem, $students->[$index], $courseID, \%ConceptData, |
# &OpStatus($problem, $students->[$index], $courseID, \%ConceptData, |
# $analyzeData->{'foil_to_concept'}, $analyzeData, \%cache); |
# $analyzeData->{'foil_to_concept'}, $analyzeData, \%cache); |
Line 129 sub BuildAnalyzePage {
|
Line 145 sub BuildAnalyzePage {
|
|
|
$Str .= '<br>'; |
$Str .= '<br>'; |
for (my $k=0; $k<$interval; $k++ ) { |
for (my $k=0; $k<$interval; $k++ ) { |
|
if($c->aborted()) { untie(%cache); return $Str; } |
$Str .= &DrawGraph($k, $title, $analyzeData->{'concepts'}, |
$Str .= &DrawGraph($k, $title, $analyzeData->{'concepts'}, |
\%ConceptData); |
\%ConceptData); |
} |
} |
for (my $k=0; $k<$interval; $k++ ) { |
for (my $k=0; $k<$interval; $k++ ) { |
|
if($c->aborted()) { untie(%cache); return $Str; } |
$Str .= &DrawTable($k, $analyzeData->{'concepts'}, \%ConceptData); |
$Str .= &DrawTable($k, $analyzeData->{'concepts'}, \%ConceptData); |
} |
} |
my $Answ=&Apache::lonnet::ssi($uri); |
my $Answ=&Apache::lonnet::ssi($uri); |
Line 212 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 ------------------------------------------------------- |