jellyfin-web/dashboard-ui/scripts/wizardsettings.js

77 lines
1.9 KiB
JavaScript
Raw Normal View History

2013-09-05 10:05:39 -07:00
(function ($, document) {
function save(page) {
Dashboard.showLoadingMsg();
2014-02-26 20:57:37 -07:00
// After saving chapter task, now save server config
ApiClient.getServerConfiguration().done(function (config) {
2013-09-05 10:05:39 -07:00
2014-02-26 20:57:37 -07:00
config.PreferredMetadataLanguage = $('#selectLanguage', page).val();
config.MetadataCountryCode = $('#selectCountry', page).val();
config.SaveLocalMeta = $('#chkSaveLocalMetadata', page).checked();
2013-09-05 10:05:39 -07:00
2014-03-05 22:17:13 -07:00
config.EnableInternetProviders = $('#chkEnableInternetProviders', page).checked();
2014-02-26 20:57:37 -07:00
ApiClient.updateServerConfiguration(config).done(function (result) {
2013-09-05 10:05:39 -07:00
2014-02-26 20:57:37 -07:00
navigateToNextPage();
2013-09-05 10:05:39 -07:00
2013-12-22 20:46:03 -07:00
});
});
}
2013-09-05 10:05:39 -07:00
2013-12-22 20:46:03 -07:00
function reloadData(page, config, cultures, countries) {
2013-12-28 09:58:13 -07:00
Dashboard.populateLanguages($('#selectLanguage', page), cultures);
Dashboard.populateCountries($('#selectCountry', page), countries);
2013-12-22 20:46:03 -07:00
$('#selectLanguage', page).val(config.PreferredMetadataLanguage).selectmenu("refresh");
$('#selectCountry', page).val(config.MetadataCountryCode).selectmenu("refresh");
2013-12-22 20:46:03 -07:00
Dashboard.hideLoadingMsg();
}
function reload(page) {
Dashboard.showLoadingMsg();
var promise1 = ApiClient.getServerConfiguration();
var promise2 = ApiClient.getCultures();
var promise3 = ApiClient.getCountries();
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
reloadData(page, response1[0], response2[0], response3[0]);
});
}
2013-12-22 20:46:03 -07:00
function navigateToNextPage() {
2013-09-05 10:05:39 -07:00
2013-12-22 20:46:03 -07:00
Dashboard.navigate('wizardimagesettings.html');
}
2013-09-05 10:05:39 -07:00
2013-12-22 20:46:03 -07:00
$(document).on('pageshow', "#wizardSettingsPage", function () {
2013-09-05 10:05:39 -07:00
2013-12-22 20:46:03 -07:00
var page = this;
reload(page);
2013-09-05 10:05:39 -07:00
});
2013-12-22 20:46:03 -07:00
window.WizardSettingsPage = {
onSubmit: function () {
var form = this;
save(form);
return false;
}
};
2013-09-05 10:05:39 -07:00
})(jQuery, document, window);