MDL-48543 Mathjax: Update default config for JAWS Math player
authorDamyon Wiese <damyon@moodle.com>
Fri, 30 Jan 2015 06:36:46 +0000 (14:36 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 17 Feb 2015 02:54:12 +0000 (10:54 +0800)
JAWS Maths player does not recognise the math content when manually specifying the config for MathJax.
If you use one of the default config files it works.
So - we switch our config to the Accessible.js config that it is based off anyway.
There are no features changes with this approach.

Conflicts:
filter/mathjaxloader/version.php

filter/mathjaxloader/db/upgrade.php
filter/mathjaxloader/settings.php
filter/mathjaxloader/version.php

index 0d28495..fcbf7c1 100644 (file)
@@ -46,6 +46,47 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
 
     // Moodle v2.8.0 release upgrade line.
     // Put any upgrade step following this.
+    if ($oldversion < 2015013000) {
+
+        $oldconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
+        $olddefault = 'MathJax.Hub.Config({
+    config: ["MMLorHTML.js", "Safe.js"],
+    jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML"],
+    extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],
+    TeX: {
+        extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
+    },
+    menuSettings: {
+        zoom: "Double-Click",
+        mpContext: true,
+        mpMouse: true
+    },
+    errorSettings: { message: ["!"] },
+    skipStartupTypeset: true,
+    messageStyle: "none"
+});
+';
+        $newdefault = '
+MathJax.Hub.Config({
+    config: ["Accessible.js", "Safe.js"],
+    errorSettings: { message: ["!"] },
+    skipStartupTypeset: true,
+    messageStyle: "none"
+});
+';
+
+        // Ignore white space changes.
+        $oldconfig = trim(preg_replace('/\s+/', ' ', $oldconfig));
+        $olddefault = trim(preg_replace('/\s+/', ' ', $olddefault));
+
+        // Update the default config for mathjax only if it has not been customised.
+
+        if ($oldconfig == $olddefault) {
+            set_config('mathjaxconfig', $newdefault, 'filter_mathjaxloader');
+        }
+
+        upgrade_plugin_savepoint(true, 2015013000, 'filter', 'mathjaxloader');
+    }
 
     if ($oldversion < 2015021200) {
 
index 1ca7670..2c681f0 100644 (file)
@@ -52,17 +52,7 @@ if ($ADMIN->fulltree) {
 
     $default = '
 MathJax.Hub.Config({
-    config: ["MMLorHTML.js", "Safe.js"],
-    jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML"],
-    extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],
-    TeX: {
-        extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
-    },
-    menuSettings: {
-        zoom: "Double-Click",
-        mpContext: true,
-        mpMouse: true
-    },
+    config: ["Accessible.js", "Safe.js"],
     errorSettings: { message: ["!"] },
     skipStartupTypeset: true,
     messageStyle: "none"
index 21e2f19..a47e1cd 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version  = 2015021200;
+$plugin->version  = 2015021700;
 $plugin->requires = 2014110400;  // Requires this Moodle version
 $plugin->component= 'filter_mathjaxloader';