Item13793: Backport %CALCULATE macro and other SpreadSheetPlugin features for 1.1.x.
Priority: Enhancement
Current State: Closed
Released In: 1.1.10
Target Release: patch
... commented out yet so so useful and standard since 2.x
Part 1:
--- Release01x01/core/lib/Foswiki/Plugins/SpreadSheetPlugin.pm 2012-11-19 18:25:15.687092685 +0100
+++ foswiki/lib/Foswiki/Plugins/SpreadSheetPlugin.pm 2014-06-19 15:18:59.000000000 +0200
@@ -34,20 +34,16 @@
# Get plugin debug flag
$debug = Foswiki::Func::getPreferencesFlag("SPREADSHEETPLUGIN_DEBUG") || 0;
- # Following code is for a registered tag handler that does the same as
- # CALC but in a tag handler instead of in commonTagsHandler. That means
- # you can't use table references, but you can rely on the execution order
- # relative to other macros.
- # Foswiki::Func::registerTagHandler(
- # "SSP",
- # sub {
- # my ( $session, $attributes, $topic, $web ) = @_;
- # require Foswiki::Plugins::SpreadSheetPlugin::Calc;
- # $Foswiki::Plugins::SpreadSheetPlugin::Calc::rPos = 0;
- # $Foswiki::Plugins::SpreadSheetPlugin::Calc::cPos = 0;
- # return Foswiki::Plugins::SpreadSheetPlugin::Calc::doCalc(
- # $attributes->{_DEFAULT});
- # });
+ Foswiki::Func::registerTagHandler(
+ "CALCULATE",
+ sub {
+ my ( $session, $attributes, $topic, $web ) = @_;
+ require Foswiki::Plugins::SpreadSheetPlugin::Calc;
+ $Foswiki::Plugins::SpreadSheetPlugin::Calc::rPos = 0;
+ $Foswiki::Plugins::SpreadSheetPlugin::Calc::cPos = 0;
+ return Foswiki::Plugins::SpreadSheetPlugin::Calc::_doCalc(
+ $attributes->{_DEFAULT});
+ });
# Flag to skip calc if in include
Part 2:
--- /home/www-data/foswiki/branches/Release01x01/core/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm 2012-05-08 17:32:41.282760566 +0200
+++ foswiki/lib/Foswiki/Plugins/SpreadSheetPlugin/Calc.pm 2014-06-20 13:44:59.000000000 +0200
@@ -136,7 +136,7 @@
$text =~ s/([\(\)])/_addNestingLevel($1, \$level)/ge;
$text = _doFunc( "MAIN", $text );
- if ( ( $rPos >= 0 ) && ( $cPos >= 0 ) ) {
+ if ( defined($rPos) && defined($cPos) && $rPos >= 0 && $cPos >= 0 ) {
# update cell in table matrix
$tableMatrix[$rPos][$cPos] = $text;
--
MichaelDaum - 05 Oct 2015
Changing this to port the 2.0 SSP to 1.1.10. No patch needed.
--
GeorgeClark - 10 Nov 2015