return isInlineScriptCheck(facesContext, DJCONFIG_INITKEY);
}
public static void addMainInclude(FacesContext facesContext, UIComponent component, String javascriptLocation, DojoConfig config) throws IOException {
AddResource addResource = AddResourceFactory.getInstance(facesContext);
/*
* var djConfig = { isDebug: false }; TODO add a saner handling of
* collecting all djconfig data and then merging it
*/
if (!isInlineScriptSet(facesContext, DJCONFIG_INITKEY)) {
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, DJCONFIG_INITKEY);
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, config.toString());
String dojofile = ((getExpanded(facesContext) != null) && getExpanded(facesContext).booleanValue()) ? DOJO_FILE_UNCOMPRESSED : DOJO_FILE;
if (javascriptLocation != null) {
addResource.addJavaScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javascriptLocation + dojofile);
} else {
/*
* ResponseWriter writer = facesContext.getResponseWriter();
* writer.startElement(HTML.SCRIPT_ELEM,component);
*
* MyFacesResourceHandler handler = new
* MyFacesResourceHandler(DojoResourceLoader.class, dojofile);
* String uri = handler.getResourceUri(facesContext); uri =
* uri.replaceAll("dojo\\.js\\;jsessionid(.)*\\\"","dojo.js");
* writer.writeAttribute(HTML.SRC_ATTR, uri, null);
*
* writer.endElement(HTML.SCRIPT_ELEM);
* addResource.addJavaScriptAtPosition(facesContext,
* AddResource.HEADER_BEGIN, DojoResourceLoader.class,
* dojofile);
*/
addResource.addJavaScriptAtPositionPlain(facesContext, AddResource.HEADER_BEGIN, DojoResourceLoader.class, dojofile);
}
addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, DOJOEXTENSIONS_NAMESPACE);
}
}