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

Polish the loading of the MathJax plugin (replace None by undefined).

Polish the documentation of appbase.js
parent 6d2fbc0a
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ App.REMOTE_API = {
'actions': %s
};
App.storeCfgs = %s;
App.mathJax = '%s/MathJax.js'; """
App.mathJax = %s; """
def call():
......@@ -168,9 +168,13 @@ def get_api():
for table in cfgSvc.get_tables()['tables']:
storeCfgs[table] = cfgSvc.get_jsonstore(table)
# determine if the MathJax plugin is there
# 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,
......@@ -178,7 +182,7 @@ def get_api():
app,
json.dumps(di),
json.dumps(storeCfgs),
str(p_mathjax))
p_mathjax)
# return the response as a javascript
response.headers['Content-Type'] = 'text/javascript'
......
......@@ -21,15 +21,17 @@ Ext.namespace('App');
/**
* @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.
* The path of the MathJax.js script.
* It is equal to undefined if it does not exist.
* This constants is defined by the server and should not be used directly.
* The plugin should be loaded with the function App.loadMathJax.
*/
/**
* Helper function mimicking the encode_field function running on the server
* (table, field) → TableField
* @param {Object} table
* @param {Object} field
* @param {String} table
* @param {String} field
*/
App.encodeField = function (table, field) {
var t, f;
......@@ -42,13 +44,12 @@ App.encodeField = function (table, field) {
* Helper function returning the App.data.DirectStore identifies by its id.
* If the store does not exit it is created and register in the store manager.
*
* NOTE: The storeId is defined by the server as a configuration option
* for each widget: combobox, form and grid.
* NOTE: The storeId is defined by the server for each widget.
* The syntax of the storeId is "tableStore".
* If the store does not exist, its configuration is extract from
* the application constant App.storeCfgs.Then it is created and registered.
* In the current frame work a unique store is associated to a database table.
* This property garanty that widget share the same store.
* This property guaranty that widget share the same store.
*
* @param {String} storeId
*/
......@@ -116,11 +117,15 @@ App.isPlugin = function (component, ptype) {
/**
* Helper function to load the MathJax library
* @param {Object} callback
* The loading is an asynchronous operation.
* When finished the function callback is executed.
* If the library is not there the callback is executed to.
* @param {Function} callback
* @param {Object} scope scope for the callback
*/
App.loadMathJax = function (callback, scope) {
if (App.mathJax !== 'None') {
if (App.mathJax) {
Ext.Loader.load([App.mathJax], callback, scope);
} else {
......
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