--- loncom/interface/Attic/lonspreadsheet.pm 2002/12/02 21:22:39 1.152 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/12/03 10:04:21 1.153 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.152 2002/12/02 21:22:39 matthew Exp $ +# $Id: lonspreadsheet.pm,v 1.153 2002/12/03 10:04:21 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1927,7 +1927,10 @@ sub tmpwrite { $fn=$tmpdir.$fn.'.tmp'; my $fh; if ($fh=Apache::File->new('>'.$fn)) { - print $fh join("\n",&getformulas($sheet)); + my %f = &getformulas($sheet); + while( my ($cell,$formula) = each(%f)) { + print $fh &Apache::lonnet::escape($cell)."=".&Apache::lonnet::escape($formula)."\n"; + } } } @@ -1943,32 +1946,36 @@ sub tmpread { my %fo=(); my $countrows=0; if ($fh=Apache::File->new($fn)) { - my $name; - while ($name=<$fh>) { - chomp($name); - my $value=<$fh>; - chomp($value); - $fo{$name}=$value; - if ($name=~/^A(\d+)$/) { - if ($1>$countrows) { - $countrows=$1; - } - } - } - } + while (<$fh>) { + chomp; + my ($cell,$formula) = split(/=/); + $cell = &Apache::lonnet::unescape($cell); + $formula = &Apache::lonnet::unescape($formula); + $fo{$cell} = $formula; + } + } +# chomp($value); +# $fo{$name}=$value; +# if ($name=~/^A(\d+)$/) { +# if ($1>$countrows) { +# $countrows=$1; +# } +# } +# } +# } if ($nform eq 'changesheet') { $fo{'A'.$nfield}=(split(/__&&&\__/,$fo{'A'.$nfield}))[0]; unless ($ENV{'form.sel_'.$nfield} eq 'Default') { $fo{'A'.$nfield}.='__&&&__'.$ENV{'form.sel_'.$nfield}; } - } elsif ($nfield eq 'insertrow') { - $countrows++; - my $newrow=substr('000000'.$countrows,-7); - if ($nform eq 'top') { - $fo{'A'.$countrows}='--- '.$newrow; - } else { - $fo{'A'.$countrows}='~~~ '.$newrow; - } +# } elsif ($nfield eq 'insertrow') { +# $countrows++; +# my $newrow=substr('000000'.$countrows,-7); +# if ($nform eq 'top') { +# $fo{'A'.$countrows}='--- '.$newrow; +# } else { +# $fo{'A'.$countrows}='~~~ '.$newrow; +# } } else { if ($nfield) { $fo{$nfield}=$nform; } }