You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Brett Birschbach <br...@nsighttel.com> on 2008/06/07 00:16:37 UTC
Re: Antwort: Re: Problems Tomahawk / Extensionsfilter / Facelets /
XHTML / CDATA / JSCookMenu
First off, I would like to say THANK YOU THANK YOU THANK YOU Marcus.
Your tips were invaluable in helping me get jscookmenu working with tomahawk
1.1.6. I don't think I would have been able to figure it out without your
help.
I followed steps 1 and 2 verbatim.
However, I found an alternative solution that covers steps 3 and 4, and is
potentially future proof against tomahawk 1.1.7 where the check for fc==null
returns false.
See the following code in:
org.apache.myfaces.custom.navmenu.jscookmenu.HtmlJSCookMenuRenderer
==========================================================================
if ((imageLocation != null) || (themeLocation != null)) {
// Generate a javascript variable containing a reference to the
// directory containing theme image files, for use by the theme
// javascript file. If neither of these is defined (ie a custom
// theme was specified but no imageLocation) then presumably the
// theme.js file uses some other mechanism to determine where
// its image files are.
StringBuffer buf = new StringBuffer();
buf.append("var my");
buf.append(themeName);
buf.append("Base='");
ExternalContext externalContext = context.getExternalContext();
if (imageLocation != null) {
buf.append(externalContext.encodeResourceURL(addResource.getResourceUri(context,
imageLocation + "/" + themeName)));
}
else {
buf.append(externalContext.encodeResourceURL(addResource.getResourceUri(context,
HtmlJSCookMenuRenderer.class, themeLocation)));
}
buf.append("';");
// XXX THIS IS A HACK TO MAKE JSCOOKMENU WORK
buf.insert(0, "//-->\n//<![CDATA[\n");
buf.append("\n//]]>\n<!--\n");
// END HACK
addResource.addInlineScriptAtPosition(context,
AddResource.HEADER_BEGIN, buf.toString());
}
=========================================================================
The two line hack results in HTML that looks like the following:
<script type="text/javascript"><!--
//-->
//<![CDATA[
var
myThemeOfficeBase='/Portal/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/12127889/navmenu.jscookmenu.HtmlJSCookMenuRenderer/ThemeOffice/';
//]]>
<!--
//--></script>
Firefox 2.0.0.14, IE 6.0.2900.2180..., and Opera 9.27 all appear to be able
to read the myThemeOfficeBase variable.
Good luck to the next sorry soul that hits this issue!
-Brett Birschbach
Marcus Schmidke wrote:
>
> Hello Dirk,
>
> I did not really solve the problem, but I figured out the causes and
> constructed some workarounds.
>
> Part of the problems are solved with current Tomahawk 1.1.7 Snapshot, but
> only part, so I turned back to 1.1.6 and applied the following patches.
>
> All patches affect files in the tomahawk-1.1.6.jar. If you put
> tomahawk-1.1.6.jar in the WEB-INF/lib folder, it is simply sufficient to
> put the
> patched files in the WEB-INF/classes folder which will take precedence. So
> you don't have to patch the jarfile itself, if you don't want to.
>
> ...
>
> Good luck!
>
> Marcus.
>
>
--
View this message in context: http://www.nabble.com/Problems-Tomahawk---Extensionsfilter---Facelets---XHTML---CDATA---JSCookMenu-tp13172753p17702222.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.