Diff for /loncom/interface/spreadsheet/Spreadsheet.pm between versions 1.73.2.1 and 1.74

version 1.73.2.1, 2007/01/25 22:00:07 version 1.74, 2007/01/23 01:36:26
Line 805  sub expandnamed { Line 805  sub expandnamed {
     my $self = shift;      my $self = shift;
     my $expression=shift;      my $expression=shift;
     if ($expression=~/^\&/) {      if ($expression=~/^\&/) {
  my ($func,$var,$formula)=($expression=~/^\&(\w+)\(([^\;]+)\;(.*)\)/);   my ($func,$var,$formula)=($expression=~/^\&(\w+)\(([^\;]+)\;(.*)\)/s);
  my @vars=split(/\W+/,$formula);   my @vars=split(/\W+/,$formula);
  # make the list uniq   # make the list uniq
  @vars = keys(%{{ map { $_ => 1 } @vars }});   @vars = keys(%{{ map { $_ => 1 } @vars }});
Line 892  sub sett { Line 892  sub sett {
             # Replace 'A0' with the value from 'A0'              # Replace 'A0' with the value from 'A0'
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;              $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
             # Replace parameters              # Replace parameters
             $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;              $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         }          }
     }      }
     #      #
Line 904  sub sett { Line 904  sub sett {
             $t{$cell}=$formula;              $t{$cell}=$formula;
             $t{$cell}=~s/\.\.+/\,/g;              $t{$cell}=~s/\.\.+/\,/g;
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;              $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
             $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;              $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         } 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 '') {
Line 915  sub sett { Line 915  sub sett {
             $t{$cell}=$formula;              $t{$cell}=$formula;
             $t{$cell}=~s/\.\.+/\,/g;              $t{$cell}=~s/\.\.+/\,/g;
             $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;              $t{$cell}=~s/(^|[^\"\'])([A-Za-z]\d+)/$1\$sheet_values\{\'$2\'\}/g;
             $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/ge;              $t{$cell}=~s/(^|[^\"\'])\[([^\]]+)\]/$1.$self->expandnamed($2)/sge;
         }          }
     }      }
     %{$self->{'safe'}->varglob('t')}=%t;      %{$self->{'safe'}->varglob('t')}=%t;
Line 1797  sub save { Line 1797  sub save {
     &Apache::lonnet::appenv('course.'.$self->{'cid'}.'.spreadsheet_default_'.      &Apache::lonnet::appenv('course.'.$self->{'cid'}.'.spreadsheet_default_'.
     $self->{'type'} => $self->filename());      $self->{'type'} => $self->filename());
         }           } 
  if ($self->{'type'} eq 'studentcalc') {          if ($self->is_default()) {
     &Apache::lonnet::expirespread('','','studentcalc','');              if ($self->{'type'} eq 'studentcalc') {
  } elsif ($self->{'type'} eq 'assesscalc') {                  &Apache::lonnet::expirespread('','','studentcalc','');
     &Apache::lonnet::expirespread('','','assesscalc','');              } elsif ($self->{'type'} eq 'assesscalc') {
     &Apache::lonnet::expirespread('','','studentcalc','');                  &Apache::lonnet::expirespread('','','assesscalc','');
                   &Apache::lonnet::expirespread('','','studentcalc','');
               }
         }          }
         return $reply;          return $reply;
     }      }

Removed from v.1.73.2.1  
changed lines
  Added in v.1.74


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>