[SSE] В FormulaDialog добавлено описание функций.
Список аргументов и описание функций перенесены в отдельные файлы и грузятся на стороне интерфейса, на стороне сдк грузятся только переводы имен функций.
This commit is contained in:
parent
30e77f802b
commit
1defb142a9
|
@ -100,6 +100,11 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setMode: function(mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
onLaunch: function () {
|
onLaunch: function () {
|
||||||
this.formulasGroups = this.getApplication().getCollection('FormulaGroups');
|
this.formulasGroups = this.getApplication().getCollection('FormulaGroups');
|
||||||
},
|
},
|
||||||
|
@ -132,6 +137,11 @@ define([
|
||||||
allFunctionsGroup = null;
|
allFunctionsGroup = null;
|
||||||
|
|
||||||
if (store) {
|
if (store) {
|
||||||
|
var value = Common.localStorage.getItem("sse-settings-func-locale");
|
||||||
|
if (value===null)
|
||||||
|
value = ((this.mode.lang) ? this.mode.lang : 'en').split("-")[0].toLowerCase();
|
||||||
|
value = SSE.Views.FormulaLang.getDescription(value);
|
||||||
|
|
||||||
allFunctionsGroup = new SSE.Models.FormulaGroup ({
|
allFunctionsGroup = new SSE.Models.FormulaGroup ({
|
||||||
name : 'All',
|
name : 'All',
|
||||||
index : index,
|
index : index,
|
||||||
|
@ -160,11 +170,13 @@ define([
|
||||||
functions = [];
|
functions = [];
|
||||||
|
|
||||||
for (j = 0; j < ascFunctions.length; j += 1) {
|
for (j = 0; j < ascFunctions.length; j += 1) {
|
||||||
|
var funcname = ascFunctions[j].asc_getName();
|
||||||
var func = new SSE.Models.FormulaModel({
|
var func = new SSE.Models.FormulaModel({
|
||||||
index : funcInd,
|
index : funcInd,
|
||||||
group : ascGroupName,
|
group : ascGroupName,
|
||||||
name : ascFunctions[j].asc_getLocaleName(),
|
name : ascFunctions[j].asc_getLocaleName(),
|
||||||
args : ascFunctions[j].asc_getArguments()
|
args : (value && value[funcname]) ? value[funcname].a : '',
|
||||||
|
desc : (value && value[funcname]) ? value[funcname].d : ''
|
||||||
});
|
});
|
||||||
|
|
||||||
funcInd += 1;
|
funcInd += 1;
|
||||||
|
|
|
@ -645,7 +645,7 @@ define([
|
||||||
|
|
||||||
var formulasDlgController = application.getController('FormulaDialog');
|
var formulasDlgController = application.getController('FormulaDialog');
|
||||||
if (formulasDlgController) {
|
if (formulasDlgController) {
|
||||||
formulasDlgController.setApi(me.api);
|
formulasDlgController.setMode(me.appOptions).setApi(me.api);
|
||||||
}
|
}
|
||||||
if (me.needToUpdateVersion)
|
if (me.needToUpdateVersion)
|
||||||
toolbarController.onApiCoAuthoringDisconnect();
|
toolbarController.onApiCoAuthoringDisconnect();
|
||||||
|
|
|
@ -56,7 +56,7 @@ define([
|
||||||
_options = {};
|
_options = {};
|
||||||
|
|
||||||
_.extend(_options, {
|
_.extend(_options, {
|
||||||
width : 300,
|
width : 310,
|
||||||
height : 490,
|
height : 490,
|
||||||
contentWidth : 390,
|
contentWidth : 390,
|
||||||
header : true,
|
header : true,
|
||||||
|
@ -75,7 +75,8 @@ define([
|
||||||
|
|
||||||
'<label class="header" style="margin-top:10px">' + t.textListDescription + '</label>',
|
'<label class="header" style="margin-top:10px">' + t.textListDescription + '</label>',
|
||||||
'<div id="formula-dlg-combo-functions" class="combo-functions"/>',
|
'<div id="formula-dlg-combo-functions" class="combo-functions"/>',
|
||||||
'<label id="formula-dlg-args" style="margin-top: 10px">' + '</label>',
|
'<label id="formula-dlg-args" style="margin-top: 7px">' + '</label>',
|
||||||
|
'<label id="formula-dlg-desc" style="margin-top: 4px">' + '</label>',
|
||||||
|
|
||||||
'</div>',
|
'</div>',
|
||||||
'</div>',
|
'</div>',
|
||||||
|
@ -101,6 +102,7 @@ define([
|
||||||
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
|
|
||||||
this.syntaxLabel = $('#formula-dlg-args');
|
this.syntaxLabel = $('#formula-dlg-args');
|
||||||
|
this.descLabel = $('#formula-dlg-desc');
|
||||||
|
|
||||||
this.translationTable = {};
|
this.translationTable = {};
|
||||||
|
|
||||||
|
@ -201,6 +203,7 @@ define([
|
||||||
if (func) {
|
if (func) {
|
||||||
this.applyFunction = func.get('name');
|
this.applyFunction = func.get('name');
|
||||||
this.syntaxLabel.text(this.applyFunction + func.get('args'));
|
this.syntaxLabel.text(this.applyFunction + func.get('args'));
|
||||||
|
this.descLabel.text(func.get('desc'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,6 +302,7 @@ define([
|
||||||
this.applyFunction = functions[0].get('name');
|
this.applyFunction = functions[0].get('name');
|
||||||
|
|
||||||
this.syntaxLabel.text(this.applyFunction + functions[0].get('args'));
|
this.syntaxLabel.text(this.applyFunction + functions[0].get('args'));
|
||||||
|
this.descLabel.text(functions[0].get('desc'));
|
||||||
this.cmbListFunctions.scroller.update({
|
this.cmbListFunctions.scroller.update({
|
||||||
minScrollbarLength : 40,
|
minScrollbarLength : 40,
|
||||||
alwaysVisibleY : true
|
alwaysVisibleY : true
|
||||||
|
|
|
@ -37,7 +37,8 @@ define([
|
||||||
SSE.Views = SSE.Views || {};
|
SSE.Views = SSE.Views || {};
|
||||||
|
|
||||||
SSE.Views.FormulaLang = new(function() {
|
SSE.Views.FormulaLang = new(function() {
|
||||||
var langJson = {};
|
var langJson = {},
|
||||||
|
langDescJson = {};
|
||||||
|
|
||||||
var _createXMLHTTPObject = function() {
|
var _createXMLHTTPObject = function() {
|
||||||
var xmlhttp;
|
var xmlhttp;
|
||||||
|
@ -82,8 +83,40 @@ define([
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var _getDescription = function(lang) {
|
||||||
|
if (!lang) return '';
|
||||||
|
lang = lang.toLowerCase() ;
|
||||||
|
|
||||||
|
if (langDescJson[lang])
|
||||||
|
return langDescJson[lang];
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
var xhrObj = _createXMLHTTPObject();
|
||||||
|
if (xhrObj && lang) {
|
||||||
|
xhrObj.open('GET', 'resources/formula-lang/' + lang + '_desc.json', false);
|
||||||
|
xhrObj.send('');
|
||||||
|
if (xhrObj.status == 200)
|
||||||
|
langDescJson[lang] = eval("(" + xhrObj.responseText + ")");
|
||||||
|
else {
|
||||||
|
xhrObj.open('GET', 'resources/formula-lang/en_desc.json', false);
|
||||||
|
xhrObj.send('');
|
||||||
|
langDescJson[lang] = eval("(" + xhrObj.responseText + ")");
|
||||||
|
}
|
||||||
|
return langDescJson[lang];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
get: _get
|
get: _get,
|
||||||
|
getDescription: _getDescription
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
.combo-functions {
|
.combo-functions {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 242px;
|
height: 184px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue