mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add network share config
This commit is contained in:
parent
cf2c7ca241
commit
4dae2fdc32
13 changed files with 278 additions and 110 deletions
|
@ -1739,7 +1739,7 @@
|
||||||
* Adds a virtual folder
|
* Adds a virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addVirtualFolder = function (name, type, refreshLibrary, initialPaths, libraryOptions) {
|
self.addVirtualFolder = function (name, type, refreshLibrary, libraryOptions) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
|
@ -1762,7 +1762,6 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
Paths: initialPaths,
|
|
||||||
LibraryOptions: libraryOptions
|
LibraryOptions: libraryOptions
|
||||||
}),
|
}),
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
|
@ -1817,7 +1816,7 @@
|
||||||
* Adds an additional mediaPath to an existing virtual folder
|
* Adds an additional mediaPath to an existing virtual folder
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addMediaPath = function (virtualFolderName, mediaPath, refreshLibrary) {
|
self.addMediaPath = function (virtualFolderName, mediaPath, networkSharePath, refreshLibrary) {
|
||||||
|
|
||||||
if (!virtualFolderName) {
|
if (!virtualFolderName) {
|
||||||
throw new Error("null virtualFolderName");
|
throw new Error("null virtualFolderName");
|
||||||
|
@ -1829,15 +1828,50 @@
|
||||||
|
|
||||||
var url = "Library/VirtualFolders/Paths";
|
var url = "Library/VirtualFolders/Paths";
|
||||||
|
|
||||||
|
var pathInfo = {
|
||||||
|
Path: mediaPath
|
||||||
|
};
|
||||||
|
if (networkSharePath) {
|
||||||
|
pathInfo.NetworkPath = networkSharePath;
|
||||||
|
}
|
||||||
|
|
||||||
url = self.getUrl(url, {
|
url = self.getUrl(url, {
|
||||||
refreshLibrary: refreshLibrary ? true : false,
|
refreshLibrary: refreshLibrary ? true : false
|
||||||
path: mediaPath,
|
|
||||||
name: virtualFolderName
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url
|
url: url,
|
||||||
|
data: JSON.stringify({
|
||||||
|
Name: virtualFolderName,
|
||||||
|
PathInfo: pathInfo
|
||||||
|
}),
|
||||||
|
contentType: 'application/json'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
self.updateMediaPath = function (virtualFolderName, pathInfo) {
|
||||||
|
|
||||||
|
if (!virtualFolderName) {
|
||||||
|
throw new Error("null virtualFolderName");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pathInfo) {
|
||||||
|
throw new Error("null pathInfo");
|
||||||
|
}
|
||||||
|
|
||||||
|
var url = "Library/VirtualFolders/Paths/Update";
|
||||||
|
|
||||||
|
url = self.getUrl(url);
|
||||||
|
|
||||||
|
return self.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url,
|
||||||
|
data: JSON.stringify({
|
||||||
|
Name: virtualFolderName,
|
||||||
|
PathInfo: pathInfo
|
||||||
|
}),
|
||||||
|
contentType: 'application/json'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@
|
||||||
showOverlayTimeout = setTimeout(function () {
|
showOverlayTimeout = setTimeout(function () {
|
||||||
onShowTimerExpired(card);
|
onShowTimerExpired(card);
|
||||||
|
|
||||||
}, 1000);
|
}, 1200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function preventTouchHover() {
|
function preventTouchHover() {
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
color: #cc3333;
|
color: #cc3333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.manageButtonText {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
@media all and (max-width: 440px) {
|
@media all and (max-width: 440px) {
|
||||||
|
|
||||||
.manageButtonText {
|
.manageButtonText {
|
||||||
|
|
|
@ -12,5 +12,4 @@
|
||||||
background: #fff3a5;
|
background: #fff3a5;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin-top: 2em;
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
define(['dialogHelper', 'jQuery', 'listViewStyle', 'emby-input', 'emby-button', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle'], function (dialogHelper, $) {
|
define(['dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'emby-button', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle'], function (dialogHelper, dom) {
|
||||||
|
|
||||||
var systemInfo;
|
var systemInfo;
|
||||||
function getSystemInfo() {
|
function getSystemInfo() {
|
||||||
|
@ -29,12 +29,6 @@
|
||||||
}
|
}
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
if (path) {
|
|
||||||
$('.networkHeadline').hide();
|
|
||||||
} else {
|
|
||||||
$('.networkHeadline').show();
|
|
||||||
}
|
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
if (path === "Network") {
|
if (path === "Network") {
|
||||||
|
@ -53,7 +47,7 @@
|
||||||
var folders = responses[0];
|
var folders = responses[0];
|
||||||
var parentPath = responses[1] || '';
|
var parentPath = responses[1] || '';
|
||||||
|
|
||||||
$('#txtDirectoryPickerPath', page).val(path || "");
|
page.querySelector('#txtDirectoryPickerPath').value = path || "";
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
@ -75,14 +69,14 @@
|
||||||
html += getItem("lnkPath lnkDirectory", "", "Network", Globalize.translate('ButtonNetwork'));
|
html += getItem("lnkPath lnkDirectory", "", "Network", Globalize.translate('ButtonNetwork'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.results', page).html(html);
|
page.querySelector('.results').innerHTML = html;
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
|
|
||||||
$('#txtDirectoryPickerPath', page).val("");
|
page.querySelector('#txtDirectoryPickerPath').value = "";
|
||||||
$('.results', page).html('');
|
page.querySelector('.results').innerHTML = '';
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
|
@ -108,11 +102,12 @@
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += '<div class="formDialogContent smoothScrollY">';
|
html += '<div class="formDialogContent smoothScrollY">';
|
||||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
html += '<div class="dialogContentInner dialog-content-centered" style="padding-top:2em;">';
|
||||||
|
|
||||||
|
if (!options.pathReadOnly) {
|
||||||
var instruction = options.instruction ? options.instruction + '<br/><br/>' : '';
|
var instruction = options.instruction ? options.instruction + '<br/><br/>' : '';
|
||||||
|
|
||||||
html += '<p class="directoryPickerHeadline">';
|
html += '<div class="directoryPickerHeadline">';
|
||||||
html += instruction;
|
html += instruction;
|
||||||
html += Globalize.translate('MessageDirectoryPickerInstruction')
|
html += Globalize.translate('MessageDirectoryPickerInstruction')
|
||||||
.replace('{0}', '<b>\\\\server</b>')
|
.replace('{0}', '<b>\\\\server</b>')
|
||||||
|
@ -134,18 +129,36 @@
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</p>';
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
html += '<form style="margin:auto;">';
|
html += '<form style="margin:auto;">';
|
||||||
|
|
||||||
html += '<div class="inputContainer" style="display: flex; align-items: center;">';
|
html += '<div class="inputContainer" style="display: flex; align-items: center;">';
|
||||||
html += '<div style="flex-grow:1;">';
|
html += '<div style="flex-grow:1;">';
|
||||||
html += '<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" label="' + Globalize.translate('LabelCurrentPath') + '"/>';
|
var labelKey = options.includeFiles !== true ? 'LabelFolder' : 'LabelPath';
|
||||||
html += '</div>';
|
var readOnlyAttribute = options.pathReadOnly ? ' readonly' : '';
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories" title="' + Globalize.translate('ButtonRefresh') + '"><i class="md-icon">search</i></button>';
|
html += '<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" ' + readOnlyAttribute + ' label="' + Globalize.translate(labelKey) + '"/>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<div class="results paperList" style="max-height: 300px; overflow-y: auto;"></div>';
|
if (!readOnlyAttribute) {
|
||||||
|
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories" title="' + Globalize.translate('ButtonRefresh') + '"><i class="md-icon">search</i></button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
|
if (!readOnlyAttribute) {
|
||||||
|
html += '<div class="results paperList" style="max-height: 200px; overflow-y: auto;"></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.enableNetworkSharePath) {
|
||||||
|
html += '<div class="inputContainer">';
|
||||||
|
html += '<input is="emby-input" id="txtNetworkPath" type="text" label="' + Globalize.translate('LabelOptionalNetworkPath') + '"/>';
|
||||||
|
html += '<div class="fieldDescription">';
|
||||||
|
html += Globalize.translate('LabelOptionalNetworkPathHelp');
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
html += '<div class="formDialogFooter">';
|
html += '<div class="formDialogFooter">';
|
||||||
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + Globalize.translate('ButtonOk') + '</button>';
|
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + Globalize.translate('ButtonOk') + '</button>';
|
||||||
|
@ -162,32 +175,49 @@
|
||||||
|
|
||||||
function initEditor(content, options, fileOptions) {
|
function initEditor(content, options, fileOptions) {
|
||||||
|
|
||||||
$(content).on("click", ".lnkPath", function () {
|
content.addEventListener("click", function (e) {
|
||||||
|
|
||||||
var path = this.getAttribute('data-path');
|
var lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||||
|
if (lnkPath) {
|
||||||
|
var path = lnkPath.getAttribute('data-path');
|
||||||
|
|
||||||
if ($(this).hasClass('lnkFile')) {
|
if (lnkPath.classList.contains('lnkFile')) {
|
||||||
$('#txtDirectoryPickerPath', content).val(path);
|
content.querySelector('#txtDirectoryPickerPath').value = path;
|
||||||
} else {
|
} else {
|
||||||
refreshDirectoryBrowser(content, path, fileOptions);
|
refreshDirectoryBrowser(content, path, fileOptions);
|
||||||
}
|
}
|
||||||
}).on("click", ".btnRefreshDirectories", function () {
|
}
|
||||||
|
|
||||||
var path = $('#txtDirectoryPickerPath', content).val();
|
|
||||||
|
|
||||||
refreshDirectoryBrowser(content, path, fileOptions);
|
|
||||||
|
|
||||||
}).on("change", "#txtDirectoryPickerPath", function () {
|
|
||||||
|
|
||||||
refreshDirectoryBrowser(content, this.value, fileOptions);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('form', content).on('submit', function () {
|
content.addEventListener("click", function (e) {
|
||||||
|
|
||||||
|
var btnRefreshDirectories = dom.parentWithClass(e.target, 'btnRefreshDirectories');
|
||||||
|
if (btnRefreshDirectories) {
|
||||||
|
var path = content.querySelector('#txtDirectoryPickerPath').value;
|
||||||
|
|
||||||
|
refreshDirectoryBrowser(content, path, fileOptions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
content.addEventListener("change", function (e) {
|
||||||
|
|
||||||
|
var txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
||||||
|
if (txtDirectoryPickerPath && txtDirectoryPickerPath.id == 'txtDirectoryPickerPath') {
|
||||||
|
refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
content.querySelector('form').addEventListener('submit', function (e) {
|
||||||
|
|
||||||
if (options.callback) {
|
if (options.callback) {
|
||||||
options.callback(this.querySelector('#txtDirectoryPickerPath').value);
|
|
||||||
|
var networkSharePath = this.querySelector('#txtNetworkPath');
|
||||||
|
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
||||||
|
options.callback(this.querySelector('#txtDirectoryPickerPath').value, networkSharePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -259,15 +289,11 @@
|
||||||
|
|
||||||
initEditor(dlg, options, fileOptions);
|
initEditor(dlg, options, fileOptions);
|
||||||
|
|
||||||
// Has to be assigned a z-index after the call to .open()
|
dlg.addEventListener('close', onDialogClosed);
|
||||||
$(dlg).on('iron-overlay-opened', function () {
|
|
||||||
this.querySelector('#txtDirectoryPickerPath input').focus();
|
|
||||||
});
|
|
||||||
$(dlg).on('close', onDialogClosed);
|
|
||||||
|
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
|
|
||||||
$('.btnCloseDialog', dlg).on('click', function () {
|
dlg.querySelector('.btnCloseDialog').addEventListener('click', function () {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
@ -276,7 +302,15 @@
|
||||||
|
|
||||||
var txtCurrentPath = dlg.querySelector('#txtDirectoryPickerPath');
|
var txtCurrentPath = dlg.querySelector('#txtDirectoryPickerPath');
|
||||||
txtCurrentPath.value = initialPath;
|
txtCurrentPath.value = initialPath;
|
||||||
|
|
||||||
|
var txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||||
|
if (txtNetworkPath) {
|
||||||
|
txtNetworkPath.value = options.networkSharePath || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options.pathReadOnly) {
|
||||||
refreshDirectoryBrowser(dlg, txtCurrentPath.value);
|
refreshDirectoryBrowser(dlg, txtCurrentPath.value);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<label for="selectImageType">${LabelImageType}</label>
|
<label for="selectImageType">${LabelImageType}</label>
|
||||||
<select id="selectImageType" name="selectImageType">
|
<select id="selectImageType" name="selectImageType" style="color:#fff;">
|
||||||
<option value="Primary">${OptionPrimary}</option>
|
<option value="Primary">${OptionPrimary}</option>
|
||||||
<option value="Art">${OptionArt}</option>
|
<option value="Art">${OptionArt}</option>
|
||||||
<option value="Backdrop">${OptionBackdrop}</option>
|
<option value="Backdrop">${OptionBackdrop}</option>
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
var currentDeferred;
|
var currentDeferred;
|
||||||
var hasChanges;
|
var hasChanges;
|
||||||
var currentOptions;
|
var currentOptions;
|
||||||
var paths = [];
|
var pathInfos = [];
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
|
|
||||||
if (paths.length == 0) {
|
if (pathInfos.length == 0) {
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert({
|
||||||
text: Globalize.translate('PleaseAddAtLeastOneFolder'),
|
text: Globalize.translate('PleaseAddAtLeastOneFolder'),
|
||||||
|
@ -29,7 +29,9 @@
|
||||||
|
|
||||||
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||||
|
|
||||||
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths, libraryOptions).then(function () {
|
libraryOptions.PathInfos = pathInfos;
|
||||||
|
|
||||||
|
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, libraryOptions).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
|
@ -111,10 +113,11 @@
|
||||||
|
|
||||||
picker.show({
|
picker.show({
|
||||||
|
|
||||||
callback: function (path) {
|
enableNetworkSharePath: true,
|
||||||
|
callback: function (path, networkSharePath) {
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
addMediaLocation(page, path);
|
addMediaLocation(page, path, networkSharePath);
|
||||||
}
|
}
|
||||||
picker.close();
|
picker.close();
|
||||||
}
|
}
|
||||||
|
@ -123,7 +126,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFolderHtml(path, index) {
|
function getFolderHtml(pathInfo, index) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
@ -131,8 +134,14 @@
|
||||||
|
|
||||||
html += '<i class="listItemIcon md-icon">folder</i>';
|
html += '<i class="listItemIcon md-icon">folder</i>';
|
||||||
|
|
||||||
html += '<div class="listItemBody">';
|
var cssClass = pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody';
|
||||||
html += '<div class="listItemBodyText">' + path + '</div>';
|
|
||||||
|
html += '<div class="' + cssClass + '">';
|
||||||
|
html += '<div class="listItemBodyText">' + pathInfo.Path + '</div>';
|
||||||
|
|
||||||
|
if (pathInfo.NetworkPath) {
|
||||||
|
html += '<div class="listItemBodyText secondary">' + pathInfo.NetworkPath + '</div>';
|
||||||
|
}
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<button is="paper-icon-button-light"" class="listItemButton btnRemovePath" data-index="' + index + '"><i class="md-icon">remove_circle</i></button>';
|
html += '<button is="paper-icon-button-light"" class="listItemButton btnRemovePath" data-index="' + index + '"><i class="md-icon">remove_circle</i></button>';
|
||||||
|
@ -143,7 +152,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPaths(page) {
|
function renderPaths(page) {
|
||||||
var foldersHtml = paths.map(getFolderHtml).join('');
|
var foldersHtml = pathInfos.map(getFolderHtml).join('');
|
||||||
|
|
||||||
var folderList = page.querySelector('.folderList');
|
var folderList = page.querySelector('.folderList');
|
||||||
folderList.innerHTML = foldersHtml;
|
folderList.innerHTML = foldersHtml;
|
||||||
|
@ -157,14 +166,21 @@
|
||||||
$(page.querySelectorAll('.btnRemovePath')).on('click', onRemoveClick);
|
$(page.querySelectorAll('.btnRemovePath')).on('click', onRemoveClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addMediaLocation(page, path) {
|
function addMediaLocation(page, path, networkSharePath) {
|
||||||
|
|
||||||
if (paths.filter(function (p) {
|
if (pathInfos.filter(function (p) {
|
||||||
|
|
||||||
return p.toLowerCase() == path.toLowerCase();
|
return p.Path.toLowerCase() == path.toLowerCase();
|
||||||
|
|
||||||
}).length == 0) {
|
}).length == 0) {
|
||||||
paths.push(path);
|
|
||||||
|
var pathInfo = {
|
||||||
|
Path: path
|
||||||
|
};
|
||||||
|
if (networkSharePath) {
|
||||||
|
pathInfo.NetworkPath = networkSharePath;
|
||||||
|
}
|
||||||
|
pathInfos.push(pathInfo);
|
||||||
renderPaths(page);
|
renderPaths(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,10 +190,10 @@
|
||||||
var button = this;
|
var button = this;
|
||||||
var index = parseInt(button.getAttribute('data-index'));
|
var index = parseInt(button.getAttribute('data-index'));
|
||||||
|
|
||||||
var location = paths[index];
|
var location = pathInfos[index];
|
||||||
paths = paths.filter(function (p) {
|
pathInfos = pathInfos.filter(function (p) {
|
||||||
|
|
||||||
return p.toLowerCase() != location.toLowerCase();
|
return p.Path.toLowerCase() != location.toLowerCase();
|
||||||
});
|
});
|
||||||
var page = $(this).parents('.dlg-librarycreator')[0];
|
var page = $(this).parents('.dlg-librarycreator')[0];
|
||||||
renderPaths(page);
|
renderPaths(page);
|
||||||
|
@ -190,7 +206,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function initLibraryOptions(dlg) {
|
function initLibraryOptions(dlg) {
|
||||||
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')).then(function() {
|
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')).then(function () {
|
||||||
$('#selectCollectionType', dlg).trigger('change');
|
$('#selectCollectionType', dlg).trigger('change');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -241,7 +257,7 @@
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
paths = [];
|
pathInfos = [];
|
||||||
renderPaths(dlg);
|
renderPaths(dlg);
|
||||||
initLibraryOptions(dlg);
|
initLibraryOptions(dlg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
var hasChanges;
|
var hasChanges;
|
||||||
var currentOptions;
|
var currentOptions;
|
||||||
|
|
||||||
function addMediaLocation(page, path) {
|
function addMediaLocation(page, path, networkSharePath) {
|
||||||
|
|
||||||
var virtualFolder = currentOptions.library;
|
var virtualFolder = currentOptions.library;
|
||||||
|
|
||||||
var refreshAfterChange = currentOptions.refresh;
|
var refreshAfterChange = currentOptions.refresh;
|
||||||
|
|
||||||
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).then(function () {
|
ApiClient.addMediaPath(virtualFolder.Name, path, networkSharePath, refreshAfterChange).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
refreshLibraryFromServer(page);
|
refreshLibraryFromServer(page);
|
||||||
|
@ -23,9 +23,30 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRemoveClick() {
|
function updateMediaLocation(page, path, networkSharePath) {
|
||||||
|
var virtualFolder = currentOptions.library;
|
||||||
|
|
||||||
var button = this;
|
ApiClient.updateMediaPath(virtualFolder.Name, {
|
||||||
|
|
||||||
|
Path: path,
|
||||||
|
NetworkPath: networkSharePath
|
||||||
|
|
||||||
|
}).then(function () {
|
||||||
|
|
||||||
|
hasChanges = true;
|
||||||
|
refreshLibraryFromServer(page);
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
|
require(['toast'], function (toast) {
|
||||||
|
toast(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function onRemoveClick(btnRemovePath) {
|
||||||
|
|
||||||
|
var button = btnRemovePath;
|
||||||
var index = parseInt(button.getAttribute('data-index'));
|
var index = parseInt(button.getAttribute('data-index'));
|
||||||
|
|
||||||
var virtualFolder = currentOptions.library;
|
var virtualFolder = currentOptions.library;
|
||||||
|
@ -38,7 +59,7 @@
|
||||||
|
|
||||||
title: Globalize.translate('HeaderRemoveMediaLocation'),
|
title: Globalize.translate('HeaderRemoveMediaLocation'),
|
||||||
text: Globalize.translate('MessageConfirmRemoveMediaLocation'),
|
text: Globalize.translate('MessageConfirmRemoveMediaLocation'),
|
||||||
confirmText: Globalize.translate('sharedcomponents#ButtonDelete'),
|
confirmText: Globalize.translate('ButtonDelete'),
|
||||||
primary: 'cancel'
|
primary: 'cancel'
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
@ -60,18 +81,42 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFolderHtml(path, index) {
|
function onListItemClick(e) {
|
||||||
|
|
||||||
|
var btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||||
|
if (btnRemovePath) {
|
||||||
|
onRemoveClick(btnRemovePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var listItem = dom.parentWithClass(e.target, 'listItem');
|
||||||
|
if (!listItem) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = parseInt(listItem.getAttribute('data-index'));
|
||||||
|
var page = dom.parentWithClass(listItem, 'dlg-libraryeditor');
|
||||||
|
showDirectoryBrowser(page, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFolderHtml(pathInfo, index) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += '<div class="listItem lnkPath">';
|
html += '<div class="listItem lnkPath" data-index="' + index + '">';
|
||||||
|
|
||||||
html += '<i class="listItemIcon md-icon">folder</i>';
|
html += '<i class="listItemIcon md-icon">folder</i>';
|
||||||
|
|
||||||
html += '<div class="listItemBody">';
|
var cssClass = pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody';
|
||||||
|
|
||||||
|
html += '<div class="' + cssClass + '">';
|
||||||
|
|
||||||
html += '<h3 class="listItemBodyText">';
|
html += '<h3 class="listItemBodyText">';
|
||||||
html += path;
|
html += pathInfo.Path;
|
||||||
html += '</h3>';
|
html += '</h3>';
|
||||||
|
if (pathInfo.NetworkPath) {
|
||||||
|
html += '<div class="listItemBodyText secondary">' + pathInfo.NetworkPath + '</div>';
|
||||||
|
}
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<button is="paper-icon-button-light" class="listItemButton btnRemovePath" data-index="' + index + '"><i class="md-icon">remove_circle</i></button>';
|
html += '<button is="paper-icon-button-light" class="listItemButton btnRemovePath" data-index="' + index + '"><i class="md-icon">remove_circle</i></button>';
|
||||||
|
@ -99,13 +144,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLibrary(page, options) {
|
function renderLibrary(page, options) {
|
||||||
var foldersHtml = options.library.Locations.map(getFolderHtml).join('');
|
|
||||||
|
var pathInfos = (options.library.LibraryOptions || {}).PathInfos || [];
|
||||||
|
|
||||||
|
if (!pathInfos.length) {
|
||||||
|
pathInfos = options.library.Locations.map(function (p) {
|
||||||
|
return {
|
||||||
|
Path: p
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var foldersHtml = pathInfos.map(getFolderHtml).join('');
|
||||||
|
|
||||||
page.querySelector('.folderList').innerHTML = foldersHtml;
|
page.querySelector('.folderList').innerHTML = foldersHtml;
|
||||||
|
|
||||||
var btnRemovePath = page.querySelectorAll('.btnRemovePath');
|
var listItems = page.querySelectorAll('.listItem');
|
||||||
for (var i = 0, length = btnRemovePath.length; i < length; i++) {
|
for (var i = 0, length = listItems.length; i < length; i++) {
|
||||||
btnRemovePath[i].addEventListener('click', onRemoveClick);
|
listItems[i].addEventListener('click', onListItemClick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,16 +169,35 @@
|
||||||
|
|
||||||
var page = dom.parentWithClass(this, 'dlg-libraryeditor');
|
var page = dom.parentWithClass(this, 'dlg-libraryeditor');
|
||||||
|
|
||||||
|
showDirectoryBrowser(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showDirectoryBrowser(context, listIndex) {
|
||||||
|
|
||||||
require(['directorybrowser'], function (directoryBrowser) {
|
require(['directorybrowser'], function (directoryBrowser) {
|
||||||
|
|
||||||
var picker = new directoryBrowser();
|
var picker = new directoryBrowser();
|
||||||
|
|
||||||
|
var pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
|
||||||
|
var pathInfo = listIndex == null ? {} : (pathInfos[listIndex] || {});
|
||||||
|
// legacy
|
||||||
|
var location = listIndex == null ? null : (currentOptions.library.Locations[listIndex]);
|
||||||
|
var originalPath = pathInfo.Path || location;
|
||||||
|
|
||||||
picker.show({
|
picker.show({
|
||||||
|
|
||||||
callback: function (path) {
|
enableNetworkSharePath: true,
|
||||||
|
pathReadOnly: listIndex != null,
|
||||||
|
path: originalPath,
|
||||||
|
networkSharePath: pathInfo.NetworkPath,
|
||||||
|
callback: function (path, networkSharePath) {
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
addMediaLocation(page, path);
|
if (originalPath) {
|
||||||
|
updateMediaLocation(context, originalPath, networkSharePath);
|
||||||
|
} else {
|
||||||
|
addMediaLocation(context, path, networkSharePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
picker.close();
|
picker.close();
|
||||||
}
|
}
|
||||||
|
@ -145,6 +220,8 @@
|
||||||
|
|
||||||
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||||
|
|
||||||
|
libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions);
|
||||||
|
|
||||||
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions);
|
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ body:not(.dashboardDocument) .btnNotifications {
|
||||||
}
|
}
|
||||||
|
|
||||||
i.sidebarLinkIcon {
|
i.sidebarLinkIcon {
|
||||||
font-size: 150%;
|
font-size: 120%;
|
||||||
height: auto;
|
height: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
</p>
|
</p>
|
||||||
<p id="newVersionNumber"></p>
|
<p id="newVersionNumber"></p>
|
||||||
<div id="btnUpdateApplicationContainer">
|
<div id="btnUpdateApplicationContainer">
|
||||||
<button id="btnUpdateApplication" type="button" data-icon="arrow-d" data-theme="b" onclick="DashboardPage.updateApplication();">${ButtonUpdateNow}</button>
|
<button id="btnUpdateApplication" is="emby-button" type="button" class="raised block" onclick="DashboardPage.updateApplication();">
|
||||||
|
<span>${ButtonUpdateNow}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="btnManualUpdateContainer">
|
<div id="btnManualUpdateContainer">
|
||||||
<a href="http://emby.media/download" target="_blank">${PleaseUpdateManually}</a>
|
<a href="http://emby.media/download" target="_blank">${PleaseUpdateManually}</a>
|
||||||
|
|
|
@ -986,7 +986,7 @@
|
||||||
|
|
||||||
html += '<p><strong>' + Globalize.translate('NewVersionOfSomethingAvailable').replace('{0}', update.name) + '</strong></p>';
|
html += '<p><strong>' + Globalize.translate('NewVersionOfSomethingAvailable').replace('{0}', update.name) + '</strong></p>';
|
||||||
|
|
||||||
html += '<button type="button" data-icon="arrow-d" data-theme="b" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-guid="' + update.guid + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">' + Globalize.translate('ButtonUpdateNow') + '</button>';
|
html += '<button type="button" is="emby-button" class="raised block" onclick="DashboardPage.installPluginUpdate(this);" data-name="' + update.name + '" data-guid="' + update.guid + '" data-version="' + update.versionStr + '" data-classification="' + update.classification + '">' + Globalize.translate('ButtonUpdateNow') + '</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.html(html);
|
elem.html(html);
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
var checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
|
var checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
|
||||||
|
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
|
@ -2137,5 +2137,7 @@
|
||||||
"HeaderForKids": "For Kids",
|
"HeaderForKids": "For Kids",
|
||||||
"HeaderRecordingGroups": "Recording Groups",
|
"HeaderRecordingGroups": "Recording Groups",
|
||||||
"LabelConvertRecordingsTo": "Convert recordings to:",
|
"LabelConvertRecordingsTo": "Convert recordings to:",
|
||||||
"HeaderUpcomingOnTV": "Upcoming On TV"
|
"HeaderUpcomingOnTV": "Upcoming On TV",
|
||||||
|
"LabelOptionalNetworkPath": "(Optional) Shared network folder:",
|
||||||
|
"LabelOptionalNetworkPathHelp": "If this folder is shared on your network, supplying the network share path can allow Emby apps on other devices to access media files directly."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue