diff --git a/controllers/plugin_dbui.py b/controllers/plugin_dbui.py index 9966de259a005ceb4f78b5f0af85c4353ca39dda..1ce0506fbd8502569decc7a707e11c489fbd8ddc 100644 --- a/controllers/plugin_dbui.py +++ b/controllers/plugin_dbui.py @@ -26,8 +26,7 @@ App.REMOTE_API = { 'type': 'remoting', 'actions': %s }; -App.storeCfgs = %s; -App.mathJax = %s; """ +App.storeCfgs = %s; """ def call(): @@ -107,9 +106,10 @@ def debug(): """ - # check the presence of the ExtJS plugin + # check the presence of the ExtJS and MathJax plugins dbui = local_import('plugin_dbui') pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs') + pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax') # internationalization (fr, fr-fr, fr-ca, ...) lg = dbui.get_language(globals()) @@ -135,7 +135,7 @@ def debug(): # return the ExtJS path, the language # and a list of files in response.files - return dict(pextjs=pextjs, lg=lg) + return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg) @@ -168,21 +168,13 @@ def get_api(): for table in cfgSvc.get_tables()['tables']: storeCfgs[table] = cfgSvc.get_jsonstore(table) - # the MathJax plugin - p_mathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax') - if p_mathjax: - p_mathjax = "'%s'" % os.path.join(p_mathjax, 'MathJax.js') - else: - p_mathjax = 'undefined' - # fill the javascript template app = request.application script = SCRIPT % (app, app, app, json.dumps(di), - json.dumps(storeCfgs), - p_mathjax) + json.dumps(storeCfgs)) # return the response as a javascript response.headers['Content-Type'] = 'text/javascript' @@ -220,10 +212,11 @@ def index(): is launched. """ - # check the presence of the ExtJS plugin + # check the presence of the ExtJS and MathJax plugins dbui = local_import('plugin_dbui') pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs') - + pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax') + # internationalization (fr, fr-fr, fr-ca, ...) lg = dbui.get_language(globals()) @@ -243,9 +236,8 @@ def index(): # switch off the debug mode on the server side session.debug = False - # return the ExtJS path, the language - # and a list of files in response.files - return dict(pextjs=pextjs, lg=lg) + # return the ExtJS, MathJax paths and the language + return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg) def status(): diff --git a/views/plugin_dbui/debug.html b/views/plugin_dbui/debug.html index f8d61490bd696312f1eb3f4c4e84e24d5727af2b..c9691cfd563e3abda2ac56c5b50d68b33dfc7a2c 100644 --- a/views/plugin_dbui/debug.html +++ b/views/plugin_dbui/debug.html @@ -9,7 +9,22 @@ <meta name="description" content="{{=response.description}}" /> <title>{{=request.application}}</title> - + + <!-- mathjax library --> + <script type="text/x-mathjax-config"> + MathJax.Hub.Config({ + extensions: ["tex2jax.js"], + jax: ["input/TeX", "output/HTML-CSS"], + tex2jax: { + inlineMath: [ ['$','$'], ["\\(","\\)"] ], + displayMath: [ ['$$','$$'], ["\\[","\\]"] ], + processEscapes: true + }, + "HTML-CSS": { availableFonts: ["TeX"] } + }); + </script> + <script type="text/javascript" src="{{=pmathjax}}/MathJax.js"></script> + <!-- extjs css --> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.css"/> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/> diff --git a/views/plugin_dbui/index.html b/views/plugin_dbui/index.html index b4040d6536dd5c015c5d940e447998236d0b2575..0a12a147c550f4df30d47963af84b4fd71117c3b 100644 --- a/views/plugin_dbui/index.html +++ b/views/plugin_dbui/index.html @@ -9,7 +9,22 @@ <meta name="description" content="{{=response.description}}" /> <title>{{=request.application}}</title> - + + <!-- mathjax library --> + <script type="text/x-mathjax-config"> + MathJax.Hub.Config({ + extensions: ["tex2jax.js"], + jax: ["input/TeX", "output/HTML-CSS"], + tex2jax: { + inlineMath: [ ['$','$'], ["\\(","\\)"] ], + displayMath: [ ['$$','$$'], ["\\[","\\]"] ], + processEscapes: true + }, + "HTML-CSS": { availableFonts: ["TeX"] } + }); + </script> + <script type="text/javascript" src="{{=pmathjax}}/MathJax.js"></script> + <!-- extjs css --> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.css"/> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/>