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

Modify controller and view in order to load the mathjax library as the other javascript libraries

parent 08607adb
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,7 @@ App.REMOTE_API = { ...@@ -26,8 +26,7 @@ App.REMOTE_API = {
'type': 'remoting', 'type': 'remoting',
'actions': %s 'actions': %s
}; };
App.storeCfgs = %s; App.storeCfgs = %s; """
App.mathJax = %s; """
def call(): def call():
...@@ -107,9 +106,10 @@ def debug(): ...@@ -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') dbui = local_import('plugin_dbui')
pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs') pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
# internationalization (fr, fr-fr, fr-ca, ...) # internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals()) lg = dbui.get_language(globals())
...@@ -135,7 +135,7 @@ def debug(): ...@@ -135,7 +135,7 @@ def debug():
# return the ExtJS path, the language # return the ExtJS path, the language
# and a list of files in response.files # 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(): ...@@ -168,21 +168,13 @@ def get_api():
for table in cfgSvc.get_tables()['tables']: for table in cfgSvc.get_tables()['tables']:
storeCfgs[table] = cfgSvc.get_jsonstore(table) 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 # fill the javascript template
app = request.application app = request.application
script = SCRIPT % (app, script = SCRIPT % (app,
app, app,
app, app,
json.dumps(di), json.dumps(di),
json.dumps(storeCfgs), json.dumps(storeCfgs))
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,10 +212,11 @@ def index(): ...@@ -220,10 +212,11 @@ def index():
is launched. is launched.
""" """
# check the presence of the ExtJS plugin # check the presence of the ExtJS and MathJax plugins
dbui = local_import('plugin_dbui') dbui = local_import('plugin_dbui')
pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs') pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
# internationalization (fr, fr-fr, fr-ca, ...) # internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals()) lg = dbui.get_language(globals())
...@@ -243,9 +236,8 @@ def index(): ...@@ -243,9 +236,8 @@ def index():
# switch off the debug mode on the server side # switch off the debug mode on the server side
session.debug = False session.debug = False
# return the ExtJS path, the language # return the ExtJS, MathJax paths and the language
# and a list of files in response.files return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg)
return dict(pextjs=pextjs, lg=lg)
def status(): def status():
......
...@@ -9,7 +9,22 @@ ...@@ -9,7 +9,22 @@
<meta name="description" content="{{=response.description}}" /> <meta name="description" content="{{=response.description}}" />
<title>{{=request.application}}</title> <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 --> <!-- extjs css -->
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.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"/> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/>
......
...@@ -9,7 +9,22 @@ ...@@ -9,7 +9,22 @@
<meta name="description" content="{{=response.description}}" /> <meta name="description" content="{{=response.description}}" />
<title>{{=request.application}}</title> <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 --> <!-- extjs css -->
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.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"/> <link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/>
......
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