2013-07-29 21:49:20 +02:00
|
|
|
Refine.SetLanguageUI = function(elmt) {
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
elmt.html(DOM.loadHTML("core", "scripts/index/lang-settings-ui.html"));
|
|
|
|
|
|
|
|
this._elmt = elmt;
|
|
|
|
this._elmts = DOM.bind(elmt);
|
|
|
|
|
2018-11-21 18:30:00 +01:00
|
|
|
this._elmts.or_lang_label.text($.i18n('core-index-lang/label')+":");
|
|
|
|
this._elmts.set_lan_btn.attr("value", $.i18n('core-index-lang/send-req'));
|
2013-07-29 21:49:20 +02:00
|
|
|
|
2013-09-18 19:16:24 +02:00
|
|
|
|
|
|
|
$.ajax({
|
2014-12-03 14:52:06 +01:00
|
|
|
url : "command/core/get-languages?",
|
2013-09-18 19:16:24 +02:00
|
|
|
type : "GET",
|
|
|
|
async : false,
|
|
|
|
data : {
|
|
|
|
name : "module",
|
|
|
|
value : "core"
|
|
|
|
},
|
|
|
|
success : function(data) {
|
|
|
|
for( var i = 0; i < data.languages.length; i++) {
|
|
|
|
var l = data.languages[i];
|
|
|
|
$('<option>').val(l.code).text(l.label).appendTo('#langDD');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2013-07-29 21:49:20 +02:00
|
|
|
this._elmts.set_lan_btn.bind('click', function(e) {
|
2019-10-14 15:28:00 +02:00
|
|
|
Refine.wrapCSRF(function(token) {
|
|
|
|
$.ajax({
|
|
|
|
url : "command/core/set-preference?",
|
|
|
|
type : "POST",
|
|
|
|
async : false,
|
|
|
|
data : {
|
|
|
|
name : "userLang",
|
|
|
|
value : JSON.stringify($("#langDD option:selected").val()),
|
|
|
|
csrf_token: token
|
|
|
|
},
|
|
|
|
success : function(data) {
|
|
|
|
alert($.i18n('core-index-lang/page-reload'));
|
|
|
|
location.reload(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2013-07-29 21:49:20 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
Refine.SetLanguageUI.prototype.resize = function() {
|
|
|
|
};
|
|
|
|
|
|
|
|
Refine.actionAreas.push({
|
|
|
|
id : "lang-settings",
|
2018-11-21 18:30:00 +01:00
|
|
|
label : $.i18n('core-index-lang/lang-settings'),
|
2013-07-29 21:49:20 +02:00
|
|
|
uiClass : Refine.SetLanguageUI
|
|
|
|
});
|