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