From 37abd530eb5b462d8e5493d9d7e48da08d661ecb Mon Sep 17 00:00:00 2001 From: MrTimscampi Date: Sat, 8 Aug 2020 21:19:27 +0200 Subject: [PATCH] Remove old files --- src/controllers/user/menu.js | 58 ----------------- src/controllers/user/profile.js | 106 -------------------------------- 2 files changed, 164 deletions(-) delete mode 100644 src/controllers/user/menu.js delete mode 100644 src/controllers/user/profile.js diff --git a/src/controllers/user/menu.js b/src/controllers/user/menu.js deleted file mode 100644 index bd6f4de8a2..0000000000 --- a/src/controllers/user/menu.js +++ /dev/null @@ -1,58 +0,0 @@ -define(['apphost', 'connectionManager', 'layoutManager', 'listViewStyle', 'emby-button'], function(appHost, connectionManager, layoutManager) { - 'use strict'; - - return function(view, params) { - view.querySelector('.btnLogout').addEventListener('click', function() { - Dashboard.logout(); - }); - - view.querySelector('.selectServer').addEventListener('click', function () { - Dashboard.selectServer(); - }); - - view.querySelector('.clientSettings').addEventListener('click', function () { - window.NativeShell.openClientSettings(); - }); - - view.addEventListener('viewshow', function() { - // this page can also be used by admins to change user preferences from the user edit page - var userId = params.userId || Dashboard.getCurrentUserId(); - var page = this; - - page.querySelector('.lnkMyProfile').setAttribute('href', 'myprofile.html?userId=' + userId); - page.querySelector('.lnkDisplayPreferences').setAttribute('href', 'mypreferencesdisplay.html?userId=' + userId); - page.querySelector('.lnkHomePreferences').setAttribute('href', 'mypreferenceshome.html?userId=' + userId); - page.querySelector('.lnkPlaybackPreferences').setAttribute('href', 'mypreferencesplayback.html?userId=' + userId); - page.querySelector('.lnkSubtitlePreferences').setAttribute('href', 'mypreferencessubtitles.html?userId=' + userId); - - if (window.NativeShell && window.NativeShell.AppHost.supports('clientsettings')) { - page.querySelector('.clientSettings').classList.remove('hide'); - } else { - page.querySelector('.clientSettings').classList.add('hide'); - } - - if (appHost.default.supports('multiserver')) { - page.querySelector('.selectServer').classList.remove('hide'); - } else { - page.querySelector('.selectServer').classList.add('hide'); - } - - // hide the actions if user preferences are being edited for a different user - if (params.userId && params.userId !== Dashboard.getCurrentUserId) { - page.querySelector('.userSection').classList.add('hide'); - page.querySelector('.adminSection').classList.add('hide'); - } - - ApiClient.getUser(userId).then(function(user) { - page.querySelector('.headerUsername').innerHTML = user.Name; - if (!user.Policy.IsAdministrator) { - page.querySelector('.adminSection').classList.add('hide'); - } - }); - - require(['autoFocuser'], function (autoFocuser) { - autoFocuser.autoFocus(view); - }); - }); - }; -}); diff --git a/src/controllers/user/profile.js b/src/controllers/user/profile.js deleted file mode 100644 index eb912418fd..0000000000 --- a/src/controllers/user/profile.js +++ /dev/null @@ -1,106 +0,0 @@ -define(['controllers/dashboard/users/userpasswordpage', 'loading', 'libraryMenu', 'apphost', 'globalize', 'emby-button'], function (UserPasswordPage, loading, libraryMenu, appHost, globalize) { - 'use strict'; - - function reloadUser(page) { - var userId = getParameterByName('userId'); - loading.show(); - ApiClient.getUser(userId).then(function (user) { - page.querySelector('.username').innerHTML = user.Name; - libraryMenu.setTitle(user.Name); - - var imageUrl = 'assets/img/avatar.png'; - if (user.PrimaryImageTag) { - imageUrl = ApiClient.getUserImageUrl(user.Id, { - tag: user.PrimaryImageTag, - type: 'Primary' - }); - } - - var userImage = page.querySelector('#image'); - userImage.style.backgroundImage = 'url(' + imageUrl + ')'; - - Dashboard.getCurrentUser().then(function (loggedInUser) { - if (user.PrimaryImageTag) { - page.querySelector('#btnAddImage').classList.add('hide'); - page.querySelector('#btnDeleteImage').classList.remove('hide'); - } else if (appHost.default.supports('fileinput') && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) { - page.querySelector('#btnDeleteImage').classList.add('hide'); - page.querySelector('#btnAddImage').classList.remove('hide'); - } - }); - loading.hide(); - }); - } - - function onFileReaderError(evt) { - loading.hide(); - switch (evt.target.error.code) { - case evt.target.error.NOT_FOUND_ERR: - require(['toast'], function (toast) { - toast(globalize.translate('FileNotFound')); - }); - break; - case evt.target.error.ABORT_ERR: - onFileReaderAbort(); - break; - case evt.target.error.NOT_READABLE_ERR: - default: - require(['toast'], function (toast) { - toast(globalize.translate('FileReadError')); - }); - } - } - - function onFileReaderAbort(evt) { - loading.hide(); - require(['toast'], function (toast) { - toast(globalize.translate('FileReadCancelled')); - }); - } - - function setFiles(page, files) { - var userImage = page.querySelector('#image'); - var file = files[0]; - - if (!file || !file.type.match('image.*')) { - return false; - } - - var reader = new FileReader(); - reader.onerror = onFileReaderError; - reader.onabort = onFileReaderAbort; - reader.onload = function (evt) { - userImage.style.backgroundImage = 'url(' + evt.target.result + ')'; - var userId = getParameterByName('userId'); - ApiClient.uploadUserImage(userId, 'Primary', file).then(function () { - loading.hide(); - reloadUser(page); - }); - }; - - reader.readAsDataURL(file); - } - - return function (view, params) { - reloadUser(view); - new UserPasswordPage(view, params); - view.querySelector('#btnDeleteImage').addEventListener('click', function () { - require(['confirm'], function (confirm) { - confirm(globalize.translate('DeleteImageConfirmation'), globalize.translate('DeleteImage')).then(function () { - loading.show(); - var userId = getParameterByName('userId'); - ApiClient.deleteUserImage(userId, 'primary').then(function () { - loading.hide(); - reloadUser(view); - }); - }); - }); - }); - view.querySelector('#btnAddImage').addEventListener('click', function (evt) { - view.querySelector('#uploadImage').click(); - }); - view.querySelector('#uploadImage').addEventListener('change', function (evt) { - setFiles(view, evt.target.files); - }); - }; -});