--- loncom/interface/Attic/lonspreadsheet.pm 2002/11/20 16:46:31 1.144 +++ loncom/interface/Attic/lonspreadsheet.pm 2002/11/21 18:56:36 1.145 @@ -1,5 +1,5 @@ # -# $Id: lonspreadsheet.pm,v 1.144 2002/11/20 16:46:31 matthew Exp $ +# $Id: lonspreadsheet.pm,v 1.145 2002/11/21 18:56:36 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2365,7 +2365,8 @@ sub loadstudent{ undef @tmp; # my @assessdata=(); - while (my ($cell,$value) = each (%formulas)) { + foreach my $cell (keys(%formulas)) { + my $value = $formulas{$cell}; if(defined($c) && ($c->aborted())) { last; } @@ -2377,18 +2378,15 @@ sub loadstudent{ $sheet->{'udom'}, 'assesscalc',$usy,$ufn,$r); my $index=0; - 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') { + foreach my $col ('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') { if (defined($assessdata[$index])) { - my $col=$_; if ($assessdata[$index]=~/\D/) { $constants{$col.$row}="'".$assessdata[$index]."'"; } else { $constants{$col.$row}=$assessdata[$index]; } - unless ($col eq 'A') { - $formulas{$col.$row}='import'; - } + $formulas{$col.$row}='import' if ($col ne 'A'); } $index++; } @@ -2689,6 +2687,7 @@ sub forcedrecalc { # sub exportsheet { my ($sheet,$uname,$udom,$stype,$usymb,$fn,$r)=@_; + my $flag = 0; $uname = $uname || $sheet->{'uname'}; $udom = $udom || $sheet->{'udom'}; $stype = $stype || $sheet->{'sheettype'}; @@ -2757,14 +2756,24 @@ sub exportsheet { [$key], $sheet->{'cdom'},$sheet->{'cnum'}); if ($tmp[0]!~/^error/) { - %currentlystored = @tmp; + # We only got one key, so we will access it directly. + foreach (split('___&___',$tmp[1])) { + my ($key,$value) = split('___=___',$_); + $key = '' if (! defined($key)); + $currentlystored{$key} = $value; + } } } else { my @tmp = &Apache::lonnet::get('nohist_calculatedsheets_'. $sheet->{'cid'},[$key], $sheet->{'udom'},$sheet->{'uname'}); if ($tmp[0]!~/^error/) { - %currentlystored = @tmp; + # We only got one key, so we will access it directly. + foreach (split('___&___',$tmp[1])) { + my ($key,$value) = split('___=___',$_); + $key = '' if (! defined($key)); + $currentlystored{$key} = $value; + } } } #