2013-02-20 18:33:05 -07:00
|
|
|
|
var MetadataConfigurationPage = {
|
|
|
|
|
|
|
|
|
|
onPageShow: function () {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
var config;
|
|
|
|
|
var allCultures;
|
|
|
|
|
var allCountries;
|
|
|
|
|
|
|
|
|
|
ApiClient.getServerConfiguration().done(function (result) {
|
|
|
|
|
|
|
|
|
|
config = result;
|
|
|
|
|
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ApiClient.getCultures().done(function (result) {
|
|
|
|
|
|
2013-12-28 09:58:13 -07:00
|
|
|
|
Dashboard.populateLanguages($('#selectLanguage', page), result);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
allCultures = result;
|
|
|
|
|
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ApiClient.getCountries().done(function (result) {
|
|
|
|
|
|
2013-12-28 09:58:13 -07:00
|
|
|
|
Dashboard.populateCountries($('#selectCountry', page), result);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
allCountries = result;
|
|
|
|
|
MetadataConfigurationPage.load(page, config, allCultures, allCountries);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
load: function (page, config, allCultures, allCountries) {
|
|
|
|
|
|
|
|
|
|
if (!config || !allCultures || !allCountries) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#chkSaveLocal', page).checked(config.SaveLocalMeta).checkboxradio("refresh");
|
|
|
|
|
$('#selectLanguage', page).val(config.PreferredMetadataLanguage).selectmenu("refresh");
|
|
|
|
|
$('#selectCountry', page).val(config.MetadataCountryCode).selectmenu("refresh");
|
2013-07-25 13:59:28 -07:00
|
|
|
|
$('#chkEnableInternetProviders', page).checked(config.EnableInternetProviders).checkboxradio("refresh");
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onSubmit: function () {
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2013-04-16 21:58:32 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
ApiClient.getServerConfiguration().done(function (config) {
|
|
|
|
|
|
|
|
|
|
config.EnableInternetProviders = $('#chkEnableInternetProviders', form).checked();
|
|
|
|
|
config.SaveLocalMeta = $('#chkSaveLocal', form).checked();
|
|
|
|
|
config.PreferredMetadataLanguage = $('#selectLanguage', form).val();
|
|
|
|
|
config.MetadataCountryCode = $('#selectCountry', form).val();
|
|
|
|
|
|
2013-04-16 21:58:32 -07:00
|
|
|
|
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
2013-02-20 18:33:05 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$(document).on('pageshow', "#metadataConfigurationPage", MetadataConfigurationPage.onPageShow);
|