version 1.33, 2004/01/14 16:47:39
|
version 1.37.2.1, 2005/04/21 17:30:24
|
Line 86 sub new {
|
Line 86 sub new {
|
my ($stype) = ($class =~ /Apache::(.*)$/); |
my ($stype) = ($class =~ /Apache::(.*)$/); |
# |
# |
my ($name,$domain,$filename,$usymb)=@_; |
my ($name,$domain,$filename,$usymb)=@_; |
|
if (! defined($name) || $name eq '') { |
|
$name = $ENV{'user.name'}; |
|
} |
|
if (! defined($domain) || $domain eq '') { |
|
$domain = $ENV{'user.domain'}; |
|
} |
# |
# |
my $self = { |
my $self = { |
name => $name, |
name => $name, |
Line 615 parametername should be a string such as
|
Line 621 parametername should be a string such as
|
sub MINPARM { |
sub MINPARM { |
my ($expression) = @_; |
my ($expression) = @_; |
my $min = undef; |
my $min = undef; |
study($expression); |
|
foreach $parameter (keys(%c)) { |
foreach $parameter (keys(%c)) { |
next if ($parameter !~ /$expression/); |
next if ($parameter !~ /$expression/); |
if ((! defined($min)) || ($min > $c{$parameter})) { |
if ((! defined($min)) || ($min > $c{$parameter})) { |
Line 640 parametername should be a string such as
|
Line 645 parametername should be a string such as
|
sub MAXPARM { |
sub MAXPARM { |
my ($expression) = @_; |
my ($expression) = @_; |
my $max = undef; |
my $max = undef; |
study($expression); |
|
foreach $parameter (keys(%c)) { |
foreach $parameter (keys(%c)) { |
next if ($parameter !~ /$expression/); |
next if ($parameter !~ /$expression/); |
if ((! defined($min)) || ($max < $c{$parameter})) { |
if ((! defined($min)) || ($max < $c{$parameter})) { |
Line 846 sub expandnamed {
|
Line 850 sub expandnamed {
|
my @matches = (); |
my @matches = (); |
my @values = (); |
my @values = (); |
$#matches = -1; |
$#matches = -1; |
study $expression; |
|
while (my($parameter,$value) = each(%{$self->{'constants'}})) { |
while (my($parameter,$value) = each(%{$self->{'constants'}})) { |
next if ($parameter !~ /$expression/); |
next if ($parameter !~ /$expression/); |
push(@matches,$parameter); |
push(@matches,$parameter); |
Line 908 sub sett {
|
Line 911 sub sett {
|
$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)/ge; |
} elsif ( $col =~ /^[A-Z]$/ ) { |
} elsif ( $col =~ /^[A-Z]$/ ) { |
if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell})) { |
if ($formula !~ /^\!/ && exists($self->{'constants'}->{$cell}) |
|
&& $self->{'constants'}->{$cell} ne '') { |
my $data = $self->{'constants'}->{$cell}; |
my $data = $self->{'constants'}->{$cell}; |
$t{$cell} = $data; |
$t{$cell} = $data; |
} |
} |
Line 1291 sub html_editable_cell {
|
Line 1295 sub html_editable_cell {
|
} elsif ($value =~ /^\s*$/ ) { |
} elsif ($value =~ /^\s*$/ ) { |
$value = '<font color="'.$bgcolor.'">#</font>'; |
$value = '<font color="'.$bgcolor.'">#</font>'; |
} else { |
} else { |
$value = &HTML::Entities::encode($value) if ($value !~/ /); |
$value = &HTML::Entities::encode($value,'<>&"') if ($value !~/ /); |
} |
} |
return $value if (! $allowed); |
return $value if (! $allowed); |
# |
# |
Line 1314 sub html_editable_cell {
|
Line 1318 sub html_editable_cell {
|
sub html_uneditable_cell { |
sub html_uneditable_cell { |
my ($cell,$bgcolor) = @_; |
my ($cell,$bgcolor) = @_; |
my $value = (defined($cell) ? $cell->{'value'} : ''); |
my $value = (defined($cell) ? $cell->{'value'} : ''); |
$value = &HTML::Entities::encode($value) if ($value !~/ /); |
$value = &HTML::Entities::encode($value,'<>&"') if ($value !~/ /); |
return ' '.$value.' '; |
return ' '.$value.' '; |
} |
} |
|
|
Line 1557 sub outsheet_xml {
|
Line 1561 sub outsheet_xml {
|
## But not on this day |
## But not on this day |
my $Str = '<spreadsheet type="'.$self->{'type'}.'">'."\n"; |
my $Str = '<spreadsheet type="'.$self->{'type'}.'">'."\n"; |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
while (my ($cell,$formula) = each(%{$self->{'formulas'}})) { |
if ($cell =~ /^template_(\d+)/) { |
if ($cell =~ /^template_(\w+)/) { |
my $col = $1; |
my $col = $1; |
$Str .= '<template col="'.$col.'">'.$formula.'</template>'."\n"; |
$Str .= '<template col="'.$col.'">'.$formula.'</template>'."\n"; |
} else { |
} else { |
Line 1570 sub outsheet_xml {
|
Line 1574 sub outsheet_xml {
|
} |
} |
} |
} |
$Str.="</spreadsheet>"; |
$Str.="</spreadsheet>"; |
# $r->print("<pre>\n\n\n".$Str."\n\n\n</pre>"); |
$r->print("<pre>\n\n\n".$Str."\n\n\n</pre>"); |
return $Str; |
return $Str; |
} |
} |
|
|
Line 1597 sub parse_sheet {
|
Line 1601 sub parse_sheet {
|
$formulas{$cell} = $formula; |
$formulas{$cell} = $formula; |
$sources{$cell} = $source if (defined($source)); |
$sources{$cell} = $source if (defined($source)); |
$parser->get_text('/field'); |
$parser->get_text('/field'); |
} |
} elsif ($token->[1] eq 'template') { |
if ($token->[1] eq 'template') { |
|
$formulas{'template_'.$token->[2]->{'col'}}= |
$formulas{'template_'.$token->[2]->{'col'}}= |
$parser->get_text('/template'); |
$parser->get_text('/template'); |
} |
} |