Item9836: JavascriptFiles/foswikiPref
doesn't always get expanded
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
From the
TwistyPlugin/TWISTY.pm
JQueryPlugin module. Is it possible that
foswiki.tmpl
isn't necessarily loaded at the time that
JQueryPlugin/TwistyPlugin is executing the
Foswiki::Func::expandTemplate
? My understanding of template/init order is a bit hazy here...
Patch for our
NatSkin site:
diff --git a/TopicUserMappingContrib/data/System/DefaultUserRegistration.txt b/TopicUserMappingContrib/data/System/DefaultUserRegistration.txt
index 35db765..6584445 100755
--- a/TopicUserMappingContrib/data/System/DefaultUserRegistration.txt
+++ b/TopicUserMappingContrib/data/System/DefaultUserRegistration.txt
@@ -121,7 +121,7 @@ text="<style type='text/css' media='all'>
color:#f00;
}
</style>"
-}%%TMPL:P{JavascriptFiles/foswikiString"}%%ENDSECTION{"form"}%
+}%%TMPL:P{"JavascriptFiles/foswikiString"}%%ENDSECTION{"form"}%
diff --git a/TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/TWISTY.pm b/TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/TWISTY.pm
index 915ffcd..4b28b0c 100644
--- a/TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/TWISTY.pm
+++ b/TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/TWISTY.pm
@@ -45,7 +45,13 @@ sub new {
my $foswikiPrefs =
Foswiki::Func::expandTemplate('JavascriptFiles/foswikiPref');
- Foswiki::Func::expandCommonVariables($foswikiPrefs);
+ Foswiki::Func::expandCommonVariables(<<'HERE');
+%ADDTOZONE{
+ "script" id="JavascriptFiles/foswikiPref"
+ requires="JQUERYPLUGIN::FOSWIKI"
+ text="<script type=\"text/javascript\" src=\"%PUBURLPATH%/%SYSTEMWEB%/JavascriptFiles/foswikiPref%FWSRC%.js\"></script>"
+}%
+HERE
return $this;
}
--
PaulHarvey - 17 Oct 2010
I should clarify: the symptom is a JS error 'foswiki.Pref is undefined' (along those lines) and there is no sign of any
JavascriptFiles/foswikiPref
def having been expanded in the rendered HTML
--
PaulHarvey - 17 Oct 2010
Michael, as the
NatSkin author, I am wondering if you have observed this problem too?
(I have some other
NatSkin hacks to make it work on 1.1 - maybe there is something else I've done wrong)
--
PaulHarvey - 17 Oct 2010
NatSkin's next version vastly differs from the previous one. Will be released next week.
--
MichaelDaum - 17 Oct 2010
We have at least one other user on IRC describing the same symptom. I am concerned that the way that we are 'loading' foswikiPref in
TwistyPlugin, is insufficient. It is probably working on
PatternSkin because it loads foswikiPref for itself and doesn't rely on this code to get foswikIPref loaded.. Raising to normal.
--
PaulHarvey - 02 Nov 2010
This was listed for fix in 1.1.2, but no checkins. Is this still an issue? Bumped "ReleasedIn" to 1.1.4
--
GeorgeClark - 12 Mar 2011
I can't confirm the error anymore. If at all then this was a
NatSkin only error, not a
TwistyPlugin.
--
MichaelDaum - 12 Mar 2011