-
1. Re: Integrate Dojo
trong.tran Aug 3, 2010 10:34 PM (in response to funkybreizh)The definition in the gateIn-resources.xml does not support such thing for you.
But absolutely there is another way to do that by using the "Setting Markup Head Element" feature in JSR-286. That is in your portlet's rendering, you could have something like following to add the head HTML script element :
Element script = response.createElement("script"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", "../../_static/js/dojo/dojo.js"); script.setAttribute("djConfig", "parseOnLoad: true"); response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, script);
Let me know if it works for you
-
2. Re: Integrate Dojo
funkybreizh Aug 4, 2010 4:22 AM (in response to trong.tran)Yes it works, thank you.
But, it's not a "good" solution, because I will have to do this in each portlet. If I could change the portal template, it will be better...
Thanks for the tip
-
3. Re: Integrate Dojo
trong.tran Aug 4, 2010 5:24 AM (in response to funkybreizh)Yes, the changing of portal template may be a better solution in your case now but be careful when you upgrade to a new GateIn version later. So it's not really good solution neither in my opinion
BTW, you could address a JIRA issue for support the attributes definition for the HTML script tag in gatein-resources.xml if you expect it
-
4. Re: Integrate Dojo
funkybreizh Sep 23, 2010 2:03 PM (in response to trong.tran)I just want to add that I have an init.jsp file and all my portlet include it.
In there is :
<script type="text/javascript">
dojo.require("dojo.parser");
dojo.addOnLoad(function(){
dojo.parser.parse();
});
var theme = 'soria';
if(!dojo.hasClass(dojo.body(),theme)) {
dojo.addClass(dojo.body(),theme);
}
</script>But when there are many portlets on the page, this script is execute many times and I'm not sure that's good. I feel like sometimes it's slow.
Is there no solution for integrating Dojo!!
-
5. Re: Integrate Dojo
trong.tran Sep 24, 2010 4:56 AM (in response to funkybreizh)In your case, there is a simple solution is to use a flag variable to check whether the script will be executed or not.
-
6. Re: Integrate Dojo
funkybreizh Nov 27, 2010 6:33 AM (in response to funkybreizh)Hi, my problem isn't finished yet, It used to work but now I run the portal with "./gateIn run" and the portal generate a merged.js, and now I have lot's of javascript error with exo portal javascript (with menu, button etc). When I run with Eclipse, all js file where separate, with the merged.js it doesn't work at all!!!
I don't understand why?!
-
7. Re: Integrate Dojo
trong.tran Nov 27, 2010 10:08 AM (in response to funkybreizh)I do not perfectly understand your use case, so it's hard to imagine what problem you are having.
Basically when you start GateIn, you can set the variable -Dexo.product.developing=[ true | false ] to specify whether all js files configured in gatein-resources.xml are merged into one or not
-
8. Re: Integrate Dojo
funkybreizh Nov 27, 2010 10:53 AM (in response to trong.tran)Yes, I just discover that! Under eclipse I used to run with -Dexo.product.developing=true and it worked fine.
In gatein.bat it's -Dexo.product.developing=false and GateIn merge all the JS files declare in gatein-resource.xml, and it doesn't work with Dojo...
But I will let the parameter to "true"