diff --git a/ApiClient.js b/ApiClient.js index 799c267eb2..2442141e6c 100644 --- a/ApiClient.js +++ b/ApiClient.js @@ -1714,6 +1714,22 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) { }); }; + self.updateItem = function (item) { + + if (!item) { + throw new Error("null item"); + } + + var url = self.getUrl("Items/" + item.Id); + + return self.ajax({ + type: "POST", + url: url, + data: JSON.stringify(item), + contentType: "application/json" + }); + }; + /** * Updates plugin security info */ diff --git a/dashboard-ui/scripts/edititemmetadata.js b/dashboard-ui/scripts/edititemmetadata.js index a1456f4f8c..74b6f69ef4 100644 --- a/dashboard-ui/scripts/edititemmetadata.js +++ b/dashboard-ui/scripts/edititemmetadata.js @@ -279,11 +279,59 @@ } function editItemMetadataPage() { + var self = this; self.onSubmit = function () { - Dashboard.alert('coming soon'); + var form = this; + + var item = { + + Id: getParameterByName('id'), + Name: $('#txtName', form).val(), + SortName: $('#txtSortName', form).val(), + DisplayMediaType: $('#txtDisplayMediaType', form).val(), + CommunityRating: $('#txtCommunityRating', form).val(), + HomePageUrl: $('#txtHomePageUrl', form).val(), + Budget: $('#txtBudget', form).val(), + Revenue: $('#txtRevenue', form).val(), + CriticRating: $('#txtCriticRating', form).val(), + CriticRatingSummary: $('#txtCriticRatingSummary', form).val(), + IndexNumber: $('#txtIndexNumber', form).val(), + ParentIndexNumber: $('#txtParentIndexNumber', form).val(), + Players: $('#txtPlayers', form).val(), + Album: $('#txtAlbum', form).val(), + AlbumArtist: $('#txtAlbumArtist', form).val(), + Artists: [$('#txtArtist', form).val()], + + PremiereDate: $('#txtPremiereDate', form).val(), + EndDate: $('#txtEndDate', form).val(), + ProductionYear: $('#txtProductionYear', form).val(), + AspectRatio: $('#txtOriginalAspectRatio', form).val(), + + Language: $('#selectLanguage', form).val(), + OfficialRating: $('#selectOfficialRating', form).val(), + CustomRating: $('#selectCustomRating', form).val(), + + ProviderIds: + { + Gamesdb: $('#txtGamesDb', form).val(), + Imdb: $('#txtImdb', form).val(), + Tmdb: $('#txtTmdb', form).val(), + Tvdb: $('#txtTvdb', form).val(), + Tvcom: $('#txtTvCom', form).val(), + Musicbrainz: $('#txtMusicBrainz', form).val(), + RottenTomatoes: $('#txtRottenTomatoes', form).val() + } + + }; + + ApiClient.updateItem(item).done(function () { + + Dashboard.alert('Item saved.'); + + }); return false; }; diff --git a/packages.config b/packages.config index fcfa61b2b6..b575b4c458 100644 --- a/packages.config +++ b/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file