version 1.36, 2001/01/20 22:57:05
|
version 1.37, 2001/01/22 18:22:51
|
Line 3
|
Line 3
|
# |
# |
# 11/11,11/15,11/27,12/04,12/05,12/06,12/07, |
# 11/11,11/15,11/27,12/04,12/05,12/06,12/07, |
# 12/08,12/09,12/11,12/12,12/15,12/16,12/18,12/19,12/30, |
# 12/08,12/09,12/11,12/12,12/15,12/16,12/18,12/19,12/30, |
# 01/01/01,02/01,03/01,19/01,20/01 Gerd Kortemeyer |
# 01/01/01,02/01,03/01,19/01,20/01,22/01 Gerd Kortemeyer |
|
|
package Apache::lonspreadsheet; |
package Apache::lonspreadsheet; |
|
|
Line 1217 sub loadstudent {
|
Line 1217 sub loadstudent {
|
# --------------------------------------------------- Load data for one student |
# --------------------------------------------------- Load data for one student |
|
|
sub loadcourse { |
sub loadcourse { |
my $safeeval=shift; |
my ($safeeval,$r)=@_; |
my %c=(); |
my %c=(); |
my %f=&getformulas($safeeval); |
my %f=&getformulas($safeeval); |
|
my $total=0; |
|
map { |
|
if ($_=~/^A(\d+)/) { |
|
unless ($f{$_}=~/^\!/) { $total++; } |
|
} |
|
} keys %f; |
|
my $now=0; |
|
my $since=time; |
|
$r->print('<br><input type=text size=35 name=remaining value=Starting>'); |
|
$r->rflush(); |
map { |
map { |
if ($_=~/^A(\d+)/) { |
if ($_=~/^A(\d+)/) { |
my $row=$1; |
my $row=$1; |
unless ($f{$_}=~/^\!/) { |
unless ($f{$_}=~/^\!/) { |
my @studentdata=&exportsheet(&getuname($safeeval), |
my @studentdata=&exportsheet(split(/\:/,$f{$_}), |
&getudom($safeeval), |
|
'studentcalc'); |
'studentcalc'); |
undef %userrdatas; |
undef %userrdatas; |
|
$now++; |
|
$r->print('<script>document.sheet.remaining.value="'. |
|
$now.'/'.$total.': '.int((time-$since)/$now*($total-$now)). |
|
' secs remaining";</script>'."\n"); |
|
$r->rflush(); |
|
|
my $index=0; |
my $index=0; |
map { |
map { |
if ($studentdata[$index]) { |
if ($studentdata[$index]) { |
Line 1244 sub loadcourse {
|
Line 1259 sub loadcourse {
|
} keys %f; |
} keys %f; |
&setformulas($safeeval,%f); |
&setformulas($safeeval,%f); |
&setconstants($safeeval,%c); |
&setconstants($safeeval,%c); |
|
$r->print('<script>document.sheet.remaining.value="Done";</script>'. |
|
"<br>\n"); |
|
$r->rflush(); |
} |
} |
|
|
# ------------------------------------------------ Load data for one assessment |
# ------------------------------------------------ Load data for one assessment |
Line 1392 sub updatesheet {
|
Line 1410 sub updatesheet {
|
# Import the data for rows |
# Import the data for rows |
# |
# |
|
|
sub loadrows() { |
sub loadrows { |
my $safeeval=shift; |
my ($safeeval,$r)=@_; |
my $stype=&gettype($safeeval); |
my $stype=&gettype($safeeval); |
if ($stype eq 'classcalc') { |
if ($stype eq 'classcalc') { |
&loadcourse($safeeval); |
&loadcourse($safeeval,$r); |
} elsif ($stype eq 'studentcalc') { |
} elsif ($stype eq 'studentcalc') { |
&loadstudent($safeeval); |
&loadstudent($safeeval); |
} else { |
} else { |
Line 1599 ENDSCRIPT
|
Line 1617 ENDSCRIPT
|
$r->print("Updated rows, loading row data ...<br>\n"); |
$r->print("Updated rows, loading row data ...<br>\n"); |
$r->rflush(); |
$r->rflush(); |
|
|
&loadrows($asheet); |
&loadrows($asheet,$r); |
|
|
$r->print("Loaded row data, calculating sheet ...<br>\n"); |
$r->print("Loaded row data, calculating sheet ...<br>\n"); |
$r->rflush(); |
$r->rflush(); |