diff --git a/JQueryPlugin/data/System/JQueryPlugin.txt b/JQueryPlugin/data/System/JQueryPlugin.txt index 35f99b90f2..21a8d2cf6e 100644 --- a/JQueryPlugin/data/System/JQueryPlugin.txt +++ b/JQueryPlugin/data/System/JQueryPlugin.txt @@ -101,6 +101,7 @@ reduce bandwidth and speed up interactive performance. | Release: | %$RELEASE% | | Version: | %$VERSION% | | Change History: |   | +| 03 Mar 2010: | made ZonePlugin an optional dependency | | 01 Mar 2010: | improved js and css compression using yuicompressor; \ improved simplemodal integration to foswiki to create modal dialogs with less additional javascript; \ added custom events to textboxlist: AddValue, DeleteValue , Reset and Clear | diff --git a/JQueryPlugin/lib/Foswiki/Configure/Checkers/Plugins/JQueryPlugin/Enabled.pm b/JQueryPlugin/lib/Foswiki/Configure/Checkers/Plugins/JQueryPlugin/Enabled.pm index 19690ce212..9a49ec37b4 100644 --- a/JQueryPlugin/lib/Foswiki/Configure/Checkers/Plugins/JQueryPlugin/Enabled.pm +++ b/JQueryPlugin/lib/Foswiki/Configure/Checkers/Plugins/JQueryPlugin/Enabled.pm @@ -12,9 +12,11 @@ sub check { my $warnings; if ( $Foswiki::cfg{Plugins}{JQueryPlugin}{Enabled} ) { - if ( !$Foswiki::cfg{Plugins}{ZonePlugin}{Enabled} ) { - $warnings .= $this->ERROR(<<'HERE'); -JQueryPlugin depends on ZonePlugin, which is not enabled. + if ( not exists &Foswiki::Func::addToZone ) { + $warnings .= $this->NOTE(<<'HERE'); +ZonePlugin is not enabled. With ZonePlugin, JQueryPlugin can optimise the +placement of <script> tags in the rendered XHTML for better +web browser page load performance. HERE } } diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm index 31bd1e6f99..9895d56dd8 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin.pm @@ -14,6 +14,7 @@ # package Foswiki::Plugins::JQueryPlugin; use strict; +use warnings; =begin TML @@ -415,4 +416,26 @@ sub handleJQueryPlugins { return $theHeader.join($theSeparator, @result).$theFooter; } +=begin TML + +---++ ourAddToZone($zone, $tag, $text, $requires) + +This is a simple wrapper to call Foswiki::Func::addToZone() if available, or +Foswiki::Func::addToHead() otherwise (in which case, everything is added to head) + +=cut + +sub ourAddToZone { + my ($zone, $tag, $text, $requires) = @_; + + if (not exists &Foswiki::Func::addToZone) { + Foswiki::Func::addToHEAD($tag, $text, $requires); + } else { + Foswiki::Func::addToZone($zone, $tag, $text, $requires); + } + + return; +} + + 1; diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/DEPENDENCIES b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/DEPENDENCIES index 868ababf65..95416acf7a 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/DEPENDENCIES +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/DEPENDENCIES @@ -1,2 +1,2 @@ -Foswiki::Plugins::ZonePlugin,>=1.0,perl,Required. +Foswiki::Plugins::ZonePlugin,>=1.0,perl,Optional diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/FOSWIKI.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/FOSWIKI.pm index 58da29400f..984b916e00 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/FOSWIKI.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/FOSWIKI.pm @@ -15,6 +15,7 @@ package Foswiki::Plugins::JQueryPlugin::FOSWIKI; use strict; +use warnings; use Foswiki::Func; use base 'Foswiki::Plugins::JQueryPlugin::Plugin'; @@ -89,8 +90,8 @@ HERE my $footer = "\n"; - Foswiki::Func::addToZone('head', 'JQUERYPLUGIN::FOSWIKI', $header, 'JQUERYPLUGIN'); - Foswiki::Func::addToZone('body', 'JQUERYPLUGIN::FOSWIKI', $footer, 'JQUERYPLUGIN'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('head', 'JQUERYPLUGIN::FOSWIKI', $header, 'JQUERYPLUGIN'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', 'JQUERYPLUGIN::FOSWIKI', $footer, 'JQUERYPLUGIN'); } diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/GRID.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/GRID.pm index f2a6c51040..423d2bc83a 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/GRID.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/GRID.pm @@ -15,6 +15,7 @@ package Foswiki::Plugins::JQueryPlugin::GRID; use strict; +use warnings; use base 'Foswiki::Plugins::JQueryPlugin::Plugin'; use Foswiki::Form (); @@ -85,7 +86,7 @@ sub init { unless -f $Foswiki::cfg{PubDir}.'/'.$localePath; my $header .= "\n"; - Foswiki::Func::addToZone('body', "JQUERYPLUGIN::GRID::LANG", $header, 'JQUERYPLUGIN::UI'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', "JQUERYPLUGIN::GRID::LANG", $header, 'JQUERYPLUGIN::UI'); } =begin TML @@ -221,7 +222,7 @@ jQuery(document).ready(function(){ HERE - Foswiki::Func::addToZone('body', "JQUERYPLUGIN::GRID::$gridId", $jsTemplate, 'JQUERYPLUGIN::GRID'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', "JQUERYPLUGIN::GRID::$gridId", $jsTemplate, 'JQUERYPLUGIN::GRID'); my $result = "
"; $result .= "
" if $thePager eq 'on'; diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugin.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugin.pm index fc0c28b362..1a9f500058 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugin.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugin.pm @@ -18,6 +18,7 @@ package Foswiki::Plugins::JQueryPlugin::Plugin; use Foswiki::Plugins::JQueryPlugin::Plugins (); use strict; +use warnings; =begin TML @@ -120,9 +121,9 @@ sub init { } } - Foswiki::Func::addToZone('head', "JQUERYPLUGIN::".uc($this->{name}), $header, join(', ', @dependencies)) + Foswiki::Plugins::JQueryPlugin::ourAddToZone('head', "JQUERYPLUGIN::".uc($this->{name}), $header, join(', ', @dependencies)) if $header; - Foswiki::Func::addToZone('body', "JQUERYPLUGIN::".uc($this->{name}), $footer, join(', ', @dependencies)) + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', "JQUERYPLUGIN::".uc($this->{name}), $footer, join(', ', @dependencies)) if $footer; return 1; diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm index 285e7fe8a2..30edb42e45 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/Plugins.pm @@ -13,6 +13,7 @@ package Foswiki::Plugins::JQueryPlugin::Plugins; use strict; +use warnings; our @iconSearchPath; our %iconCache; @@ -61,7 +62,7 @@ sub init () { $footer .= "\n" if $Foswiki::cfg{JQueryPlugin}{NoConflict}; - Foswiki::Func::addToZone('body', 'JQUERYPLUGIN', $footer); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', 'JQUERYPLUGIN', $footer); # initial plugins createPlugin('Foswiki'); # this one is needed anyway diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TOGGLE.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TOGGLE.pm index 70e1f428c3..b3323e7bb5 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TOGGLE.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/TOGGLE.pm @@ -15,6 +15,7 @@ package Foswiki::Plugins::JQueryPlugin::TOGGLE; use strict; +use warnings; use base 'Foswiki::Plugins::JQueryPlugin::Plugin'; =begin TML @@ -95,7 +96,7 @@ sub handleToggle { my $cmd = "function() {\$('$theTarget').each(function() {\$(this).is(':visible')?\$(this).$showEffect:\$(this).$hideEffect;});return false;}"; my $toggleId = "jqToggle".Foswiki::Plugins::JQueryPlugin::Plugins::getRandom(); - Foswiki::Func::addToZone("head", "JQUERYPLUGIN::TOGGLE::$toggleId", <<"HERE", 'JQUERYPLUGIN::TOGGLE'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone("head", "JQUERYPLUGIN::TOGGLE::$toggleId", <<"HERE", 'JQUERYPLUGIN::TOGGLE'); HERE diff --git a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/VALIDATE.pm b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/VALIDATE.pm index 6ebeb248ae..fd0b800d80 100644 --- a/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/VALIDATE.pm +++ b/JQueryPlugin/lib/Foswiki/Plugins/JQueryPlugin/VALIDATE.pm @@ -15,6 +15,7 @@ package Foswiki::Plugins::JQueryPlugin::VALIDATE; use strict; +use warnings; use base 'Foswiki::Plugins::JQueryPlugin::Plugin'; @@ -72,7 +73,7 @@ sub init { my $messageFile = $Foswiki::cfg{PubDir}.'/'.$messagePath; if (-f $messageFile) { $header .= "\n"; - Foswiki::Func::addToZone('body', "JQUERYPLUGIN::VALIDATE::LANG", $header, 'JQUERYPLUGIN::VALIDATE'); + Foswiki::Plugins::JQueryPlugin::ourAddToZone('body', "JQUERYPLUGIN::VALIDATE::LANG", $header, 'JQUERYPLUGIN::VALIDATE'); } }