diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 1d17706587a90bb62cf9d99170d5e6dd22926324..8ef6b644f4774c8e72b572630d4669de25f1282e 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -27,7 +27,7 @@ App.REMOTE_API = { 'actions': %s }; App.storeCfgs = %s; -App.withMathJax = %s; """ +App.mathJax = '%s/MathJax.js'; """ def call(): @@ -109,7 +109,7 @@ def debug(): """ # check the presence of the ExtJS plugin 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, ...) lg = dbui.get_language(globals()) @@ -169,10 +169,8 @@ def get_api(): storeCfgs[table] = cfgSvc.get_jsonstore(table) # determine if the MathJax plugin is there - server_path, client_path = dbui.get_reference_paths(globals()) - path = os.path.join(server_path, 'static', 'plugin_mathjax') - withMathJax = (True if os.path.exists(path) else False) - + p_mathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax') + # fill the javascript template app = request.application script = SCRIPT % (app, @@ -180,7 +178,7 @@ def get_api(): app, json.dumps(di), json.dumps(storeCfgs), - str(withMathJax).lower()) + str(p_mathjax)) # return the response as a javascript response.headers['Content-Type'] = 'text/javascript' @@ -220,7 +218,7 @@ def index(): """ # check the presence of the ExtJS plugin 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, ...) lg = dbui.get_language(globals()) diff --git a/static/plugin_dbui/src/appbase.js b/static/plugin_dbui/src/appbase.js index 5de09f6924f706a57649ffb3900890023ab4635f..046462e6841a186b57164ef213683bbf3931f029 100644 --- a/static/plugin_dbui/src/appbase.js +++ b/static/plugin_dbui/src/appbase.js @@ -20,8 +20,8 @@ Ext.namespace('App'); */ /** - * @cfg {Boolean} App.withMathJax - * The plugin plugin MathJax is present + * @cfg {Boolean} App.mathJax + * The path of the plugin MathJax. It is equal to None id not present. * This constants is defined by the server. */ @@ -119,7 +119,12 @@ App.isPlugin = function (component, ptype) { * @param {Object} callback */ 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); + } }; diff --git a/static/plugin_dbui/src/appmgr.js b/static/plugin_dbui/src/appmgr.js index 60215847c34a6d474ed23dbc832f39ab1e425d83..9cbc5ac777dc33b098112b8031f33f3a22af2ac3 100644 --- a/static/plugin_dbui/src/appmgr.js +++ b/static/plugin_dbui/src/appmgr.js @@ -29,11 +29,7 @@ App.Mgr = Ext.extend(Object, { App.Mgr.superclass.constructor.apply(this); // If the MathJax library is required load it - if (App.withMathJax) { - App.loadMathJax(this.configure, this); - } else { - this.configure(); - } + App.loadMathJax(this.configure, this); }, /**