From 767cdc1f6f6a63ce997fc9476911e2c361f9d402 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Wed, 20 Feb 2013 20:33:05 -0500 Subject: Pushing missing changes --- .../scripts/AdvancedMetadataConfigurationPage.js | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 MediaBrowser.WebDashboard/Html/scripts/AdvancedMetadataConfigurationPage.js (limited to 'MediaBrowser.WebDashboard/Html/scripts/AdvancedMetadataConfigurationPage.js') diff --git a/MediaBrowser.WebDashboard/Html/scripts/AdvancedMetadataConfigurationPage.js b/MediaBrowser.WebDashboard/Html/scripts/AdvancedMetadataConfigurationPage.js new file mode 100644 index 0000000000..73ed3f4311 --- /dev/null +++ b/MediaBrowser.WebDashboard/Html/scripts/AdvancedMetadataConfigurationPage.js @@ -0,0 +1,65 @@ +var AdvancedMetadataConfigurationPage = { + + onPageShow: function () { + + Dashboard.showLoadingMsg(); + + var page = this; + + var promise1 = ApiClient.getServerConfiguration(); + var promise2 = ApiClient.getItemTypes({ HasInternetProvider: true }); + + $.when(promise1, promise2).done(function (response1, response2) { + + AdvancedMetadataConfigurationPage.load(page, response1[0], response2[0]); + + }); + }, + + load: function (page, config, itemTypes) { + + AdvancedMetadataConfigurationPage.loadItemTypes(page, config, itemTypes); + Dashboard.hideLoadingMsg(); + }, + + loadItemTypes: function (page, configuration, types) { + + var html = '
'; + + for (var i = 0, length = types.length; i < length; i++) { + + var type = types[i]; + var id = "checkbox-" + i + "a"; + + var checkedAttribute = configuration.InternetProviderExcludeTypes.indexOf(type) != -1 ? ' checked="checked"' : ''; + + html += ''; + html += ''; + } + + html += "
"; + + $('#divItemTypes', page).html(html).trigger("create"); + }, + + onSubmit: function () { + Dashboard.showLoadingMsg(); + + var form = this; + + ApiClient.getServerConfiguration().done(function (config) { + + config.InternetProviderExcludeTypes = $.map($('.chkItemType:checked', form), function (currentCheckbox) { + + return currentCheckbox.getAttribute('data-itemtype'); + }); + + ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult); + }); + + // Disable default form submission + return false; + } +}; + +$(document).on('pageshow', "#advancedMetadataConfigurationPage", AdvancedMetadataConfigurationPage.onPageShow); \ No newline at end of file -- cgit v1.2.3