version 1.44, 2005/05/12 22:42:57
|
version 1.59, 2005/12/06 06:04:49
|
Line 106 sub new {
|
Line 106 sub new {
|
cid => $env{'request.course.id'}, |
cid => $env{'request.course.id'}, |
cnum => $env{'course.'.$env{'request.course.id'}.'.num'}, |
cnum => $env{'course.'.$env{'request.course.id'}.'.num'}, |
cdom => $env{'course.'.$env{'request.course.id'}.'.domain'}, |
cdom => $env{'course.'.$env{'request.course.id'}.'.domain'}, |
chome => $env{'course.'.$env{'request.course.id'}.'.home'}, |
|
coursedesc => $env{'course.'.$env{'request.course.id'}.'.description'}, |
coursedesc => $env{'course.'.$env{'request.course.id'}.'.description'}, |
coursefilename => $env{'request.course.fn'}, |
coursefilename => $env{'request.course.fn'}, |
# |
# |
# Flags |
# Flags |
temporary => 0, # true if this sheet has been modified but not saved |
temporary => 0, # true if this sheet has been modified but not saved |
new_rows => 0, # true if this sheet has new rows |
new_rows => 0, # true if this sheet has new rows |
|
loaded => 0, # true if the formulas have been loaded |
# |
# |
# blackout is used to determine if any data needs to be hidden from the |
# blackout is used to determine if any data needs to be hidden from the |
# student. |
# student. |
Line 126 sub new {
|
Line 126 sub new {
|
othersheets => [], |
othersheets => [], |
}; |
}; |
# |
# |
$self->{'uhome'} = &Apache::lonnet::homeserver($name,$domain); |
|
# |
|
bless($self,$class); |
bless($self,$class); |
# |
|
# Load in the spreadsheet definition |
|
$self->filename($filename); |
$self->filename($filename); |
if (exists($env{'form.workcopy'}) && |
# |
$self->{'type'} eq $env{'form.workcopy'}) { |
|
$self->load_tmp(); |
|
} else { |
|
$self->load(); |
|
} |
|
return $self; |
return $self; |
} |
} |
|
|
Line 200 sub make_default {
|
Line 191 sub make_default {
|
{'spreadsheet_default_'.$self->{'type'} => $self->filename()}, |
{'spreadsheet_default_'.$self->{'type'} => $self->filename()}, |
$self->{'cdom'},$self->{'cnum'}); |
$self->{'cdom'},$self->{'cnum'}); |
return $result if ($result ne 'ok'); |
return $result if ($result ne 'ok'); |
|
&Apache::lonnet::appenv('course.'.$self->{'cid'}.'.spreadsheet_default_'. |
|
$self->{'type'} => $self->filename()); |
my $symb = $self->{'symb'}; |
my $symb = $self->{'symb'}; |
$symb = '' if (! defined($symb)); |
$symb = '' if (! defined($symb)); |
&Apache::lonnet::expirespread('','',$self->{'type'},$symb); |
&Apache::lonnet::expirespread('','',$self->{'type'},$symb); |
Line 220 course environment. Returns 0 otherwise
|
Line 213 course environment. Returns 0 otherwise
|
sub is_default { |
sub is_default { |
my $self = shift; |
my $self = shift; |
# Check to find out if we are the default spreadsheet (filenames match) |
# Check to find out if we are the default spreadsheet (filenames match) |
my $default_filename = ''; |
my $default_filename = $env{'course.'.$self->{'cid'}. |
my %tmphash = &Apache::lonnet::get('environment', |
'.spreadsheet_default_'.$self->{'type'}}; |
['spreadsheet_default_'. |
|
$self->{'type'}], |
|
$self->{'cdom'}, |
|
$self->{'cnum'}); |
|
my ($tmp) = keys(%tmphash); |
|
if ($tmp !~ /^(con_lost|error|no_such_host)/i) { |
|
$default_filename = $tmphash{'spreadsheet_default_'.$self->{'type'}}; |
|
} |
|
if ($default_filename =~ /^\s*$/) { |
if ($default_filename =~ /^\s*$/) { |
$default_filename = 'default_'.$self->{'type'}; |
$default_filename = 'default_'.$self->{'type'}; |
} |
} |
Line 330 sub initialize_safe_space {
|
Line 315 sub initialize_safe_space {
|
$safehole->wrap(\&mask,$safeeval,'&mask'); |
$safehole->wrap(\&mask,$safeeval,'&mask'); |
$safehole->wrap(\&Apache::lonnet::logthis,$safeeval,'&logthis'); |
$safehole->wrap(\&Apache::lonnet::logthis,$safeeval,'&logthis'); |
$safeeval->share('$@'); |
$safeeval->share('$@'); |
|
# Holds the (computed, final) values for the sheet |
|
# This is only written to by &calc, the spreadsheet computation routine. |
|
# It is read by many functions |
|
$safeeval->share('%sheet_values'); |
my $code=<<'ENDDEFS'; |
my $code=<<'ENDDEFS'; |
# ---------------------------------------------------- Inside of the safe space |
# ---------------------------------------------------- Inside of the safe space |
# |
# |
Line 339 sub initialize_safe_space {
|
Line 328 sub initialize_safe_space {
|
# c: preloaded constants (A-column) |
# c: preloaded constants (A-column) |
# rl: row label |
# rl: row label |
# os: other spreadsheets (for student spreadsheet only) |
# os: other spreadsheets (for student spreadsheet only) |
undef %sheet_values; # Holds the (computed, final) values for the sheet |
undef %t; # Holds the forumlas of the spreadsheet to be computed. Set in |
# This is only written to by &calc, the spreadsheet computation routine. |
# &sett, which does the translation of strings like C5 into the value |
# It is read by many functions |
# in C5. Used in &calc - %t holds the values that are actually eval'd. |
undef %t; # Holds the values of the spreadsheet temporarily. Set in &sett, |
|
# which does the translation of strings like C5 into the value in C5. |
|
# Used in &calc - %t holds the values that are actually eval'd. |
|
undef %f; # Holds the formulas for each cell. This is the users |
undef %f; # Holds the formulas for each cell. This is the users |
# (spreadsheet authors) data for each cell. |
# (spreadsheet authors) data for each cell. |
undef %c; # Holds the constants for a sheet. In the assessment |
undef %c; # Holds the constants for a sheet. In the assessment |
Line 365 $filename = '';
|
Line 351 $filename = '';
|
# |
# |
# user data |
# user data |
$name = ''; |
$name = ''; |
$uhome = ''; |
|
$domain = ''; |
$domain = ''; |
# |
# |
# course data |
# course data |
$csec = ''; |
$csec = ''; |
$chome= ''; |
|
$cnum = ''; |
$cnum = ''; |
$cdom = ''; |
$cdom = ''; |
$cid = ''; |
$cid = ''; |
Line 670 sub MAXPARM {
|
Line 654 sub MAXPARM {
|
return $max; |
return $max; |
} |
} |
|
|
|
#------------------------------------------------------- |
|
|
|
=pod |
|
|
|
=item &get_values($lower,$upper) |
|
|
|
Inputs: $lower and $upper, cell names ("X12" or "a150") or globs ("X*"). |
|
|
|
Returns: an array ref of the values of the cells that exist in the |
|
speced range |
|
|
|
=cut |
|
|
|
#------------------------------------------------------- |
sub get_values { |
sub get_values { |
my ($lower,$upper)=@_; |
my ($lower,$upper)=@_; |
my $mask=&mask(@_); |
$upper = $lower if (! defined($upper)); |
my @values; |
my @values; |
foreach (grep eval("/$mask/"),keys(%sheet_values)) { |
my ($la,$ld) = ($lower=~/([A-z]|\*)(\d+|\*)/); |
push(@values,$sheet_values{$_}); |
my ($ua,$ud) = ($upper=~/([A-z]|\*)(\d+|\*)/); |
} |
my ($alpha,$num); |
return \@values; |
if ($ld ne '*' && $ud ne '*') { |
if (0) { |
|
# perhaps creating a list of possible cells and looking if they exist |
|
# would be faster somtimes? |
|
&logthis("mask is ".$mask); |
|
my @alpha; |
my @alpha; |
if (($la eq '*') || ($ua eq '*')) { |
if (($la eq '*') || ($ua eq '*')) { |
@alpha=('A'..'z'); |
@alpha=('A'..'z'); |
} else { |
} else { |
if ($la gt $ua) { |
if ($la gt $ua) { ($la,$ua)=($ua,$la); } |
my $tmp = $ua; |
if ((lc($la) ne $la) && (lc($ua) eq $ua)) { |
$ua = $la; |
@alpha=($la..'Z','a'..$ua); |
$la = $ua; |
} else { |
|
@alpha=($la..$ua); |
|
} |
|
} |
|
my @num=($ld..$ud); |
|
foreach my $a (@alpha) { |
|
foreach my $n (@num) { |
|
if (exists($sheet_values{$a.$n})) { |
|
push(@values,$sheet_values{$a.$n}); |
|
} |
} |
} |
$alpha=($la..$ua); |
|
} |
} |
|
return \@values; |
|
} else { |
|
$num = '(\d+)'; |
|
} |
|
if (($la eq '*') || ($ua eq '*')) { |
|
$alpha='[A-z]'; |
|
} else { |
|
if ($la gt $ua) { ($la,$ua)=($ua,$la); } |
|
$alpha=qq/[$la-$ua]/; |
|
} |
|
my $expression = '^'.$alpha.$num.'$'; |
|
foreach (grep /$expression/,keys(%sheet_values)) { |
|
push(@values,$sheet_values{$_}); |
} |
} |
|
return \@values; |
} |
} |
|
|
sub calc { |
sub calc { |
%sheet_values = %t; |
|
my $notfinished = 1; |
my $notfinished = 1; |
my $lastcalc = ''; |
my $lastcalc = ''; |
my $depth = 0; |
my $depth = 0; |
Line 738 ENDDEFS
|
Line 753 ENDDEFS
|
# itself |
# itself |
my $initstring = ''; |
my $initstring = ''; |
foreach (qw/name domain type symb cid csec coursefilename |
foreach (qw/name domain type symb cid csec coursefilename |
cnum cdom chome uhome/) { |
cnum cdom/) { |
$initstring.= qq{\$$_="$self->{$_}";}; |
$initstring.= qq{\$$_="$self->{$_}";}; |
} |
} |
$initstring.=qq{\$usection="$usection";}; |
$initstring.=qq{\$usection="$usection";}; |
Line 758 ENDDEFS
|
Line 773 ENDDEFS
|
|
|
###################################################### |
###################################################### |
|
|
|
|
###################################################### |
|
|
|
=pod |
|
|
|
=item &mask($lower,$upper) |
|
|
|
Inputs: $lower and $upper, cell names ("X12" or "a150") or globs ("X*"). |
|
|
|
Returns: Regular expression matching spreadsheet cells that are within |
|
the rectangle defined by $lower and $upper. Due to the nature of the |
|
regular expression this result must be used inside an eval(). |
|
|
|
=cut |
|
|
|
###################################################### |
|
{ |
|
|
|
my %memoizer; |
|
|
|
sub mask { |
|
my ($lower,$upper)=@_; |
|
my $key = $lower.'_'.$upper; |
|
if (exists($memoizer{$key})) { |
|
return $memoizer{$key}; |
|
} |
|
$upper = $lower if (! defined($upper)); |
|
# |
|
my ($la,$ld) = ($lower=~/([A-z]|\*)(\d+|\*)/); |
|
my ($ua,$ud) = ($upper=~/([A-z]|\*)(\d+|\*)/); |
|
# |
|
my $alpha=''; |
|
my $num=''; |
|
# |
|
# Do not put parenthases around $alpha. |
|
# $num depends on the value in $1. |
|
if (($la eq '*') || ($ua eq '*')) { |
|
$alpha='[A-z]'; |
|
} else { |
|
if ($la gt $ua) { |
|
my $tmp = $ua; |
|
$ua = $la; |
|
$la = $ua; |
|
} |
|
$alpha=qq/[$la-$ua]/; |
|
} |
|
if ($ld ne '*' && $ud ne '*') { |
|
# Make sure $ld <= $ud |
|
if ($ld > $ud) { |
|
my $tmp = $ud; |
|
$ud = $ld; |
|
$ld = $tmp; |
|
} |
|
# Here we make a regular expression using some advanced regexp |
|
# abilities. |
|
# (\d+) will match the digits of the cell name and dump them in |
|
# to $1 |
|
# (?(?{ ... code ...} pattern_if_true | pattern_if_false)) will |
|
# choose pattern_if_true if { ... code ... } is true and |
|
# pattern_if_false if { ... code ... } is false. |
|
# In this case, pattern_if_true is empty. pattern_if_false is |
|
# 'donotmatch' and will not match our cells because none of |
|
# them end with donotmatch. |
|
# Unfortunately, the use of this type of regular expression |
|
# requires that each match be wrapped in an eval(). Search for |
|
# $mask in this module for examples |
|
$num = '(\d+)(?(?{$1>= '.$ld.' && $1<='.$ud.'})|donotmatch)'; |
|
} else { |
|
$num = '(\d+)'; |
|
} |
|
my $expression = '^'.$alpha.$num.'$'; |
|
$memoizer{$key} = $expression; |
|
return $expression; |
|
} |
|
|
|
# |
|
# Debugging routine |
|
sub dump_memoized_values { |
|
while (my ($key,$value) = each(%memoizer)) { |
|
&Apache::lonnet::logthis('memoizer: '.$key.' = '.$value); |
|
} |
|
return; |
|
} |
|
|
|
} |
|
|
|
## |
## |
## sub add_hash_to_safe {} # spreadsheet, would like to destroy |
## sub add_hash_to_safe {} # spreadsheet, would like to destroy |
## |
## |
Line 923 sub expandnamed {
|
Line 852 sub expandnamed {
|
sub sett { |
sub sett { |
my $self = shift; |
my $self = shift; |
my %t=(); |
my %t=(); |
|
undef(%Apache::Spreadsheet::sheet_values); |
# |
# |
# Deal with the template row |
# Deal with the template row |
foreach my $col ($self->template_cells()) { |
foreach my $col ($self->template_cells()) { |
Line 955 sub sett {
|
Line 885 sub sett {
|
} elsif ( $col =~ /^[A-Z]$/ ) { |
} elsif ( $col =~ /^[A-Z]$/ ) { |
if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell}) |
if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell}) |
&& $self->{'constants'}->{$cell} ne '') { |
&& $self->{'constants'}->{$cell} ne '') { |
my $data = $self->{'constants'}->{$cell}; |
$Apache::Spreadsheet::sheet_values{$cell}= |
$t{$cell} = $data; |
eval($self->{'constants'}->{$cell}); |
} |
} |
} else { # $row > 1 and $col =~ /[a-z] |
} else { # $row > 1 and $col =~ /[a-z] |
$t{$cell}=$formula; |
$t{$cell}=$formula; |
Line 975 sub sett {
|
Line 905 sub sett {
|
sub sync_safe_space { |
sub sync_safe_space { |
my $self = shift; |
my $self = shift; |
# Inside the safe space 'formulas' has a diabolical alter-ego named 'f'. |
# Inside the safe space 'formulas' has a diabolical alter-ego named 'f'. |
%{$self->{'safe'}->varglob('f')}=%{$self->{'formulas'}}; |
#%{$self->{'safe'}->varglob('f')}=%{$self->{'formulas'}}; |
# 'constants' leads a peaceful hidden life of 'c'. |
# 'constants' leads a peaceful hidden life of 'c'. |
%{$self->{'safe'}->varglob('c')}=%{$self->{'constants'}}; |
%{$self->{'safe'}->varglob('c')}=%{$self->{'constants'}}; |
# 'othersheets' hides as 'os', a disguise few can penetrate. |
# 'othersheets' hides as 'os', a disguise few can penetrate. |
@{$self->{'safe'}->varglob('os')}=@{$self->{'othersheets'}}; |
#@{$self->{'safe'}->varglob('os')}=@{$self->{'othersheets'}}; |
} |
} |
|
|
## |
## |
Line 1032 sub formulas {
|
Line 962 sub formulas {
|
$self->{'formulas'} = $formulas; |
$self->{'formulas'} = $formulas; |
$self->{'rows'} = []; |
$self->{'rows'} = []; |
$self->{'template_cells'} = []; |
$self->{'template_cells'} = []; |
|
$self->{'loaded'} = 1; |
return; |
return; |
} else { |
} else { |
|
$self->check_formulas_loaded(); |
return %{$self->{'formulas'}}; |
return %{$self->{'formulas'}}; |
} |
} |
} |
} |
|
|
|
sub check_formulas_loaded { |
|
my $self=shift; |
|
if (!$self->{'loaded'}) { |
|
$self->{'loaded'}=1; |
|
# Load in the spreadsheet definition |
|
if (exists($env{'form.workcopy'}) && |
|
$self->{'type'} eq $env{'form.workcopy'}) { |
|
$self->load_tmp(); |
|
} else { |
|
$self->load(); |
|
} |
|
} |
|
} |
|
|
sub set_formula { |
sub set_formula { |
my $self = shift; |
my $self = shift; |
my ($cell,$formula) = @_; |
my ($cell,$formula) = @_; |
|
$self->check_formulas_loaded(); |
$self->{'formulas'}->{$cell}=$formula; |
$self->{'formulas'}->{$cell}=$formula; |
return; |
return; |
} |
} |
Line 1050 sub set_formula {
|
Line 997 sub set_formula {
|
## |
## |
sub formulas_keys { |
sub formulas_keys { |
my $self = shift; |
my $self = shift; |
my @keys = keys(%{$self->{'formulas'}}); |
$self->check_formulas_loaded(); |
return keys(%{$self->{'formulas'}}); |
return keys(%{$self->{'formulas'}}); |
} |
} |
|
|
Line 1061 sub formulas_keys {
|
Line 1008 sub formulas_keys {
|
sub formula { |
sub formula { |
my $self = shift; |
my $self = shift; |
my $cell = shift; |
my $cell = shift; |
|
$self->check_formulas_loaded(); |
if (defined($cell) && exists($self->{'formulas'}->{$cell})) { |
if (defined($cell) && exists($self->{'formulas'}->{$cell})) { |
return $self->{'formulas'}->{$cell}; |
return $self->{'formulas'}->{$cell}; |
} |
} |
Line 1139 sub rebuild_stats {
|
Line 1087 sub rebuild_stats {
|
my $self = shift; |
my $self = shift; |
$self->{'rows'}=[]; |
$self->{'rows'}=[]; |
$self->{'template_cells'}=[]; |
$self->{'template_cells'}=[]; |
|
$self->check_formulas_loaded(); |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
push(@{$self->{'rows'}},$1) if ($cell =~ /^A(\d+)/ && $1 != 0); |
push(@{$self->{'rows'}},$1) if ($cell =~ /^A(\d+)/ && $1 != 0); |
push(@{$self->{'template_cells'}},$1) if ($cell =~ /^template_(\w+)/); |
push(@{$self->{'template_cells'}},$1) if ($cell =~ /^template_(\w+)/); |
Line 1579 sub outsheet_xml {
|
Line 1528 sub outsheet_xml {
|
## Will be rendered for the user |
## Will be rendered for the user |
## But not on this day |
## But not on this day |
my $Str = '<spreadsheet type="'.$self->{'type'}.'">'."\n"; |
my $Str = '<spreadsheet type="'.$self->{'type'}.'">'."\n"; |
|
$self->check_formulas_loaded(); |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
if ($cell =~ /^template_(\w+)/) { |
if ($cell =~ /^template_(\w+)/) { |
my $col = $1; |
my $col = $1; |
Line 1661 sub load {
|
Line 1611 sub load {
|
my $stype = $self->{'type'}; |
my $stype = $self->{'type'}; |
my $cnum = $self->{'cnum'}; |
my $cnum = $self->{'cnum'}; |
my $cdom = $self->{'cdom'}; |
my $cdom = $self->{'cdom'}; |
my $chome = $self->{'chome'}; |
|
# |
# |
my $filename = $self->filename(); |
my $filename = $self->filename(); |
my $cachekey = join('_',($cnum,$cdom,$stype,$filename)); |
my $cachekey = join('_',($cnum,$cdom,$stype,$filename)); |
Line 1670 sub load {
|
Line 1619 sub load {
|
my ($formulas); |
my ($formulas); |
if (exists($spreadsheets{$cachekey})) { |
if (exists($spreadsheets{$cachekey})) { |
$formulas = $spreadsheets{$cachekey}->{'formulas'}; |
$formulas = $spreadsheets{$cachekey}->{'formulas'}; |
|
$self->formulas($formulas); |
|
$self->{'row_source'}=$spreadsheets{$cachekey}->{'row_source'}; |
|
$self->{'row_numbers'}=$spreadsheets{$cachekey}->{'row_numbers'}; |
|
$self->{'maxrow'}=$spreadsheets{$cachekey}->{'maxrow'}; |
} else { |
} else { |
# Not cached, need to read |
# Not cached, need to read |
if (! defined($filename)) { |
if (! defined($filename)) { |
Line 1703 sub load {
|
Line 1656 sub load {
|
$formulas = $self->load_system_default_sheet(); |
$formulas = $self->load_system_default_sheet(); |
} |
} |
} |
} |
$filename=$self->filename(); # filename may have changed |
$self->formulas($formulas); |
$cachekey = join('_',($cnum,$cdom,$stype,$filename)); |
$self->set_row_sources(); |
%{$spreadsheets{$cachekey}->{'formulas'}} = %{$formulas}; |
$self->set_row_numbers(); |
} |
$self->cache_sheet($formulas); |
$self->formulas($formulas); |
} |
$self->set_row_sources(); |
} |
$self->set_row_numbers(); |
|
|
sub cache_sheet { |
|
my $self = shift; |
|
my ($formulas) = @_; |
|
my $stype = $self->{'type'}; |
|
my $cnum = $self->{'cnum'}; |
|
my $cdom = $self->{'cdom'}; |
|
# |
|
my $filename = $self->filename(); |
|
my $cachekey = join('_',($cnum,$cdom,$stype,$filename)); |
|
|
|
if (ref($formulas) eq 'HASH') { |
|
%{$spreadsheets{$cachekey}->{'formulas'}} = %{$formulas}; |
|
} |
|
if (ref($self->{'row_source'})) { |
|
%{$spreadsheets{$cachekey}->{'row_source'}} =%{$self->{'row_source'}}; |
|
} |
|
if (ref($self->{'row_numbers'})) { |
|
%{$spreadsheets{$cachekey}->{'row_numbers'}}=%{$self->{'row_numbers'}}; |
|
} |
|
$spreadsheets{$cachekey}->{'maxrow'} = $self->{'maxrow'}; |
} |
} |
|
|
sub set_row_sources { |
sub set_row_sources { |
my $self = shift; |
my $self = shift; |
|
$self->check_formulas_loaded(); |
while (my ($cell,$value) = each(%{$self->{'formulas'}})) { |
while (my ($cell,$value) = each(%{$self->{'formulas'}})) { |
next if ($cell !~ /^A(\d+)/ || $1 < 1); |
next if ($cell !~ /^A(\d+)/ || $1 < 1); |
my $row = $1; |
my $row = $1; |
Line 1724 sub set_row_sources {
|
Line 1698 sub set_row_sources {
|
|
|
sub set_row_numbers { |
sub set_row_numbers { |
my $self = shift; |
my $self = shift; |
|
$self->check_formulas_loaded(); |
while (my ($cell,$value) = each(%{$self->{'formulas'}})) { |
while (my ($cell,$value) = each(%{$self->{'formulas'}})) { |
next if ($cell !~ /^A(\d+)$/); |
next if ($cell !~ /^A(\d+)$/); |
next if (! defined($value)); |
next if (! defined($value)); |
Line 1758 sub save {
|
Line 1733 sub save {
|
my $stype = $self->{'type'}; |
my $stype = $self->{'type'}; |
my $cnum = $self->{'cnum'}; |
my $cnum = $self->{'cnum'}; |
my $cdom = $self->{'cdom'}; |
my $cdom = $self->{'cdom'}; |
my $chome = $self->{'chome'}; |
|
my $filename = $self->{'filename'}; |
my $filename = $self->{'filename'}; |
my $cachekey = join('_',($cnum,$cdom,$stype,$filename)); |
|
# Cache new sheet |
# Cache new sheet |
%{$spreadsheets{$cachekey}->{'formulas'}}=%f; |
$self->cache_sheet(\%f); |
# Write sheet |
# Write sheet |
foreach (keys(%f)) { |
foreach (keys(%f)) { |
delete($f{$_}) if ($f{$_} eq 'import'); |
delete($f{$_}) if ($f{$_} eq 'import'); |
Line 1778 sub save {
|
Line 1751 sub save {
|
{'spreadsheet_default_'.$stype => $filename }, |
{'spreadsheet_default_'.$stype => $filename }, |
$cdom,$cnum); |
$cdom,$cnum); |
return $reply if ($reply ne 'ok'); |
return $reply if ($reply ne 'ok'); |
|
&Apache::lonnet::appenv('course.'.$self->{'cid'}.'.spreadsheet_default_'. |
|
$self->{'type'} => $self->filename()); |
} |
} |
if ($self->is_default()) { |
if ($self->is_default()) { |
if ($self->{'type'} eq 'studentcalc') { |
if ($self->{'type'} eq 'studentcalc') { |