version 1.167, 2003/01/30 21:35:13
|
version 1.173, 2003/03/03 22:00:03
|
Line 262 ENDSCRIPT
|
Line 262 ENDSCRIPT
|
# Global directory configs |
# Global directory configs |
# |
# |
$sheet->includedir($r->dir_config('lonIncludes')); |
$sheet->includedir($r->dir_config('lonIncludes')); |
$sheet->tmpdir($r->dir_config('lonDaemons').'/tmp/'); |
|
# |
# |
# Check user permissions |
# Check user permissions |
if (($sheet->{'type'} eq 'classcalc' ) || |
if (($sheet->{'type'} eq 'classcalc' ) || |
Line 524 my %numbertimes;
|
Line 523 my %numbertimes;
|
# Directories |
# Directories |
# |
# |
my $includedir; |
my $includedir; |
my $tmpdir; |
|
|
|
sub includedir { |
sub includedir { |
my $self = shift; |
my $self = shift; |
$includedir = shift; |
$includedir = shift; |
} |
} |
|
|
sub tmpdir { |
|
my $self = shift; |
|
$tmpdir = shift; |
|
} |
|
|
|
my %spreadsheets; |
my %spreadsheets; |
#my %loadedcaches; |
#my %loadedcaches; |
my %courserdatas; |
my %courserdatas; |
Line 1744 sub calcsheet {
|
Line 1737 sub calcsheet {
|
$self->sett(); |
$self->sett(); |
my $result = $self->{'safe'}->reval('&calc();'); |
my $result = $self->{'safe'}->reval('&calc();'); |
%{$self->{'values'}} = %{$self->{'safe'}->varglob('sheet_values')}; |
%{$self->{'values'}} = %{$self->{'safe'}->varglob('sheet_values')}; |
|
# $self->logthis($self->get_errorlog()); |
return $result; |
return $result; |
} |
} |
|
|
Line 1892 sub dump_values_to_log {
|
Line 1886 sub dump_values_to_log {
|
} |
} |
$self->logthis("--------------------------------------------------------");} |
$self->logthis("--------------------------------------------------------");} |
|
|
|
## |
|
## Yet another debugging function |
|
## |
|
sub dump_hash_to_log { |
|
my $self= shift(); |
|
my %tmp = @_; |
|
if (@_<2) { |
|
%tmp = %{$_[0]}; |
|
} |
|
$self->logthis('---------------------------- (entries end with ":"'); |
|
while (my ($key,$val) = each (%tmp)) { |
|
$self->logthis($key.' = '.$val.':'); |
|
} |
|
$self->logthis('---------------------------- (entries end with ":"'); |
|
} |
|
|
################################ |
################################ |
## Helper functions ## |
## Helper functions ## |
################################ |
################################ |
Line 2540 sub export_sheet_as_excel {
|
Line 2550 sub export_sheet_as_excel {
|
} |
} |
next if ($row_is_empty); |
next if ($row_is_empty); |
} |
} |
|
$worksheet->write($rows_output,$cols_output++,$rownum); |
$worksheet->write($rows_output,$cols_output++,$label); |
$worksheet->write($rows_output,$cols_output++,$label); |
if (ref($label)) { |
if (ref($label)) { |
$cols_output = (scalar(@$label)); |
$cols_output = (scalar(@$label)); |
Line 2776 sub tmpwrite {
|
Line 2787 sub tmpwrite {
|
$ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'. |
$ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'. |
$self->{'filename'}; |
$self->{'filename'}; |
$fn=~s/\W/\_/g; |
$fn=~s/\W/\_/g; |
$fn=$tmpdir.$fn.'.tmp'; |
$fn=$Apache::lonnet::tmpdir.$fn.'.tmp'; |
my $fh; |
my $fh; |
if ($fh=Apache::File->new('>'.$fn)) { |
if ($fh=Apache::File->new('>'.$fn)) { |
my %f = $self->formulas(); |
my %f = $self->formulas(); |
Line 2795 sub tmpread {
|
Line 2806 sub tmpread {
|
$ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'. |
$ENV{'user.domain'}.'_spreadsheet_'.$self->{'usymb'}.'_'. |
$self->{'filename'}; |
$self->{'filename'}; |
$fn=~s/\W/\_/g; |
$fn=~s/\W/\_/g; |
$fn=$tmpdir.$fn.'.tmp'; |
$fn=$Apache::lonnet::tmpdir.$fn.'.tmp'; |
my $fh; |
my $fh; |
my %fo=(); |
my %fo=(); |
my $countrows=0; |
my $countrows=0; |
Line 3131 sub loadstudent{
|
Line 3142 sub loadstudent{
|
my %formulas = $self->formulas(); |
my %formulas = $self->formulas(); |
$cachedassess = $self->{'uname'}.':'.$self->{'udom'}; |
$cachedassess = $self->{'uname'}.':'.$self->{'udom'}; |
# Get ALL the student preformance data |
# Get ALL the student preformance data |
my @tmp = &Apache::lonnet::currentdump($self->{'cid'}, |
my @tmp = &Apache::loncoursedata::get_current_state($self->{'uname'}, |
$self->{'udom'}, |
$self->{'udom'}, |
$self->{'uname'}); |
undef, |
|
$self->{'cid'}); |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
if ((scalar @tmp > 0) && ($tmp[0] !~ /^error:/)) { |
%cachedstores = @tmp; |
%cachedstores = @tmp; |
} |
} |
undef @tmp; |
undef @tmp; |
# |
# debugging code |
|
# $self->dump_hash_to_log(\%cachedstores); |
|
# |
my @assessdata=(); |
my @assessdata=(); |
foreach my $row ($self->rows()) { |
foreach my $row ($self->rows()) { |
my $cell = 'A'.$row; |
my $cell = 'A'.$row; |
Line 3171 sub loadstudent{
|
Line 3185 sub loadstudent{
|
$self->constants(\%constants); |
$self->constants(\%constants); |
} |
} |
|
|
# --------------------------------------------------- Load data for one student |
# --------------------------------------------------- Load Course Sheet |
# |
# |
sub loadcourse { |
sub loadcourse { |
my $self = shift; |
my $self = shift; |
Line 3184 sub loadcourse {
|
Line 3198 sub loadcourse {
|
foreach ($self->rows()) { |
foreach ($self->rows()) { |
$total++ if ($formulas{'A'.$_} !~ /^[!~-]/); |
$total++ if ($formulas{'A'.$_} !~ /^[!~-]/); |
} |
} |
my $now=0; |
|
my $since=time; |
my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r, |
$r->print(<<ENDPOP); |
'Spreadsheet Status','Spreadsheet Calculation Progress', $total); |
<script> |
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state, |
popwin=open('','popwin','width=400,height=100'); |
'Processing Course Assessment Data'); |
popwin.document.writeln('<html><body bgcolor="#FFFFFF">'+ |
|
'<h3>Spreadsheet Calculation Progress</h3>'+ |
|
'<form name=popremain>'+ |
|
'<input type=text size=45 name=remaining value=Starting></form>'+ |
|
'</body></html>'); |
|
popwin.document.close(); |
|
</script> |
|
ENDPOP |
|
$r->rflush(); |
|
# It would be nice to load in the classlist and assessment info at this |
# It would be nice to load in the classlist and assessment info at this |
# point, before attacking the student spreadsheets. |
# point, before attacking the student spreadsheets. |
foreach my $row ($self->rows()) { |
foreach my $row ($self->rows()) { |
Line 3211 ENDPOP
|
Line 3217 ENDPOP
|
my @studentdata=$self->exportsheet($sname,$sdom,'studentcalc', |
my @studentdata=$self->exportsheet($sname,$sdom,'studentcalc', |
undef,undef,$r); |
undef,undef,$r); |
undef %userrdatas; |
undef %userrdatas; |
$now++; |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state, |
$r->print('<script>popwin.document.popremain.remaining.value="'. |
'last student'); |
$now.'/'.$total.': '.int((time-$since)/$now*($total-$now)). |
|
' secs remaining '.(time-$started).' last";</script>'); |
|
$r->rflush(); |
|
# |
|
my $index=0; |
my $index=0; |
foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M', |
foreach ('A','B','C','D','E','F','G','H','I','J','K','L','M', |
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') { |
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z') { |
Line 3236 ENDPOP
|
Line 3238 ENDPOP
|
} |
} |
$self->formulas(\%formulas); |
$self->formulas(\%formulas); |
$self->constants(\%constants); |
$self->constants(\%constants); |
$r->print('<script>popwin.close()</script>'); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
$r->rflush(); |
|
} |
} |
|
|
# ------------------------------------------------ Load data for one assessment |
# ------------------------------------------------ Load data for one assessment |