cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item13793 (23 Nov 2015, GeorgeClark)Edit Attach

Item13793: Backport %CALCULATE macro and other SpreadSheetPlugin features for 1.1.x.

pencil
Priority: Enhancement
Current State: Closed
Released In: 1.1.10
Target Release: patch
Applies To: Extension
Component: SpreadSheetPlugin
Branches: Release01x01
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
... 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
 

ItemTemplate edit

Summary Backport %CALCULATE macro and other SpreadSheetPlugin features for 1.1.x.
ReportedBy MichaelDaum
Codebase 1.1.9
SVN Range
AppliesTo Extension
Component SpreadSheetPlugin
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:5599fb613071
TargetRelease patch
ReleasedIn 1.1.10
CheckinsOnBranches Release01x01
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins distro:5599fb613071
Topic revision: r5 - 23 Nov 2015, GeorgeClark - This page was cached on 04 May 2018 - 00:13.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License