Skip to content
Snippets Groups Projects
Commit 8fcfea72 authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 11.5 to OpenOLAT 12.1 with f8aaf01e31148055615156cad9a9da0ff18b57d8

parents 24ce5517 288f895b
No related branches found
No related tags found
No related merge requests found
......@@ -52,29 +52,30 @@ function o_start() {
o_info.initialPageLoadFinished = true;
}
function o_mathjax(fct_success) {
jQuery.ajax("${r.mathJaxCdn()}MathJax.js?config=TeX-AMS-MML_HTMLorMML", {
window.MathJax = {
extensions: ["jsMath2jax.js"],
messageStyle: 'none',
showProcessingMessages: false,
showMathMenu: false,
menuSettings: { },
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
},
"HTML-CSS": {
EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100
},
"fast-preview": {
disabled: true
}
}
jQuery.ajax("${r.mathJaxCdn()}MathJax.js?config=${r.mathJaxConfig()}", {
cache: true,
dataType: "script",
crossDomain: true,
success: function() {
MathJax.Hub.Config({
extensions: ["jsMath2jax.js"],
messageStyle: 'none',
showProcessingMessages: false,
showMathMenu: false,
menuSettings: { },
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
},
"HTML-CSS": {
EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100
},
"fast-preview": {
disabled: true
}
});
if(!(typeof fct_success === "undefined")) {
fct_success();
}
......@@ -369,4 +370,4 @@ jQuery(function() {
o_initEmPxFactor();
});
/* ]]> */
</script></div></body></html>
\ No newline at end of file
</script></div></body></html>
......@@ -597,33 +597,9 @@ public class IFrameDeliveryMapper implements Mapper {
appendStaticJs("js/prototype/prototype.js");
}
/*
MathJax.Hub.Config({
extensions: ["jsMath2jax.js"],
messageStyle: 'none',
showProcessingMessages: false,
showMathMenu: false,
menuSettings: { },
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
},
"HTML-CSS": {
EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100
},
"fast-preview": {
disabled: true
}
});
*/
public void appendJsMath() {
append("<script type=\"text/javascript\" src=\"");
append(WebappHelper.getMathJaxCdn());
append("MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>\n");
append("<script type=\"text/javascript\">\n");
append("MathJax.Hub.Config({\n");
append("window.MathJax = {\n");
append(" extensions: [\"jsMath2jax.js\"],\n");
append(" messageStyle: 'none',\n");
append(" showProcessingMessages: false,\n");
......@@ -641,8 +617,13 @@ public class IFrameDeliveryMapper implements Mapper {
append(" \"fast-preview\": {\n");
append(" disabled: true\n");
append(" }\n");
append("});");
append("};");
append("</script>");
append("<script type=\"text/javascript\" src=\"");
append(WebappHelper.getMathJaxCdn());
append("MathJax.js?config=");
append(WebappHelper.getMathJaxConfig());
append("\"></script>\n");
}
public void appendGlossary() {
......
......@@ -366,6 +366,12 @@ public class VelocityRenderDecorator implements Closeable {
}
return sb;
}
public StringOutput mathJaxConfig() {
StringOutput sb = new StringOutput(100);
sb.append(WebappHelper.getMathJaxConfig());
return sb;
}
public StringOutput contextPath() {
StringOutput sb = new StringOutput(100);
......
......@@ -76,6 +76,7 @@ public class WebappHelper implements Initializable, Destroyable, ServletContextA
private static long timeOfServerStartup = System.currentTimeMillis();
private static String mathJaxCdn;
private static String mathJaxConfig;
private static String mobileContext;
/** need to set this at least once before the actual request, since we cannot extract it from the servletContext,
......@@ -304,6 +305,14 @@ public class WebappHelper implements Initializable, Destroyable, ServletContextA
WebappHelper.mathJaxCdn = mathJaxCdn;
}
public static String getMathJaxConfig() {
return mathJaxConfig;
}
public void setMathJaxConfig(String mathJaxConfig) {
WebappHelper.mathJaxConfig = mathJaxConfig;
}
public void setFullPathToSrc(String fullPathToSrc) {
File path = new File(fullPathToSrc);
if (path.exists()) {
......
......@@ -48,6 +48,7 @@
<property name="applicationName" value="${application.name}" />
<property name="mobileContext" value="${mobile.context}" />
<property name="mathJaxCdn" value="${mathjax.cdn}"/>
<property name="mathJaxConfig" value="${mathjax.config}"/>
</bean>
<bean id="org.olat.core.helpers.Settings" class="org.olat.core.helpers.Settings" depends-on="org.olat.core.util.WebappHelper">
......
......@@ -26,29 +26,30 @@ function setFlexiFormDirtyByListener(e){
//
}
function o_mathjax() {
jQuery.ajax("${r.mathJaxCdnFullUrl()}MathJax.js?config=TeX-AMS-MML_HTMLorMML", {
window.MathJax = {
extensions: ["jsMath2jax.js"],
messageStyle: 'none',
showProcessingMessages: false,
showMathMenu: false,
menuSettings: { },
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
},
"HTML-CSS": {
EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100
},
"fast-preview": {
disabled: true
}
}
jQuery.ajax("${r.mathJaxCdnFullUrl()}MathJax.js?config=${r.mathJaxConfig()}", {
cache: true,
dataType: "script",
crossDomain: true,
success: function() {
MathJax.Hub.Config({
extensions: ["jsMath2jax.js"],
messageStyle: 'none',
showProcessingMessages: false,
showMathMenu: false,
menuSettings: { },
jsMath2jax: {
preview: "none"
},
tex2jax: {
ignoreClass: "math"
},
"HTML-CSS": {
EqnChunk: 5, EqnChunkFactor: 1, EqnChunkDelay: 100
},
"fast-preview": {
disabled: true
}
});
}
});
}
......@@ -70,4 +71,4 @@ jQuery(function() {
<body class="o_page_margins">
<div id="o_main">$r.render("results")</div>
</body>
</html>
\ No newline at end of file
</html>
......@@ -45,6 +45,7 @@ import org.olat.core.gui.components.form.flexible.impl.elements.FileElementEvent
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.util.StringHelper;
import org.olat.core.util.Util;
import org.olat.core.util.WebappHelper;
import org.olat.core.util.vfs.LocalFileImpl;
......@@ -164,8 +165,30 @@ public class CatalogEntryEditController extends FormBasicController {
public void setElementCssClass(String cssClass) {
flc.setElementCssClass(cssClass);
}
@Override
protected boolean validateFormLogic(UserRequest ureq) {
boolean allOk = true;
nameEl.clearError();
if(StringHelper.containsNonWhitespace(nameEl.getValue())) {
if(nameEl.getValue().length() > 99) {
nameEl.setErrorKey("input.toolong", new String[]{ "100" });
allOk &= false;
}
} else {
nameEl.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
styleEl.clearError();
if(!styleEl.isOneSelected()) {
styleEl.setErrorKey("form.legende.mandatory", null);
allOk &= false;
}
return allOk & super.validateFormLogic(ureq);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
......
......@@ -537,6 +537,7 @@ allow.cross.origin.domain.values=*,www.frentix.com
########################################################################
mathjax.cdn=//mathjax.openolat.org/mathjax/2.7-latest/
mathjax.config=TeX-AMS-MML_HTMLorMML
########################################################################
# Database settings
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment