';
@@ -731,7 +733,7 @@
var chkItemSelectId = 'chkItemSelect' + i;
// Render this pre-enhanced to save on jquery mobile dom manipulation
- html += '
';
+ html += '
';
}
@@ -1158,21 +1160,6 @@
}
},
- getViewSummaryHtml: function (query, checkedSortOption) {
-
- var html = '';
-
- if (query.SortBy) {
-
- var id = checkedSortOption[0].id;
- var sortBy = checkedSortOption.siblings('label[for=' + id + ']').text();
-
- html += 'Sorted by ' + sortBy.trim().toLowerCase() + ', ' + (query.SortOrder || 'ascending').toLowerCase();
- }
-
- return html;
- },
-
getPagingHtml: function (query, totalRecordCount, updatePageSizeSetting, pageSizes, showLimit) {
if (query.Limit && updatePageSizeSetting !== false) {
diff --git a/dashboard-ui/scripts/librarylist.js b/dashboard-ui/scripts/librarylist.js
index f95219a413..adaba1bfa3 100644
--- a/dashboard-ui/scripts/librarylist.js
+++ b/dashboard-ui/scripts/librarylist.js
@@ -166,6 +166,34 @@
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.confirm("Are you sure you wish to split the versions apart into separate items?", "Split Versions Apart", function (confirmResult) {
+
+ if (confirmResult) {
+
+ Dashboard.showLoadingMsg();
+
+ $.ajax({
+ type: "DELETE",
+ url: ApiClient.getUrl("Videos/" + id + "/AlternateVersions")
+
+ }).done(function () {
+
+ Dashboard.hideLoadingMsg();
+
+ $('.itemsContainer', page).trigger('needsrefresh');
+ });
+ }
+ });
+
}
function getContextMenuOptions(elem) {
@@ -173,7 +201,6 @@
var items = [];
var id = elem.getAttribute('data-itemid');
- var mediatype = elem.getAttribute('data-mediatype');
items.push({ type: 'header', text: 'Edit' });
@@ -181,12 +208,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 Apart', name: 'SplitVersions' });
+ }
return items;
}
@@ -201,7 +228,7 @@
return;
}
- if ($('.itemSelectionPanel', elem).length) {
+ if ($('.itemSelectionPanel:visible', elem).length) {
return;
}
@@ -260,11 +287,11 @@
if (user.Configuration.IsAdministrator) {
- //sequence.createContextMenu({
- // getOptions: getContextMenuOptions,
- // command: onMenuCommand,
- // selector: '.posterItem'
- //});
+ sequence.createContextMenu({
+ getOptions: getContextMenuOptions,
+ command: onMenuCommand,
+ selector: '.posterItem'
+ });
}
});
@@ -290,6 +317,8 @@
selectionCommands.show();
$('.itemSelectionPanel', page).show();
+
+ $('.chkItemSelect:checked', page).checked(false).checkboxradio('refresh');
}
Dashboard.hideLoadingMsg();
@@ -301,25 +330,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 +357,36 @@
return;
}
- hideSelections();
+ var names = $('.chkItemSelect:checked', page).parents('.posterItem').get().reverse().map(function (e) {
+
+ return $('.posterItemText', e).html();
+
+ }).join('
');
+
+ var msg = "The following titles will be grouped into one item:
" + names;
+
+ msg += "
Media Browser clients will automatically choose the optimal version to play based on device and network performance. Are you sure you wish to continue?";
+
+ Dashboard.confirm(msg, "Group Versions", function (confirmResult) {
+
+ if (confirmResult) {
+
+ Dashboard.showLoadingMsg();
+
+ $.ajax({
+ type: "POST",
+ url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
+
+ }).done(function () {
+
+ Dashboard.hideLoadingMsg();
+
+ hideSelections();
+
+ $('.itemsContainer', page).trigger('needsrefresh');
+ });
+ }
+ });
}
$(document).on('pageinit', ".libraryPage", function () {
@@ -339,10 +397,6 @@
toggleSelections(page);
});
- $('.itemsContainer', page).on('listrender', function () {
- hideSelections(page);
- });
-
$('.btnMergeVersions', page).on('click', function () {
combineVersions(page);
});
diff --git a/dashboard-ui/scripts/moviecollections.js b/dashboard-ui/scripts/moviecollections.js
index ac9db18fc2..15fdc48755 100644
--- a/dashboard-ui/scripts/moviecollections.js
+++ b/dashboard-ui/scripts/moviecollections.js
@@ -28,9 +28,6 @@
if (result.TotalRecordCount) {
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
diff --git a/dashboard-ui/scripts/movies.js b/dashboard-ui/scripts/movies.js
index 2c635083c0..e670c38d59 100644
--- a/dashboard-ui/scripts/movies.js
+++ b/dashboard-ui/scripts/movies.js
@@ -29,9 +29,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
if (view == "Thumb") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
@@ -70,7 +67,7 @@
html += LibraryBrowser.getPagingHtml(query, result.TotalRecordCount);
- $('#items', page).html(html).trigger('create').createPosterItemMenus().trigger('listrender');
+ $('#items', page).html(html).trigger('create').createPosterItemMenus();
$('.btnNextPage', page).on('click', function () {
query.StartIndex += query.Limit;
@@ -345,6 +342,12 @@
reloadItems(page);
});
+ $('.itemsContainer', page).on('needsrefresh', function() {
+
+ reloadItems(page);
+
+ });
+
}).on('pagebeforeshow', "#moviesPage", function () {
var page = this;
diff --git a/dashboard-ui/scripts/movietrailers.js b/dashboard-ui/scripts/movietrailers.js
index 2b3f150fa5..e4364d0e4c 100644
--- a/dashboard-ui/scripts/movietrailers.js
+++ b/dashboard-ui/scripts/movietrailers.js
@@ -26,9 +26,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "portrait",
diff --git a/dashboard-ui/scripts/musicalbums.js b/dashboard-ui/scripts/musicalbums.js
index a8cdc6c399..45e4e2738a 100644
--- a/dashboard-ui/scripts/musicalbums.js
+++ b/dashboard-ui/scripts/musicalbums.js
@@ -28,9 +28,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
if (view == "Poster") {
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
diff --git a/dashboard-ui/scripts/musicvideos.js b/dashboard-ui/scripts/musicvideos.js
index 1df1ba34a4..2cc211b7cd 100644
--- a/dashboard-ui/scripts/musicvideos.js
+++ b/dashboard-ui/scripts/musicvideos.js
@@ -26,9 +26,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
html = LibraryBrowser.getPosterViewHtml({
items: result.Items,
shape: "square",
diff --git a/dashboard-ui/scripts/scheduledtaskpage.js b/dashboard-ui/scripts/scheduledtaskpage.js
index af1ebe5b51..a3f1e31022 100644
--- a/dashboard-ui/scripts/scheduledtaskpage.js
+++ b/dashboard-ui/scripts/scheduledtaskpage.js
@@ -102,11 +102,11 @@
hours = 0;
}
- hours = hours.toFixed(0);
+ hours = Math.floor(hours);
ticks -= (hours * 36000000000);
- var minutes = (ticks / 600000000).toFixed(0);
+ var minutes = Math.floor((ticks / 600000000));
var suffix = "am";
diff --git a/dashboard-ui/scripts/songs.js b/dashboard-ui/scripts/songs.js
index 774ab87f16..8dd595c3cc 100644
--- a/dashboard-ui/scripts/songs.js
+++ b/dashboard-ui/scripts/songs.js
@@ -47,9 +47,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
html += LibraryBrowser.getSongTableHtml(result.Items, {
showAlbum: true,
showArtist: true,
diff --git a/dashboard-ui/scripts/tvshows.js b/dashboard-ui/scripts/tvshows.js
index 1e1a8ca3ab..12cfa73aa4 100644
--- a/dashboard-ui/scripts/tvshows.js
+++ b/dashboard-ui/scripts/tvshows.js
@@ -28,9 +28,6 @@
updateFilterControls(page);
- var checkSortOption = $('.radioSortBy:checked', page);
- $('.viewSummary', page).html(LibraryBrowser.getViewSummaryHtml(query, checkSortOption)).trigger('create');
-
if (view == "Thumb") {
html = LibraryBrowser.getPosterViewHtml({
diff --git a/dashboard-ui/songs.html b/dashboard-ui/songs.html
index 7a81b6ea99..c496b09bee 100644
--- a/dashboard-ui/songs.html
+++ b/dashboard-ui/songs.html
@@ -22,11 +22,10 @@