Commit 457007f3 authored by Julia Radzhabova's avatar Julia Radzhabova

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

Список аргументов и описание функций перенесены в отдельные файлы и грузятся на стороне интерфейса, на стороне сдк грузятся только переводы имен функций.
parent 21e8aad2
......@@ -92,6 +92,11 @@ define([
return this;
},
setMode: function(mode) {
this.mode = mode;
return this;
},
onLaunch: function () {
this.formulasGroups = this.getApplication().getCollection('FormulaGroups');
},
......@@ -124,6 +129,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,
......@@ -152,11 +162,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;
......
......@@ -637,7 +637,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();
......
......@@ -48,7 +48,7 @@ define([
_options = {};
_.extend(_options, {
width : 300,
width : 310,
height : 490,
contentWidth : 390,
header : true,
......@@ -67,7 +67,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>',
......@@ -93,6 +94,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 = {};
......@@ -193,6 +195,7 @@ define([
if (func) {
this.applyFunction = func.get('name');
this.syntaxLabel.text(this.applyFunction + func.get('args'));
this.descLabel.text(func.get('desc'));
}
}
}
......@@ -291,6 +294,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
......
......@@ -29,7 +29,8 @@ define([
SSE.Views = SSE.Views || {};
SSE.Views.FormulaLang = new(function() {
var langJson = {};
var langJson = {},
langDescJson = {};
var _createXMLHTTPObject = function() {
var xmlhttp;
......@@ -74,8 +75,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