Skip to content
Snippets Groups Projects
Commit 6d2fbc0a authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Redesign the way we handle the plugin MathJax.

Replace the constant App.withMathJax by App.mathJax with is the path to the mathjax script.
Modified accordingly the function to load the library.
parent a703be42
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ App.REMOTE_API = { ...@@ -27,7 +27,7 @@ App.REMOTE_API = {
'actions': %s 'actions': %s
}; };
App.storeCfgs = %s; App.storeCfgs = %s;
App.withMathJax = %s; """ App.mathJax = '%s/MathJax.js'; """
def call(): def call():
...@@ -109,7 +109,7 @@ def debug(): ...@@ -109,7 +109,7 @@ def debug():
""" """
# check the presence of the ExtJS plugin # check the presence of the ExtJS plugin
dbui = local_import('plugin_dbui') dbui = local_import('plugin_dbui')
pextjs = dbui.get_extjs_path(globals()) pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
# internationalization (fr, fr-fr, fr-ca, ...) # internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals()) lg = dbui.get_language(globals())
...@@ -169,10 +169,8 @@ def get_api(): ...@@ -169,10 +169,8 @@ def get_api():
storeCfgs[table] = cfgSvc.get_jsonstore(table) storeCfgs[table] = cfgSvc.get_jsonstore(table)
# determine if the MathJax plugin is there # determine if the MathJax plugin is there
server_path, client_path = dbui.get_reference_paths(globals()) p_mathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
path = os.path.join(server_path, 'static', 'plugin_mathjax')
withMathJax = (True if os.path.exists(path) else False)
# fill the javascript template # fill the javascript template
app = request.application app = request.application
script = SCRIPT % (app, script = SCRIPT % (app,
...@@ -180,7 +178,7 @@ def get_api(): ...@@ -180,7 +178,7 @@ def get_api():
app, app,
json.dumps(di), json.dumps(di),
json.dumps(storeCfgs), json.dumps(storeCfgs),
str(withMathJax).lower()) str(p_mathjax))
# return the response as a javascript # return the response as a javascript
response.headers['Content-Type'] = 'text/javascript' response.headers['Content-Type'] = 'text/javascript'
...@@ -220,7 +218,7 @@ def index(): ...@@ -220,7 +218,7 @@ def index():
""" """
# check the presence of the ExtJS plugin # check the presence of the ExtJS plugin
dbui = local_import('plugin_dbui') dbui = local_import('plugin_dbui')
pextjs = dbui.get_extjs_path(globals()) pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
# internationalization (fr, fr-fr, fr-ca, ...) # internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals()) lg = dbui.get_language(globals())
......
...@@ -20,8 +20,8 @@ Ext.namespace('App'); ...@@ -20,8 +20,8 @@ Ext.namespace('App');
*/ */
/** /**
* @cfg {Boolean} App.withMathJax * @cfg {Boolean} App.mathJax
* The plugin plugin MathJax is present * The path of the plugin MathJax. It is equal to None id not present.
* This constants is defined by the server. * This constants is defined by the server.
*/ */
...@@ -119,7 +119,12 @@ App.isPlugin = function (component, ptype) { ...@@ -119,7 +119,12 @@ App.isPlugin = function (component, ptype) {
* @param {Object} callback * @param {Object} callback
*/ */
App.loadMathJax = function (callback, scope) { App.loadMathJax = function (callback, scope) {
var path = '/' + App.name + '/static/plugin_mathjax/MathJax.js';
Ext.Loader.load([path], callback, scope); if (App.mathJax !== 'None') {
Ext.Loader.load([App.mathJax], callback, scope);
} else {
callback.call(scope);
}
}; };
...@@ -29,11 +29,7 @@ App.Mgr = Ext.extend(Object, { ...@@ -29,11 +29,7 @@ App.Mgr = Ext.extend(Object, {
App.Mgr.superclass.constructor.apply(this); App.Mgr.superclass.constructor.apply(this);
// If the MathJax library is required load it // If the MathJax library is required load it
if (App.withMathJax) { App.loadMathJax(this.configure, this);
App.loadMathJax(this.configure, this);
} else {
this.configure();
}
}, },
/** /**
......
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