mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
easier user library setup
This commit is contained in:
parent
990e9a39c6
commit
22f629080c
16 changed files with 108 additions and 161 deletions
38
ApiClient.js
38
ApiClient.js
|
@ -1300,7 +1300,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the virtual folder for a view. Specify a userId to get a user view, or omit for the default view.
|
* Gets the virtual folder list
|
||||||
*/
|
*/
|
||||||
self.getVirtualFolders = function (userId) {
|
self.getVirtualFolders = function (userId) {
|
||||||
|
|
||||||
|
@ -1477,16 +1477,16 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a virtual folder from either the default view or a user view
|
* Removes a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.removeVirtualFolder = function (name, userId, refreshLibrary) {
|
self.removeVirtualFolder = function (name, refreshLibrary) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = "Library/VirtualFolders";
|
||||||
|
|
||||||
url = self.getUrl(url, {
|
url = self.getUrl(url, {
|
||||||
refreshLibrary: refreshLibrary ? true : false,
|
refreshLibrary: refreshLibrary ? true : false,
|
||||||
|
@ -1500,10 +1500,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a virtual folder to either the default view or a user view
|
* Adds a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addVirtualFolder = function (name, type, userId, refreshLibrary) {
|
self.addVirtualFolder = function (name, type, refreshLibrary) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
|
@ -1518,7 +1518,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
options.refreshLibrary = refreshLibrary ? true : false;
|
options.refreshLibrary = refreshLibrary ? true : false;
|
||||||
options.name = name;
|
options.name = name;
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = "Library/VirtualFolders";
|
||||||
|
|
||||||
url = self.getUrl(url, options);
|
url = self.getUrl(url, options);
|
||||||
|
|
||||||
|
@ -1529,18 +1529,16 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renames a virtual folder, within either the default view or a user view
|
* Renames a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.renameVirtualFolder = function (name, newName, userId, refreshLibrary) {
|
self.renameVirtualFolder = function (name, newName, refreshLibrary) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = "Library/VirtualFolders/Name";
|
||||||
|
|
||||||
url += "/Name";
|
|
||||||
|
|
||||||
url = self.getUrl(url, {
|
url = self.getUrl(url, {
|
||||||
refreshLibrary: refreshLibrary ? true : false,
|
refreshLibrary: refreshLibrary ? true : false,
|
||||||
|
@ -1555,10 +1553,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an additional mediaPath to an existing virtual folder, within either the default view or a user view
|
* Adds an additional mediaPath to an existing virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addMediaPath = function (virtualFolderName, mediaPath, userId, refreshLibrary) {
|
self.addMediaPath = function (virtualFolderName, mediaPath, refreshLibrary) {
|
||||||
|
|
||||||
if (!virtualFolderName) {
|
if (!virtualFolderName) {
|
||||||
throw new Error("null virtualFolderName");
|
throw new Error("null virtualFolderName");
|
||||||
|
@ -1568,9 +1566,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
throw new Error("null mediaPath");
|
throw new Error("null mediaPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = "Library/VirtualFolders/Paths";
|
||||||
|
|
||||||
url += "/Paths";
|
|
||||||
|
|
||||||
url = self.getUrl(url, {
|
url = self.getUrl(url, {
|
||||||
refreshLibrary: refreshLibrary ? true : false,
|
refreshLibrary: refreshLibrary ? true : false,
|
||||||
|
@ -1585,10 +1581,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a media path from a virtual folder, within either the default view or a user view
|
* Removes a media path from a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.removeMediaPath = function (virtualFolderName, mediaPath, userId, refreshLibrary) {
|
self.removeMediaPath = function (virtualFolderName, mediaPath, refreshLibrary) {
|
||||||
|
|
||||||
if (!virtualFolderName) {
|
if (!virtualFolderName) {
|
||||||
throw new Error("null virtualFolderName");
|
throw new Error("null virtualFolderName");
|
||||||
|
@ -1598,9 +1594,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
||||||
throw new Error("null mediaPath");
|
throw new Error("null mediaPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = "Library/VirtualFolders/Paths";
|
||||||
|
|
||||||
url += "/Paths";
|
|
||||||
|
|
||||||
url = self.getUrl(url, {
|
url = self.getUrl(url, {
|
||||||
refreshLibrary: refreshLibrary ? true : false,
|
refreshLibrary: refreshLibrary ? true : false,
|
||||||
|
|
|
@ -9,19 +9,11 @@
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Media Folders</a>
|
<a href="#" data-role="button" class="ui-btn-active">Folders</a>
|
||||||
<a href="librarypathmapping.html" data-role="button">Path Substitution</a>
|
<a href="librarypathmapping.html" data-role="button">Path Substitution</a>
|
||||||
<a href="librarysettings.html" data-role="button">Advanced</a>
|
<a href="librarysettings.html" data-role="button">Advanced</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="readOnlyContent">
|
<div class="readOnlyContent">
|
||||||
<p>
|
|
||||||
<label for="selectUser">Manage user library: </label>
|
|
||||||
<select id="selectUser" class="selectUser" data-mini="true"></select>
|
|
||||||
</p>
|
|
||||||
<p id="fldUseDefaultLibrary" style="display: none;">
|
|
||||||
<input type="checkbox" id="chkUseDefaultLibrary" name="chkUseDefaultLibrary" onchange="MediaLibraryPage.setUseDefaultMediaLibrary(this.checked);" />
|
|
||||||
<label for="chkUseDefaultLibrary">Use default media library</label>
|
|
||||||
</p>
|
|
||||||
<p style="margin: 2em 0;">Refer to the <a href="https://github.com/MediaBrowser/MediaBrowser/wiki/Library-Structure" target="_blank">media library wiki.</a> for suggested folder structures.</p>
|
<p style="margin: 2em 0;">Refer to the <a href="https://github.com/MediaBrowser/MediaBrowser/wiki/Library-Structure" target="_blank">media library wiki.</a> for suggested folder structures.</p>
|
||||||
<div id="divMediaLibrary">
|
<div id="divMediaLibrary">
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="library.html" data-role="button">Media Folders</a>
|
<a href="library.html" data-role="button">Folders</a>
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Path Substitution</a>
|
<a href="#" data-role="button" class="ui-btn-active">Path Substitution</a>
|
||||||
<a href="librarysettings.html" data-role="button">Advanced</a>
|
<a href="librarysettings.html" data-role="button">Advanced</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="library.html" data-role="button">Media Folders</a>
|
<a href="library.html" data-role="button">Folders</a>
|
||||||
<a href="librarypathmapping.html" data-role="button">Path Substitution</a>
|
<a href="librarypathmapping.html" data-role="button">Path Substitution</a>
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Advanced</a>
|
<a href="#" data-role="button" class="ui-btn-active">Advanced</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
<div class="visualLoginForm" style="display: none; text-align: center;">
|
<div class="visualLoginForm" style="display: none; text-align: center;">
|
||||||
<div id="divUsers"></div>
|
<div id="divUsers"></div>
|
||||||
|
|
||||||
|
<p class="localhostMessage" style="text-align: center; display: none;">Passwords are not required when logging in from localhost.</p>
|
||||||
<p style="text-align: center;"><a onclick="$('.manualLoginForm').show();$('.visualLoginForm').hide();" href="#">Manual Login</a></p>
|
<p style="text-align: center;"><a onclick="$('.manualLoginForm').show();$('.visualLoginForm').hide();" href="#">Manual Login</a></p>
|
||||||
|
|
||||||
<p style="text-align: center;">Note: Passwords are not required when logging in from localhost.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -69,21 +69,25 @@
|
||||||
|
|
||||||
function loadChildrenOfRootNode(callback) {
|
function loadChildrenOfRootNode(callback) {
|
||||||
|
|
||||||
|
var promise1 = $.getJSON(ApiClient.getUrl("Library/MediaFolders"));
|
||||||
var promise1 = ApiClient.getRootFolder(Dashboard.getCurrentUserId());
|
|
||||||
|
|
||||||
var promise2 = ApiClient.getLiveTvInfo();
|
var promise2 = ApiClient.getLiveTvInfo();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).done(function (response1, response2) {
|
||||||
|
|
||||||
var rootFolder = response1[0];
|
var mediaFolders = response1[0].Items;
|
||||||
var liveTvInfo = response2[0];
|
var liveTvInfo = response2[0];
|
||||||
|
|
||||||
var nodes = [];
|
var nodes = [];
|
||||||
|
|
||||||
nodes.push(getNode(rootFolder, 'open'));
|
var i, length;
|
||||||
|
|
||||||
for (var i = 0, length = liveTvInfo.Services.length; i < length; i++) {
|
for (i = 0, length = mediaFolders.length; i < length; i++) {
|
||||||
|
|
||||||
|
nodes.push(getNode(mediaFolders[i], 'closed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, length = liveTvInfo.Services.length; i < length; i++) {
|
||||||
|
|
||||||
var service = liveTvInfo.Services[i];
|
var service = liveTvInfo.Services[i];
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
Dashboard.getCurrentUser().done(function (user) {
|
Dashboard.getCurrentUser().done(function (user) {
|
||||||
|
|
||||||
if (user.Configuration.IsAdministrator) {
|
if (user.Configuration.IsAdministrator && query.ParentId) {
|
||||||
$('#editButtonContainer', page).show();
|
$('#editButtonContainer', page).show();
|
||||||
} else {
|
} else {
|
||||||
$('#editButtonContainer', page).hide();
|
$('#editButtonContainer', page).hide();
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
var LoginPage = {
|
var LoginPage = {
|
||||||
|
|
||||||
onPageShow: function () {
|
onPageShow: function () {
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
var isLocalhost = window.location.toString().toLowerCase().indexOf('localhost') != -1;
|
||||||
|
|
||||||
|
if (isLocalhost) {
|
||||||
|
$('.localhostMessage', this).show();
|
||||||
|
} else {
|
||||||
|
$('.localhostMessage', this).hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Show all users on localhost
|
// Show all users on localhost
|
||||||
var promise1 = window.location.toString().toLowerCase().indexOf('localhost') == -1 ? ApiClient.getPublicUsers() : ApiClient.getUsers({ IsDisabled: false });
|
var promise1 = !isLocalhost ? ApiClient.getPublicUsers() : ApiClient.getUsers({ IsDisabled: false });
|
||||||
var promise2 = ApiClient.getServerConfiguration();
|
var promise2 = ApiClient.getServerConfiguration();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).done(function (response1, response2) {
|
||||||
|
|
|
@ -5,84 +5,20 @@
|
||||||
var page = this;
|
var page = this;
|
||||||
MediaLibraryPage.lastVirtualFolderName = "";
|
MediaLibraryPage.lastVirtualFolderName = "";
|
||||||
|
|
||||||
MediaLibraryPage.reloadUsers(page);
|
MediaLibraryPage.reloadLibrary(page);
|
||||||
|
|
||||||
$('#selectUser', page).on('change.reloadLibrary', function() {
|
|
||||||
|
|
||||||
MediaLibraryPage.reloadLibrary(page);
|
|
||||||
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onPageHide: function() {
|
|
||||||
|
|
||||||
var page = this;
|
|
||||||
$('#selectUser', page).off('click.reloadLibrary');
|
|
||||||
},
|
|
||||||
|
|
||||||
reloadUsers: function (page) {
|
|
||||||
|
|
||||||
ApiClient.getUsers().done(function (users) {
|
|
||||||
|
|
||||||
|
|
||||||
var html = users.map(function (u) {
|
|
||||||
|
|
||||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
html = '<option value="">Default Library</option>' + html;
|
|
||||||
|
|
||||||
$('#selectUser', page).html(html).val('').selectmenu('refresh');
|
|
||||||
|
|
||||||
MediaLibraryPage.reloadLibrary(page);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getCurrentUserId: function(page) {
|
|
||||||
|
|
||||||
return $('#selectUser', page).val();
|
|
||||||
},
|
|
||||||
|
|
||||||
reloadLibrary: function (page) {
|
reloadLibrary: function (page) {
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId(page);
|
ApiClient.getVirtualFolders().done(function (result) {
|
||||||
|
MediaLibraryPage.reloadVirtualFolders(page, result);
|
||||||
|
});
|
||||||
|
|
||||||
if (userId) {
|
$('#fldUseDefaultLibrary', page).hide();
|
||||||
|
$('#divMediaLibrary', page).show();
|
||||||
ApiClient.getUser(userId).done(function (user) {
|
Dashboard.setPageTitle("Media Library");
|
||||||
|
|
||||||
$('#fldUseDefaultLibrary', page).show();
|
|
||||||
|
|
||||||
$('#chkUseDefaultLibrary', page).checked(!user.Configuration.UseCustomLibrary).checkboxradio("refresh");
|
|
||||||
|
|
||||||
if (user.Configuration.UseCustomLibrary) {
|
|
||||||
|
|
||||||
ApiClient.getVirtualFolders(userId).done(function (result) {
|
|
||||||
MediaLibraryPage.reloadVirtualFolders(page, result);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".editing_default", page).hide();
|
|
||||||
$('#divMediaLibrary', page).show();
|
|
||||||
} else {
|
|
||||||
$('#divMediaLibrary', page).hide();
|
|
||||||
Dashboard.hideLoadingMsg();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
ApiClient.getVirtualFolders().done(function (result) {
|
|
||||||
MediaLibraryPage.reloadVirtualFolders(page, result);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#fldUseDefaultLibrary', page).hide();
|
|
||||||
$('#divMediaLibrary', page).show();
|
|
||||||
Dashboard.setPageTitle("Media Library");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldRefreshLibraryAfterChanges: function () {
|
shouldRefreshLibraryAfterChanges: function () {
|
||||||
|
@ -152,14 +88,14 @@
|
||||||
|
|
||||||
var location = virtualFolder.Locations[i];
|
var location = virtualFolder.Locations[i];
|
||||||
html += '<li>';
|
html += '<li>';
|
||||||
html += '<a class="lnkMediaLocation" href="#">' + location + '</a>';
|
html += '<a style="font-size:14px;" class="lnkMediaLocation" href="#">' + location + '</a>';
|
||||||
html += '<a href="#" data-index="' + i + '" data-folderindex="' + index + '" onclick="MediaLibraryPage.deleteMediaLocation(this);"></a>';
|
html += '<a href="#" data-index="' + i + '" data-folderindex="' + index + '" onclick="MediaLibraryPage.deleteMediaLocation(this);"></a>';
|
||||||
html += '</li>';
|
html += '</li>';
|
||||||
}
|
}
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
|
|
||||||
if (addPathMappingInfo) {
|
if (addPathMappingInfo) {
|
||||||
html += '<p>Use <a href="librarypathmapping.html" style="font-weight:normal;">path substitution</a> to map server paths to network shares that clients are able to access.</p>';
|
html += '<p style="margin:1.5em 0;">Optional: <a href="librarypathmapping.html">Path substitution</a> can map server paths to network shares that clients can access for direct playback.</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<p>';
|
html += '<p>';
|
||||||
|
@ -173,38 +109,17 @@
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
setUseDefaultMediaLibrary: function (useDefaultLibrary) {
|
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
|
||||||
|
|
||||||
var page = $.mobile.activePage;
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId(page);
|
|
||||||
|
|
||||||
ApiClient.getUser(userId).done(function (user) {
|
|
||||||
|
|
||||||
user.Configuration.UseCustomLibrary = !useDefaultLibrary;
|
|
||||||
|
|
||||||
ApiClient.updateUser(user).done(function () {
|
|
||||||
MediaLibraryPage.reloadLibrary(page);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".editing_default", page).hide();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
addVirtualFolder: function () {
|
addVirtualFolder: function () {
|
||||||
|
|
||||||
$('.collectionTypeFieldDescription').show();
|
$('.collectionTypeFieldDescription').show();
|
||||||
|
|
||||||
MediaLibraryPage.getTextValue("Add Media Folder", "Name (Movies, Music, TV, etc):", "", true, function (name, type) {
|
MediaLibraryPage.getTextValue("Add Media Folder", "Name (Movies, Music, TV, etc):", "", true, function (name, type) {
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
|
|
||||||
|
|
||||||
MediaLibraryPage.lastVirtualFolderName = name;
|
MediaLibraryPage.lastVirtualFolderName = name;
|
||||||
|
|
||||||
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
||||||
|
|
||||||
ApiClient.addVirtualFolder(name, type, userId, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
ApiClient.addVirtualFolder(name, type, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -219,11 +134,9 @@
|
||||||
|
|
||||||
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
|
|
||||||
|
|
||||||
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
||||||
|
|
||||||
ApiClient.addMediaPath(virtualFolder.Name, path, userId, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -336,11 +249,9 @@
|
||||||
|
|
||||||
if (virtualFolder.Name != newName) {
|
if (virtualFolder.Name != newName) {
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
|
|
||||||
|
|
||||||
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
||||||
|
|
||||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, userId, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -369,11 +280,9 @@
|
||||||
|
|
||||||
if (confirmResult) {
|
if (confirmResult) {
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
|
|
||||||
|
|
||||||
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
||||||
|
|
||||||
ApiClient.removeVirtualFolder(virtualFolder.Name, userId, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -394,11 +303,9 @@
|
||||||
|
|
||||||
if (confirmResult) {
|
if (confirmResult) {
|
||||||
|
|
||||||
var userId = MediaLibraryPage.getCurrentUserId($.mobile.activePage);
|
|
||||||
|
|
||||||
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
var refreshAfterChange = MediaLibraryPage.shouldRefreshLibraryAfterChanges();
|
||||||
|
|
||||||
ApiClient.removeMediaPath(virtualFolder.Name, location, userId, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).done(MediaLibraryPage.processOperationResult);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -419,4 +326,4 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).on('pageshow', ".mediaLibraryPage", MediaLibraryPage.onPageShow).on('pagehide', ".mediaLibraryPage", MediaLibraryPage.onPageHide);
|
$(document).on('pageshow', ".mediaLibraryPage", MediaLibraryPage.onPageShow);
|
|
@ -38,10 +38,37 @@
|
||||||
$('#selectMaxParentalRating', page).html(html).selectmenu("refresh");
|
$('#selectMaxParentalRating', page).html(html).selectmenu("refresh");
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUser(page, user, loggedInUser, allParentalRatings) {
|
function loadMediaFolders(page, user, mediaFolders) {
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
|
||||||
|
html += '<fieldset data-role="controlgroup">';
|
||||||
|
|
||||||
|
html += '<legend>Media Folders</legend>';
|
||||||
|
|
||||||
|
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
||||||
|
|
||||||
|
var folder = mediaFolders[i];
|
||||||
|
|
||||||
|
var id = 'mediaFolder' + i;
|
||||||
|
|
||||||
|
var checkedAttribute = user.Configuration.BlockedMediaFolders.indexOf(folder.Name) == -1 ? ' checked="checked"' : '';
|
||||||
|
|
||||||
|
html += '<input class="chkMediaFolder" data-foldername="' + folder.Name + '" type="checkbox" data-mini="true" id="' + id + '"' + checkedAttribute + ' />';
|
||||||
|
html += '<label for="' + id + '">' + folder.Name + '</label>';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</fieldset>';
|
||||||
|
|
||||||
|
$('.libraryAccess', page).html(html).trigger('create');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadUser(page, user, loggedInUser, allParentalRatings, mediaFolders) {
|
||||||
|
|
||||||
Dashboard.setPageTitle(user.Name);
|
Dashboard.setPageTitle(user.Name);
|
||||||
|
|
||||||
|
loadMediaFolders(page, user, mediaFolders);
|
||||||
|
|
||||||
populateRatings(allParentalRatings, page);
|
populateRatings(allParentalRatings, page);
|
||||||
|
|
||||||
var ratingValue = "";
|
var ratingValue = "";
|
||||||
|
@ -61,7 +88,7 @@
|
||||||
$('#selectMaxParentalRating', page).val(ratingValue).selectmenu("refresh");
|
$('#selectMaxParentalRating', page).val(ratingValue).selectmenu("refresh");
|
||||||
|
|
||||||
$('#chkBlockNotRated', page).checked(user.Configuration.BlockNotRated || false).checkboxradio("refresh");
|
$('#chkBlockNotRated', page).checked(user.Configuration.BlockNotRated || false).checkboxradio("refresh");
|
||||||
|
|
||||||
$('#chkHideUnratedMovies', page).checked(user.Configuration.BlockUnratedMovies || false).checkboxradio("refresh");
|
$('#chkHideUnratedMovies', page).checked(user.Configuration.BlockUnratedMovies || false).checkboxradio("refresh");
|
||||||
$('#chkHideUnratedTrailers', page).checked(user.Configuration.BlockUnratedTrailers || false).checkboxradio("refresh");
|
$('#chkHideUnratedTrailers', page).checked(user.Configuration.BlockUnratedTrailers || false).checkboxradio("refresh");
|
||||||
$('#chkHideUnratedSeries', page).checked(user.Configuration.BlockUnratedSeries || false).checkboxradio("refresh");
|
$('#chkHideUnratedSeries', page).checked(user.Configuration.BlockUnratedSeries || false).checkboxradio("refresh");
|
||||||
|
@ -94,6 +121,12 @@
|
||||||
user.Configuration.BlockUnratedGames = $('#chkHideUnratedGames', page).checked();
|
user.Configuration.BlockUnratedGames = $('#chkHideUnratedGames', page).checked();
|
||||||
user.Configuration.BlockUnratedBooks = $('#chkHideUnratedBooks', page).checked();
|
user.Configuration.BlockUnratedBooks = $('#chkHideUnratedBooks', page).checked();
|
||||||
|
|
||||||
|
user.Configuration.BlockedMediaFolders = $('.chkMediaFolder:not(:checked)', page).map(function () {
|
||||||
|
|
||||||
|
return this.getAttribute('data-foldername');
|
||||||
|
|
||||||
|
}).get();
|
||||||
|
|
||||||
ApiClient.updateUser(user).done(function () {
|
ApiClient.updateUser(user).done(function () {
|
||||||
onSaveComplete(page);
|
onSaveComplete(page);
|
||||||
});
|
});
|
||||||
|
@ -146,9 +179,11 @@
|
||||||
|
|
||||||
var promise3 = ApiClient.getParentalRatings();
|
var promise3 = ApiClient.getParentalRatings();
|
||||||
|
|
||||||
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
|
var promise4 = $.getJSON(ApiClient.getUrl("Library/MediaFolders"));
|
||||||
|
|
||||||
loadUser(page, response1[0] || response1, response2[0], response3[0]);
|
$.when(promise1, promise2, promise3, promise4).done(function (response1, response2, response3, response4) {
|
||||||
|
|
||||||
|
loadUser(page, response1[0] || response1, response2[0], response3[0], response4[0].Items);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" id="userProfileNavigation" style="display: none;" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" id="userProfileNavigation" style="display: none;" data-mini="true">
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Profile</a>
|
<a href="#" data-role="button" class="ui-btn-active">Profile</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Parental Control</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Sharing</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">Profile</a>
|
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">Profile</a>
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Image</a>
|
<a href="#" data-role="button" class="ui-btn-active">Image</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Parental Control</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Sharing</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,17 +11,23 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">Profile</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">Profile</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">Parental Control</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" class="ui-btn-active">Sharing</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
||||||
</div>
|
</div>
|
||||||
<form class="userParentalControlForm">
|
<form class="userParentalControlForm">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="libraryAccess">
|
||||||
|
</div>
|
||||||
|
<div class="fieldDescription">Select the media folders to share with this user. Administrators will be able to edit all folders using the metadata manager.</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<ul data-role="listview" class="ulForm">
|
<ul data-role="listview" class="ulForm">
|
||||||
<li>
|
<li>
|
||||||
<label for="selectMaxParentalRating">Maximum allowed parental rating:</label>
|
<label for="selectMaxParentalRating">Maximum allowed parental rating:</label>
|
||||||
<select name="selectMaxParentalRating" id="selectMaxParentalRating"></select>
|
<select name="selectMaxParentalRating" id="selectMaxParentalRating" data-mini="true"></select>
|
||||||
<div class="fieldDescription">Content with a higher rating will be hidden from this user.</div>
|
<div class="fieldDescription">Content with a higher rating will be hidden from this user.</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">Profile</a>
|
<a href="#" onclick="Dashboard.navigate('useredit.html', true);" data-role="button">Profile</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Parental Control</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Sharing</a>
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Password</a>
|
<a href="#" data-role="button" class="ui-btn-active">Password</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('usersettings.html', true);">Preferences</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" class="localnav" data-mini="true">
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">Profile</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('useredit.html', true);">Profile</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userimage.html', true);">Image</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Parental Control</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userparentalcontrol.html', true);" id="lnkParentalControl" style="display: none;">Sharing</a>
|
||||||
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
<a href="#" data-role="button" onclick="Dashboard.navigate('userpassword.html', true);">Password</a>
|
||||||
<a href="#" data-role="button" class="ui-btn-active">Preferences</a>
|
<a href="#" data-role="button" class="ui-btn-active">Preferences</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.244" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.245" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue