diff --git a/dashboard-ui/movies.html b/dashboard-ui/movies.html index 88eac124bd..a97c258e1a 100644 --- a/dashboard-ui/movies.html +++ b/dashboard-ui/movies.html @@ -40,7 +40,7 @@
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 7aa544efdc..5673048b72 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -665,7 +665,7 @@ cssClass += ' ' + options.shape + 'PosterItem'; - html += ''; + html += ''; // Ribbon if (item.MediaType == "Video" && options.formatIndicators) { diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js index f95219a413..e7e7da346b 100644 --- a/dashboard-ui/scripts/librarylist.js +++ b/dashboard-ui/scripts/librarylist.js @@ -166,6 +166,27 @@ function onMenuCommand(command, elem) { var id = elem.getAttribute('data-itemid'); + var page = $(elem).parents('.page'); + + if (command == 'SplitVersions') { + splitVersions(id, page); + } + } + + function splitVersions(id, page) { + + Dashboard.showLoadingMsg(); + + $.ajax({ + type: "DELETE", + url: ApiClient.getUrl("Videos/" + id + "/AlternateVersions") + + }).done(function () { + + Dashboard.hideLoadingMsg(); + + $('.itemsContainer', page).trigger('needsrefresh'); + }); } function getContextMenuOptions(elem) { @@ -173,7 +194,6 @@ var items = []; var id = elem.getAttribute('data-itemid'); - var mediatype = elem.getAttribute('data-mediatype'); items.push({ type: 'header', text: 'Edit' }); @@ -181,12 +201,12 @@ items.push({ type: 'link', text: 'Images', url: 'edititemimages.html?id=' + id }); - //if (mediatype == 'Video' && elem.getAttribute('data-locationtype') == 'FileSystem' && !elem.getAttribute('data-primaryversionid')) { + if (elem.getAttribute('data-alternateversioncount') != '0') { - // items.push({ type: 'divider' }); - // items.push({ type: 'header', text: 'Manage' }); - // items.push({ type: 'command', text: 'Alternate Versions', name: 'AlternateVersions' }); - //} + items.push({ type: 'divider' }); + items.push({ type: 'header', text: 'Manage' }); + items.push({ type: 'command', text: 'Split Versions', name: 'SplitVersions' }); + } return items; } @@ -260,11 +280,11 @@ if (user.Configuration.IsAdministrator) { - //sequence.createContextMenu({ - // getOptions: getContextMenuOptions, - // command: onMenuCommand, - // selector: '.posterItem' - //}); + sequence.createContextMenu({ + getOptions: getContextMenuOptions, + command: onMenuCommand, + selector: '.posterItem' + }); } }); @@ -290,6 +310,8 @@ selectionCommands.show(); $('.itemSelectionPanel', page).show(); + + $('.chkItemSelect:checked', page).checked(false).checkboxradio('refresh'); } Dashboard.hideLoadingMsg(); @@ -301,25 +323,25 @@ $('.itemSelectionPanel', page).hide(); } - + function getSelectedItems(page) { - + var selection = $('.chkItemSelect:checked', page); return selection.parents('.posterItem') - .map(function() { + .map(function () { return this.getAttribute('data-itemid'); }).get(); } - + function combineVersions(page) { var selection = getSelectedItems(page); - + if (selection.length < 2) { - + Dashboard.alert({ message: "Please select two or more items to combine.", title: "Error" @@ -328,7 +350,36 @@ return; } - hideSelections(); + var names = $('.chkItemSelect:checked', page).parents('.posterItem').get().reverse().map(function (e) { + + return $('.posterItemText', e).html(); + + }).join('