Commit 1defb142 authored by Julia Radzhabova's avatar Julia Radzhabova

[SSE] В FormulaDialog добавлено описание функций.

Список аргументов и описание функций перенесены в отдельные файлы и грузятся на стороне интерфейса, на стороне сдк грузятся только переводы имен функций.
parent 30e77f80
......@@ -100,6 +100,11 @@ define([
return this;
},
setMode: function(mode) {
this.mode = mode;
return this;
},
onLaunch: function () {
this.formulasGroups = this.getApplication().getCollection('FormulaGroups');
},
......@@ -132,6 +137,11 @@ define([
allFunctionsGroup = null;
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 ({
name : 'All',
index : index,
......@@ -160,11 +170,13 @@ define([
functions = [];
for (j = 0; j < ascFunctions.length; j += 1) {
var funcname = ascFunctions[j].asc_getName();
var func = new SSE.Models.FormulaModel({
index : funcInd,
group : ascGroupName,
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;
......
......@@ -645,7 +645,7 @@ define([
var formulasDlgController = application.getController('FormulaDialog');
if (formulasDlgController) {
formulasDlgController.setApi(me.api);
formulasDlgController.setMode(me.appOptions).setApi(me.api);
}
if (me.needToUpdateVersion)
toolbarController.onApiCoAuthoringDisconnect();
......
......@@ -56,7 +56,7 @@ define([
_options = {};
_.extend(_options, {
width : 300,
width : 310,
height : 490,
contentWidth : 390,
header : true,
......@@ -75,7 +75,8 @@ define([
'<label class="header" style="margin-top:10px">' + t.textListDescription + '</label>',
'<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>',
......@@ -101,6 +102,7 @@ define([
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.syntaxLabel = $('#formula-dlg-args');
this.descLabel = $('#formula-dlg-desc');
this.translationTable = {};
......@@ -201,6 +203,7 @@ define([
if (func) {
this.applyFunction = func.get('name');
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.syntaxLabel.text(this.applyFunction + functions[0].get('args'));
this.descLabel.text(functions[0].get('desc'));
this.cmbListFunctions.scroller.update({
minScrollbarLength : 40,
alwaysVisibleY : true
......
......@@ -37,7 +37,8 @@ define([
SSE.Views = SSE.Views || {};
SSE.Views.FormulaLang = new(function() {
var langJson = {};
var langJson = {},
langDescJson = {};
var _createXMLHTTPObject = function() {
var xmlhttp;
......@@ -82,8 +83,40 @@ define([
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 {
get: _get
get: _get,
getDescription: _getDescription
};
})();
});
......@@ -2,7 +2,7 @@
.combo-functions {
width: 100%;
height: 242px;
height: 184px;
overflow: hidden;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment