[SE mobile] Fix bug 34144
This commit is contained in:
parent
0a49c21e78
commit
986ddd4edb
|
|
@ -58,13 +58,15 @@ define([
|
|||
],
|
||||
|
||||
initialize: function () {
|
||||
Common.NotificationCenter.on('addcontainer:show', _.bind(this.initEvents, this));
|
||||
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
|
||||
var me = this;
|
||||
|
||||
this.addListeners({
|
||||
Common.NotificationCenter.on('addcontainer:show', _.bind(me.initEvents, me));
|
||||
Common.NotificationCenter.on('document:ready', _.bind(me.onDocumentReady, me));
|
||||
|
||||
me.addListeners({
|
||||
'AddFunction': {
|
||||
'function:insert': this.onInsertFunction.bind(this),
|
||||
'function:info': this.onFunctionInfo.bind(this)
|
||||
'function:insert': me.onInsertFunction.bind(me),
|
||||
'function:info': me.onFunctionInfo.bind(me)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
@ -75,12 +77,6 @@ define([
|
|||
|
||||
onLaunch: function () {
|
||||
this.createView('AddFunction').render();
|
||||
|
||||
var me = this;
|
||||
_.defer(function () {
|
||||
me.api.asc_setLocalization(fc);
|
||||
me.fillFunctions.call(me);
|
||||
});
|
||||
},
|
||||
|
||||
initEvents: function () {
|
||||
|
|
@ -90,35 +86,67 @@ define([
|
|||
var me = this;
|
||||
|
||||
_.defer(function () {
|
||||
me.api.asc_setLocalization(fc);
|
||||
me.fillFunctions.call(me);
|
||||
var editorLang = SSE.getController("Main").editorConfig.lang;
|
||||
|
||||
var localizationFunctions = function(data) {
|
||||
fc = data;
|
||||
me.api.asc_setLocalization(fc);
|
||||
me.fillFunctions.call(me);
|
||||
};
|
||||
|
||||
$.getJSON(Common.Utils.String.format("{0}/{1}.json", "resources/l10n/functions", editorLang), function(json) {
|
||||
localizationFunctions(json);
|
||||
}).fail(function() {
|
||||
localizationFunctions(fc);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
fillFunctions: function() {
|
||||
var functions = {};
|
||||
var jsonDescr = JSON.parse(fd);
|
||||
var me = this,
|
||||
functions = {},
|
||||
editorLang = SSE.getController("Main").editorConfig.lang;
|
||||
|
||||
var grouparr = this.api.asc_getFormulasInfo();
|
||||
for (var g in grouparr) {
|
||||
var group = grouparr[g];
|
||||
var groupname = group.asc_getGroupName();
|
||||
var funcarr = group.asc_getFormulasArray();
|
||||
var localizationFunctionsDesc = function (data) {
|
||||
var jsonDesc = {},
|
||||
view = me.getView('AddFunction');
|
||||
|
||||
for (var f in funcarr) {
|
||||
var func = funcarr[f];
|
||||
var _name = func.asc_getName();
|
||||
functions[_name] = {
|
||||
type: _name,
|
||||
group: groupname,
|
||||
caption: func.asc_getLocaleName(),
|
||||
args: jsonDescr[_name].a || '',
|
||||
descr: jsonDescr[_name].d || ''
|
||||
};
|
||||
fd = data;
|
||||
|
||||
try {
|
||||
jsonDesc = JSON.parse(fd);
|
||||
} catch (e) {
|
||||
jsonDesc = fd
|
||||
}
|
||||
}
|
||||
|
||||
this.getView('AddFunction').setFunctions(functions);
|
||||
var grouparr = me.api.asc_getFormulasInfo();
|
||||
for (var g in grouparr) {
|
||||
var group = grouparr[g];
|
||||
var groupname = group.asc_getGroupName();
|
||||
var funcarr = group.asc_getFormulasArray();
|
||||
|
||||
for (var f in funcarr) {
|
||||
var func = funcarr[f];
|
||||
var _name = func.asc_getName();
|
||||
functions[_name] = {
|
||||
type: _name,
|
||||
group: groupname,
|
||||
caption: func.asc_getLocaleName(),
|
||||
args: jsonDesc[_name].a || '',
|
||||
descr: jsonDesc[_name].d || ''
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
view.setFunctions(functions);
|
||||
view.render();
|
||||
};
|
||||
|
||||
$.getJSON(Common.Utils.String.format("{0}/{1}_desc.json", "resources/l10n/functions", editorLang), function(json) {
|
||||
localizationFunctionsDesc(json);
|
||||
}).fail(function() {
|
||||
localizationFunctionsDesc(fd);
|
||||
});
|
||||
},
|
||||
|
||||
onInsertFunction: function (type) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
<div id="add-function-group">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= textBack %></span><% } %></a></div>
|
||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||
<div class="center sliding"><%= groupname %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
<div id="add-function-info">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= textBack %></span><% } %></a></div>
|
||||
<div class="left sliding"><a href="#" class="back link"><i class="icon icon-back"></i><% if (!android) { %><span><%= scope.textBack %></span><% } %></a></div>
|
||||
<div class="center sliding"><%= caption %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ define([
|
|||
android : Common.SharedSettings.get('android'),
|
||||
phone : Common.SharedSettings.get('phone'),
|
||||
view : viewid,
|
||||
textBack : 'Back'
|
||||
scope : this
|
||||
};
|
||||
|
||||
_.extend(_params, args);
|
||||
|
|
@ -94,6 +94,8 @@ define([
|
|||
|
||||
// Render layout
|
||||
render: function () {
|
||||
var me = this;
|
||||
|
||||
var quickFunctions = [
|
||||
{caption: 'SUM', type: 'SUM'},
|
||||
{caption: 'MIN', type: 'MIN'},
|
||||
|
|
@ -101,24 +103,30 @@ define([
|
|||
{caption: 'COUNT', type: 'COUNT'}
|
||||
];
|
||||
|
||||
this.groups = {
|
||||
'DateAndTime': this.sCatDateAndTime,
|
||||
'Engineering': this.sCatEngineering,
|
||||
'TextAndData': this.sCatTextAndData,
|
||||
'Statistical': this.sCatStatistical,
|
||||
'Financial': this.sCatFinancial,
|
||||
'Mathematic': this.sCatMathematic,
|
||||
'LookupAndReference': this.sCatLookupAndReference,
|
||||
'Information': this.sCatInformation,
|
||||
'Logical': this.sCatLogical
|
||||
if (me.functions) {
|
||||
_.each(quickFunctions, function (quickFunction) {
|
||||
quickFunction.caption = me.functions[quickFunction.type].caption
|
||||
});
|
||||
}
|
||||
|
||||
me.groups = {
|
||||
'DateAndTime': me.sCatDateAndTime,
|
||||
'Engineering': me.sCatEngineering,
|
||||
'TextAndData': me.sCatTextAndData,
|
||||
'Statistical': me.sCatStatistical,
|
||||
'Financial': me.sCatFinancial,
|
||||
'Mathematic': me.sCatMathematic,
|
||||
'LookupAndReference': me.sCatLookupAndReference,
|
||||
'Information': me.sCatInformation,
|
||||
'Logical': me.sCatLogical
|
||||
};
|
||||
|
||||
this.layout = $('<div/>').append(_.template(this.template, {
|
||||
me.layout = $('<div/>').append(_.template(me.template, {
|
||||
android : Common.SharedSettings.get('android'),
|
||||
phone : Common.SharedSettings.get('phone'),
|
||||
textGroups : this.textGroups,
|
||||
textGroups : me.textGroups,
|
||||
quick : quickFunctions,
|
||||
groups : this.groups,
|
||||
groups : me.groups,
|
||||
view : 'root'
|
||||
}));
|
||||
|
||||
|
|
@ -180,6 +188,7 @@ define([
|
|||
},
|
||||
|
||||
textGroups: 'CATEGORIES',
|
||||
textBack: 'Back',
|
||||
sCatLogical: 'Logical',
|
||||
// sCatCube: 'Cube',
|
||||
// sCatDatabase: 'Database',
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@
|
|||
"SSE.Views.AddFunction.sCatStatistical": "Statistisch",
|
||||
"SSE.Views.AddFunction.sCatTextAndData": "Text und Daten",
|
||||
"SSE.Views.AddFunction.textGroups": "Kategorien",
|
||||
"SSE.Views.AddFunction.textBack": "Zurück",
|
||||
"SSE.Views.AddLink.textAddLink": "Link hinzufügen",
|
||||
"SSE.Views.AddLink.textAddress": "Adresse",
|
||||
"SSE.Views.AddLink.textDisplay": "Anzeigen",
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@
|
|||
"SSE.Views.AddFunction.sCatStatistical": "Statistical",
|
||||
"SSE.Views.AddFunction.sCatTextAndData": "Text and data",
|
||||
"SSE.Views.AddFunction.textGroups": "Categories",
|
||||
"SSE.Views.AddFunction.textBack": "Back",
|
||||
"SSE.Views.AddLink.textAddLink": "Add Link",
|
||||
"SSE.Views.AddLink.textAddress": "Address",
|
||||
"SSE.Views.AddLink.textDisplay": "Display",
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@
|
|||
"SSE.Views.AddFunction.sCatStatistical": "Statistiques",
|
||||
"SSE.Views.AddFunction.sCatTextAndData": "Texte et données",
|
||||
"SSE.Views.AddFunction.textGroups": "Catégories",
|
||||
"SSE.Views.AddFunction.textBack": "Retour",
|
||||
"SSE.Views.AddLink.textAddLink": "Ajouter le lien",
|
||||
"SSE.Views.AddLink.textAddress": "Adresse",
|
||||
"SSE.Views.AddLink.textDisplay": "Afficher",
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@
|
|||
"SSE.Views.AddFunction.sCatStatistical": "Статистические",
|
||||
"SSE.Views.AddFunction.sCatTextAndData": "Текст и данные",
|
||||
"SSE.Views.AddFunction.textGroups": "Категории",
|
||||
"SSE.Views.AddFunction.textBack": "Назад",
|
||||
"SSE.Views.AddLink.textAddLink": "Добавить ссылку",
|
||||
"SSE.Views.AddLink.textAddress": "Адрес",
|
||||
"SSE.Views.AddLink.textDisplay": "Отображать",
|
||||
|
|
|
|||
Loading…
Reference in a new issue