[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm lonhtmlcommon.pm /interface/statistics lonproblemanalysis.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 03 Mar 2003 21:52:24 -0000
This is a MIME encoded message
--albertel1046728344
Content-Type: text/plain
albertel Mon Mar 3 16:52:24 2003 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm loncoursedata.pm
/loncom/interface/statistics lonproblemanalysis.pm
Log:
- adding timing info to the popwin, and adding new functionality,
- converted stats to use new interface
--albertel1046728344
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20030303165224.txt"
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.13 loncom/interface/lonhtmlcommon.pm:1.14
--- loncom/interface/lonhtmlcommon.pm:1.13 Thu Feb 20 09:34:59 2003
+++ loncom/interface/lonhtmlcommon.pm Mon Mar 3 16:52:24 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.13 2003/02/20 14:34:59 matthew Exp $
+# $Id: lonhtmlcommon.pm,v 1.14 2003/03/03 21:52:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -640,33 +640,57 @@
# Create progress
sub Create_PrgWin {
- my ($r, $title, $heading)=@_;
+ my ($r, $title, $heading, $number_to_do)=@_;
$r->print('<script>'.
"popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
- "popwin.document.writeln(\'<html><body bgcolor=\"#88DDFF\">".
- "<title>$title</title>".
+ "popwin.document.writeln(\'<html><head><title>$title</title></head>".
+ "<body bgcolor=\"#88DDFF\">".
"<h4>$heading</h4>".
"<form name=popremain>".
- "<input type=text size=35 name=remaining value=Starting></form>".
+ "<input type=text size=55 name=remaining value=Starting></form>".
"</body></html>\');".
"popwin.document.close();".
"</script>");
+ my %prog_state;
+ $prog_state{'now'}=0;
+ $prog_state{'since'}=time;
+ $prog_state{'started'}=time;
+ $prog_state{'total'}=$number_to_do;
+
$r->rflush();
+ return %prog_state;
}
# update progress
sub Update_PrgWin {
- my ($displayString,$r)=@_;
+ my ($r,$prog_state,$displayString)=@_;
$r->print('<script>popwin.document.popremain.remaining.value="'.
$displayString.'";</script>');
+ $$prog_state{'started'}=time;
+ $r->rflush();
+}
+
+# increment progress state
+sub Increment_PrgWin {
+ my ($r,$prog_state,$extraInfo)=@_;
+ $$prog_state{'now'}++;
+ $r->print('<script>popwin.document.popremain.remaining.value="'.
+ $$prog_state{'now'}.'/'.$$prog_state{'total'}.
+ ': '.int((time-$$prog_state{'since'})/
+ $$prog_state{'now'}*($$prog_state{'total'}-$$prog_state{'now'})).
+ ' secs remaining ('.(time-$$prog_state{'started'}).
+ ' seconds for '.$extraInfo.')";'.'</script>');
+ $$prog_state{'started'}=time;
+ sleep 1;
$r->rflush();
}
# close Progress Line
sub Close_PrgWin {
- my ($r)=@_;
+ my ($r,$prog_state)=@_;
$r->print('<script>popwin.close()</script>'."\n");
+ undef(%$prog_state);
$r->rflush();
}
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.54 loncom/interface/loncoursedata.pm:1.55
--- loncom/interface/loncoursedata.pm:1.54 Fri Feb 28 18:19:01 2003
+++ loncom/interface/loncoursedata.pm Mon Mar 3 16:52:24 2003
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.54 2003/02/28 23:19:01 bowersj2 Exp $
+# $Id: loncoursedata.pm,v 1.55 2003/03/03 21:52:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1308,21 +1308,20 @@
$WhatIWant .= ')';
# $WhatIWant = '.';
+ my %prog_state;
if($status eq 'true') {
- &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, $title,
+ $heading,($#$students)+1);
}
- my $displayString;
- my $count=0;
foreach (@$students) {
my %cache;
if($c->aborted()) { return 'Aborted'; }
if($status eq 'true') {
- $count++;
- my $displayString = $count.'/'.$studentCount.': '.$_;
- &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student '.$_);
}
my $downloadTime='Not downloaded';
@@ -1359,7 +1358,7 @@
next;
}
}
- if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }
+ if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); }
return 'OK';
}
@@ -1380,10 +1379,11 @@
&CheckForResidualDownload($cacheDB, 'true', 'true', $courseID, $r, $c);
my $studentCount = scalar(@$students);
+ my %prog_state;
if($status eq 'true') {
- &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, $title,
+ $heading,($#$students)+1);
}
- my $count=0;
my $displayString='';
foreach (@$students) {
if($c->aborted()) {
@@ -1391,9 +1391,8 @@
}
if($status eq 'true') {
- $count++;
- $displayString = $count.'/'.$studentCount.': '.$_;
- &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student '.$_);
}
my %cache;
@@ -1438,7 +1437,8 @@
}
untie(%downloadData);
}
- if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }
+ if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r,
+ \%prog_state); }
return &CheckForResidualDownload($cacheDB, 'true', 'true',
$courseID, $r, $c);
@@ -1477,8 +1477,10 @@
my $heading = 'Process Course Data';
my $title = 'LON-CAPA Statistics';
my $studentCount = scalar(@students);
+ my %prog_state;
if($status eq 'true') {
- &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
+ %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, $title,
+ $heading,$#students+1);
}
my $count=1;
@@ -1486,8 +1488,8 @@
last if($c->aborted());
if($status eq 'true') {
- my $displayString = $count.'/'.$studentCount.': '.$name;
- &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student '.$name);
}
if($extract eq 'true') {
@@ -1498,7 +1500,8 @@
$count++;
}
- if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }
+ if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r,
+ \%prog_state); }
untie(%cache);
untie(%downloadData);
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.19 loncom/interface/statistics/lonproblemanalysis.pm:1.20
--- loncom/interface/statistics/lonproblemanalysis.pm:1.19 Tue Feb 25 15:47:47 2003
+++ loncom/interface/statistics/lonproblemanalysis.pm Mon Mar 3 16:52:24 2003
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemanalysis.pm,v 1.19 2003/02/25 20:47:47 matthew Exp $
+# $Id: lonproblemanalysis.pm,v 1.20 2003/03/03 21:52:24 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -173,20 +173,20 @@
$Str = '';
if($c->aborted()) { untie(%cache); return; }
- &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
- my $count=0;
+ my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, $title,
+ $heading,$#students+1);
+
#Java script Progress window
for(my $index=0; $index<(scalar @$students); $index++) {
if($c->aborted()) { untie(%cache); return; }
- $count++;
- my $displayString = $count.'/'.$studentCount.': '.$_;
- &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);
+ &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
+ 'last student '.$students->[$index]);
&OpStatus($problemId, $students->[$index], \%ConceptData,
$analyzeData->{'foil_to_concept'}, $analyzeData,
\%cache, $courseID);
}
- &Apache::lonhtmlcommon::Close_PrgWin($r);
+ &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
$Str .= '<br>';
for (my $k=0; $k<$interval; $k++ ) {
--albertel1046728344--