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;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 20:57:37 -07:00
|
|
|
|
$('#chkEnableInternetProviders', page).checked(config.EnableInternetProviders).checkboxradio("refresh");
|
2013-02-20 18:33:05 -07:00
|
|
|
|
$('#chkSaveLocal', page).checked(config.SaveLocalMeta).checkboxradio("refresh");
|
|
|
|
|
$('#selectLanguage', page).val(config.PreferredMetadataLanguage).selectmenu("refresh");
|
|
|
|
|
$('#selectCountry', page).val(config.MetadataCountryCode).selectmenu("refresh");
|
|
|
|
|
|
2014-02-02 06:36:31 -07:00
|
|
|
|
$('#selectImageSavingConvention', page).val(config.ImageSavingConvention).selectmenu("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) {
|
|
|
|
|
|
2014-02-02 06:36:31 -07:00
|
|
|
|
config.ImageSavingConvention = $('#selectImageSavingConvention', form).val();
|
|
|
|
|
|
2014-02-26 20:57:37 -07:00
|
|
|
|
config.EnableInternetProviders = $('#chkEnableInternetProviders', form).checked();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
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);
|