2013-05-21 13:36:26 -07:00
|
|
|
|
(function ($, document, window) {
|
|
|
|
|
|
|
|
|
|
function loadPage(page, config) {
|
|
|
|
|
|
2015-01-26 09:47:15 -07:00
|
|
|
|
if (config.MergeMetadataAndImagesByName) {
|
|
|
|
|
$('.fldImagesByName', page).hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('.fldImagesByName', page).show();
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-24 08:01:53 -07:00
|
|
|
|
$('#txtSeasonZeroName', page).val(config.SeasonZeroDisplayName);
|
|
|
|
|
|
2015-09-03 10:01:51 -07:00
|
|
|
|
$('#selectEnableRealtimeMonitor', page).val(config.EnableLibraryMonitor);
|
2014-01-29 13:30:26 -07:00
|
|
|
|
|
2016-02-11 11:29:32 -07:00
|
|
|
|
page.querySelector('#chkEnableAudioArchiveFiles').checked = config.EnableAudioArchiveFiles;
|
|
|
|
|
page.querySelector('#chkEnableVideoArchiveFiles').checked = config.EnableVideoArchiveFiles;
|
2015-01-09 22:53:35 -07:00
|
|
|
|
|
2013-05-21 13:36:26 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-07 18:23:56 -07:00
|
|
|
|
function onSubmit() {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
|
|
|
|
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
|
|
|
|
|
|
2015-06-14 10:55:42 -07:00
|
|
|
|
config.EnableLibraryMonitor = $('#selectEnableRealtimeMonitor', form).val();
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
2016-02-11 11:29:32 -07:00
|
|
|
|
config.EnableAudioArchiveFiles = form.querySelector('#chkEnableAudioArchiveFiles').checked;
|
|
|
|
|
config.EnableVideoArchiveFiles = form.querySelector('#chkEnableVideoArchiveFiles').checked;
|
2015-06-07 18:23:56 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
2015-06-07 18:23:56 -07:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Disable default form submission
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-24 10:08:10 -07:00
|
|
|
|
$(document).on('pageshow', "#librarySettingsPage", function () {
|
2013-05-21 13:36:26 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getServerConfiguration().then(function (config) {
|
2013-05-21 13:36:26 -07:00
|
|
|
|
|
|
|
|
|
loadPage(page, config);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2015-09-01 07:01:59 -07:00
|
|
|
|
}).on('pageinit', "#librarySettingsPage", function () {
|
2014-07-19 21:46:29 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-06-07 18:23:56 -07:00
|
|
|
|
$('.librarySettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
2015-10-03 11:13:53 -07:00
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
ApiClient.getSystemInfo().then(function (systemInfo) {
|
2015-10-03 11:13:53 -07:00
|
|
|
|
|
|
|
|
|
if (systemInfo.SupportsLibraryMonitor) {
|
|
|
|
|
page.querySelector('.fldLibraryMonitor').classList.remove('hide');
|
|
|
|
|
} else {
|
|
|
|
|
page.querySelector('.fldLibraryMonitor').classList.add('hide');
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-06-07 18:23:56 -07:00
|
|
|
|
});
|
2013-05-21 13:36:26 -07:00
|
|
|
|
|
|
|
|
|
})(jQuery, document, window);
|