diff --git a/generic_data/Functions/constants.xml b/generic_data/Functions/constants.xml index 3ef8e17..4e06465 100755 --- a/generic_data/Functions/constants.xml +++ b/generic_data/Functions/constants.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<constants> +<constants xml:id="constants"> <constant info="astronomical unit" name="AU" units="m" kind="space">1.49598e+11</constant> <constant info="Boltzmann constant" name="k" units="J/K" kind="physics">1.38054e-23</constant> <constant info="kelvin to electron-volt" name="K2eV" units="eV/K" kind="units">8.622e-5</constant> diff --git a/generic_data/Functions/functions.xml b/generic_data/Functions/functions.xml index 049cade..862861d 100644 --- a/generic_data/Functions/functions.xml +++ b/generic_data/Functions/functions.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<functions> +<functions xml:id="functions"> <function name="mean_(,)" args="1" kind="time"> <prompt>input averaging time in secs</prompt> <info_brief>average</info_brief> @@ -88,11 +88,11 @@ <prompt/> <info_brief>GSE to SM transformation</info_brief> </function>--> - <function name="cross(,)" params="2" kind="vectors"> + <function name="cross(,)" args="2" kind="vectors"> <info_brief>Cross product</info_brief> <new_kernel>cross</new_kernel> </function> - <function name="dot(,)" params="2" kind="vectors"> + <function name="dot(,)" args="2" kind="vectors"> <info_brief>Dot product</info_brief> <new_kernel>dot</new_kernel> </function> diff --git a/js/app/models/Function.js b/js/app/models/Function.js index a116196..ad3c865 100644 --- a/js/app/models/Function.js +++ b/js/app/models/Function.js @@ -15,9 +15,8 @@ Ext.define('amdaModel.Function', { fields : [ {name: 'name', mapping: '@name', type:'string'}, {name: 'kind', mapping: '@kind', type: 'string', defaultValue: 'amda'}, - {name: 'args', mapping: '@args', type: 'int', defaultValue: 0}, + {name: 'args', mapping: '@args', type: 'int', defaultValue: 1}, {name: 'argv', mapping: '@argv', type: 'string'}, - {name: 'params', mapping: '@params', type:'int', defaultValue: 1}, {name: 'prompt', type: 'string', defaultValue: ''}, {name: 'info_brief', type: 'string', defaultValue: ''} ], @@ -37,4 +36,4 @@ Ext.define('amdaModel.Function', { record: 'function' } } -}); \ No newline at end of file +}); diff --git a/js/app/views/CalculatorUI.js b/js/app/views/CalculatorUI.js index 687415a..334c9da 100644 --- a/js/app/views/CalculatorUI.js +++ b/js/app/views/CalculatorUI.js @@ -189,7 +189,7 @@ Ext.define('amdaUI.CalculatorUI', { processFormula : function(sel,currentBtn, params, afterParamsText){ // calculation of the required number of parameters - var nbParams = currentBtn.initialConfig.params; + var nbParams = currentBtn.initialConfig.args; var fnText = currentBtn.text.split('('); var newConstruction = sel.beforeText + fnText[0]+"("; // if there at least one parameter selected @@ -210,7 +210,7 @@ Ext.define('amdaUI.CalculatorUI', { // If we haven't the right number of selected parameters if (params.length < nbParams){ - var stringParamRequired = currentBtn.initialConfig.params+" parameter(s)"; + var stringParamRequired = currentBtn.initialConfig.args+" parameter(s)"; Ext.Msg.alert('Caution', 'you\'ll have to add '+ stringParamRequired +' to apply this function', function(){ // set Caret Position at placement of required parameter in function @@ -446,7 +446,6 @@ Ext.define('amdaUI.CalculatorUI', { { text: f.get('name'), args: f.get('args'), - params: f.get('params'), prompt: f.get('prompt'), tooltip: f.get('info_brief'), scope: this, @@ -466,8 +465,9 @@ Ext.define('amdaUI.CalculatorUI', { Ext.Msg.alert("Invalid Selection", "Action aborted"); } else { +console.log(params.length); // calculation of the required number of parameters - var nbParams = b.initialConfig.params; + var nbParams = b.initialConfig.args; if (params.length>nbParams) { -- libgit2 0.21.2