* @see org.olat.core.gui.components.Component#validate(org.olat.core.gui.UserRequest,
* org.olat.core.gui.render.ValidationResult)
*/
public void validate(UserRequest ureq, ValidationResult vr) {
super.validate(ureq, vr);
JSAndCSSAdder jsa = vr.getJsAndCSSAdder();
// Add tiny helper library
jsa.addRequiredJsFile(RichTextElementComponent.class,
"js/BTinyHelper.js", "UTF-8");
// When the tiny_mce.js is inserted via AJAX, we need to setup some
// variables first to make it load properly:
StringBuffer sb = new StringBuffer();
// 1) Use tinyMCEPreInit to prevent TinyMCE to guess the script URL. The
// script URL is needed because TinyMCE will load CSS, plugins and other
// resources
sb.append("tinyMCEPreInit = {};");
sb.append("tinyMCEPreInit.suffix = '';");
sb.append("tinyMCEPreInit.base = '");
sb.append(jsa.getMappedPathFor(RichTextElementComponent.class,
"js/tinymce"));
sb.append("';");
// 2) Tell TinyMCE that the page has already been loaded
sb.append("tinyMCE_GZ = {};");
sb.append("tinyMCE_GZ.loaded = true;");
String preAJAXinsertionCode = sb.toString();
// Now add tiny library itself. TinyMCE files are written in iso-8859-1
// (important, IE panics otherwise with error 8002010)
if (Settings.isDebuging()) {
jsa.addRequiredJsFile(RichTextElementComponent.class,
"js/tinymce/tiny_mce_src.js", "ISO-8859-1",
preAJAXinsertionCode);
} else {
jsa.addRequiredJsFile(RichTextElementComponent.class,
"js/tinymce/tiny_mce.js", "ISO-8859-1", preAJAXinsertionCode);
}
}