Item8659: breaks if JQueryPlugin is enabled

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: FlotChartPlugin
Branches:
Reported By: AntonioTerceiro
Waiting For: Main.AntonioTerceiro
Last Change By: AntonioTerceiro
First of all, thank you very much for the very nice piece of work that FlotChartPlugin is. smile

When JQueryPlugin is enabled, FlotChartPlugin does not reference its own copy of JQuery in favour of using JQueryPlugin's jquery.js. But since FlotChartPlugin does not inform a dependency on FlotChartPlugin headers, jquery.flot.js gets loaded after jquery.js, and therefore FlotChartPlugin does not work.

The following patch fixes the problem:

Index: lib/Foswiki/Plugins/FlotChartPlugin.pm
===================================================================
--- lib/Foswiki/Plugins/FlotChartPlugin.pm      (revisão 6639)
+++ lib/Foswiki/Plugins/FlotChartPlugin.pm      (cópia de trabalho)
@@ -64,7 +64,7 @@
 
     # add the initialisation javascript
     my $jscript = Foswiki::Func::readTemplate( lc($pluginName), 'javascript' );
-    Foswiki::Func::addToHEAD( $pluginName . '-javascript', $jscript );
+    Foswiki::Func::addToHEAD( $pluginName . '-javascript', $jscript, 'JQUERYPLUGIN' );
 
 }
 

I've tested with and without JQueryPlugin enabled, and it works both ways.

-- AntonioTerceiro - 03 Mar 2010

It also does not work with the most recent JQueryPlugin ... because JQueryPlugin adds it's javascript tags to the 'body' zone and FlotChartPlugin is adding to the 'head' zone ... and since the dependencies between items are handled per zone, the Flot javascript ends up being loaded before the JQueryPlugin ones

-- AntonioTerceiro - 07 Jun 2010

Please do not use addToHead anymore. It is deprecated in favour of addToZone. Then add all javascript code to the body zone.

-- MichaelDaum - 08 Jun 2010

My suggestion to fix this is:

  1. Depend on JQueryPlugin; drop local copy of jquery
  2. Change the Javascript additions to use addToZone

Sven, what do you think? Can I go on with this?

-- AntonioTerceiro - 09 Jun 2010

go, go, go smile

-- SvenDowideit - 10 Jun 2010

ok, done and released in 1.2

-- AntonioTerceiro - 14 Jun 2010
 
Topic revision: r11 - 14 Jun 2010, AntonioTerceiro
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy