diff --git a/dashboard-ui/mypreferencesdisplay.html b/dashboard-ui/mypreferencesdisplay.html index 8492ccb538..801fce79a9 100644 --- a/dashboard-ui/mypreferencesdisplay.html +++ b/dashboard-ui/mypreferencesdisplay.html @@ -9,6 +9,7 @@
${TabDisplay} ${TabPlayback} + ${TabProfile} ${TabWebClient}
diff --git a/dashboard-ui/mypreferenceslanguages.html b/dashboard-ui/mypreferenceslanguages.html index 7273ca94f3..b4f5f74a52 100644 --- a/dashboard-ui/mypreferenceslanguages.html +++ b/dashboard-ui/mypreferenceslanguages.html @@ -9,6 +9,7 @@
${TabDisplay} ${TabPlayback} + ${TabProfile} ${TabWebClient}
diff --git a/dashboard-ui/mypreferenceswebclient.html b/dashboard-ui/mypreferenceswebclient.html index e461883ae7..a9817a7b1e 100644 --- a/dashboard-ui/mypreferenceswebclient.html +++ b/dashboard-ui/mypreferenceswebclient.html @@ -9,6 +9,7 @@
${TabDisplay} ${TabPlayback} + ${TabProfile} ${TabWebClient}
diff --git a/dashboard-ui/myprofile.html b/dashboard-ui/myprofile.html new file mode 100644 index 0000000000..0a6bebd6cb --- /dev/null +++ b/dashboard-ui/myprofile.html @@ -0,0 +1,56 @@ + + + + ${TitleMediaBrowser} + + +
+ +
+ ${TabDisplay} + ${TabPlayback} + ${TabProfile} + ${TabWebClient} +
+ +
+
+
+ +
+

+ +
+
+ + + + +
+ + diff --git a/dashboard-ui/scripts/aboutpage.js b/dashboard-ui/scripts/aboutpage.js index 942809d89f..c6991404bf 100644 --- a/dashboard-ui/scripts/aboutpage.js +++ b/dashboard-ui/scripts/aboutpage.js @@ -1,10 +1,10 @@ -(function ($, document, apiClient) { +(function ($, document) { $(document).on('pageshow', "#aboutPage", function () { var page = this; - apiClient.getSystemInfo().done(function (info) { + ApiClient.getSystemInfo().done(function (info) { var elem = $('#appVersionNumber', page); @@ -12,4 +12,4 @@ }); }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/backdrops.js b/dashboard-ui/scripts/backdrops.js index cd9ae91e98..7d240f19d3 100644 --- a/dashboard-ui/scripts/backdrops.js +++ b/dashboard-ui/scripts/backdrops.js @@ -34,7 +34,7 @@ var options = { SortBy: "IsFavoriteOrLiked,Random", - Limit: 50, + Limit: 20, Recursive: true, IncludeItemTypes: types, ImageTypes: "Backdrop", @@ -61,7 +61,9 @@ function showBackdrop(type) { - getBackdropItemIds(Dashboard.getCurrentUserId(), type, LibraryMenu.getTopParentId()).done(function (images) { + getBackdropItemIds(Dashboard.getCurrentUserId(), + type, + LibraryMenu.getTopParentId()).done(function (images) { if (images.length) { diff --git a/dashboard-ui/scripts/favorites.js b/dashboard-ui/scripts/favorites.js index 659a95ed1a..54d2fcd422 100644 --- a/dashboard-ui/scripts/favorites.js +++ b/dashboard-ui/scripts/favorites.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function getSections() { @@ -112,4 +112,4 @@ loadSections(page, userId); }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/homelatest.js b/dashboard-ui/scripts/homelatest.js index 0c740192d9..995593ab6e 100644 --- a/dashboard-ui/scripts/homelatest.js +++ b/dashboard-ui/scripts/homelatest.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function loadSections(page, userId) { @@ -34,4 +34,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/indexpage.js b/dashboard-ui/scripts/indexpage.js index d160cd4e96..5281dce20b 100644 --- a/dashboard-ui/scripts/indexpage.js +++ b/dashboard-ui/scripts/indexpage.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function getUserViews(userId) { @@ -440,7 +440,7 @@ })(jQuery, document, ApiClient); -(function ($, document, apiClient) { +(function ($, document) { function getDefaultSection(index) { @@ -595,4 +595,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index 84c9278bd0..0680532935 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -272,8 +272,6 @@ '' : getTopParentId() || ''; - sessionStore.setItem('topParentId', id); - $('.lnkMediaFolder').each(function () { var itemId = this.getAttribute('data-itemid'); diff --git a/dashboard-ui/scripts/livetvchannel.js b/dashboard-ui/scripts/livetvchannel.js index 70258f3135..fb19b0b6ef 100644 --- a/dashboard-ui/scripts/livetvchannel.js +++ b/dashboard-ui/scripts/livetvchannel.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var currentItem; var programs; diff --git a/dashboard-ui/scripts/livetvchannels.js b/dashboard-ui/scripts/livetvchannels.js index 0439d119ea..55ba9fe331 100644 --- a/dashboard-ui/scripts/livetvchannels.js +++ b/dashboard-ui/scripts/livetvchannels.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var query = { @@ -60,7 +60,7 @@ showLoadingMessage(page); - apiClient.getLiveTvChannels(query).done(function (result) { + ApiClient.getLiveTvChannels(query).done(function (result) { renderChannels(page, result); @@ -134,4 +134,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvguide.js b/dashboard-ui/scripts/livetvguide.js index bb92ded4e7..6e2e21a8a7 100644 --- a/dashboard-ui/scripts/livetvguide.js +++ b/dashboard-ui/scripts/livetvguide.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { // 30 mins var cellCurationMinutes = 30; @@ -52,7 +52,7 @@ channelQuery.userId = Dashboard.getCurrentUserId(); - channelsPromise = channelsPromise || apiClient.getLiveTvChannels(channelQuery); + channelsPromise = channelsPromise || ApiClient.getLiveTvChannels(channelQuery); var date = currentDate; @@ -62,7 +62,7 @@ console.log(nextDay); channelsPromise.done(function (channelsResult) { - apiClient.getLiveTvPrograms({ + ApiClient.getLiveTvPrograms({ UserId: Dashboard.getCurrentUserId(), MaxStartDate: nextDay.toISOString(), MinEndDate: date.toISOString(), @@ -451,13 +451,13 @@ var page = this; - apiClient.getLiveTvGuideInfo().done(function (guideInfo) { + ApiClient.getLiveTvGuideInfo().done(function (guideInfo) { setDateRange(page, guideInfo); }); }); -})(jQuery, document, ApiClient); +})(jQuery, document); (function ($, document, window) { diff --git a/dashboard-ui/scripts/livetvnewrecording.js b/dashboard-ui/scripts/livetvnewrecording.js index e9aa161115..e6050bd338 100644 --- a/dashboard-ui/scripts/livetvnewrecording.js +++ b/dashboard-ui/scripts/livetvnewrecording.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var currentProgram; @@ -47,8 +47,8 @@ var programId = getParameterByName('programid'); - var promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId }); - var promise2 = apiClient.getLiveTvProgram(programId, Dashboard.getCurrentUserId()); + var promise1 = ApiClient.getNewLiveTvTimerDefaults({ programId: programId }); + var promise2 = ApiClient.getLiveTvProgram(programId, Dashboard.getCurrentUserId()); $.when(promise1, promise2).done(function (response1, response2) { @@ -108,7 +108,7 @@ var programId = getParameterByName('programid'); - apiClient.getNewLiveTvTimerDefaults({ programId: programId }).done(function (item) { + ApiClient.getNewLiveTvTimerDefaults({ programId: programId }).done(function (item) { item.PrePaddingSeconds = $('#txtPrePaddingSeconds', form).val() * 60; item.PostPaddingSeconds = $('#txtPostPaddingSeconds', form).val() * 60; @@ -123,7 +123,7 @@ if ($('#chkRecordSeries', form).checked()) { - apiClient.createLiveTvSeriesTimer(item).done(function () { + ApiClient.createLiveTvSeriesTimer(item).done(function () { Dashboard.hideLoadingMsg(); Dashboard.navigate('livetvseriestimers.html'); @@ -131,7 +131,7 @@ }); } else { - apiClient.createLiveTvTimer(item).done(function () { + ApiClient.createLiveTvTimer(item).done(function () { Dashboard.hideLoadingMsg(); Dashboard.navigate('livetvtimers.html'); @@ -185,4 +185,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvprogram.js b/dashboard-ui/scripts/livetvprogram.js index 04b4680367..26bada1887 100644 --- a/dashboard-ui/scripts/livetvprogram.js +++ b/dashboard-ui/scripts/livetvprogram.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var currentItem; @@ -132,4 +132,4 @@ currentItem = null; }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvrecording.js b/dashboard-ui/scripts/livetvrecording.js index 7d32bf5662..6d2cdc34e4 100644 --- a/dashboard-ui/scripts/livetvrecording.js +++ b/dashboard-ui/scripts/livetvrecording.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var currentItem; @@ -90,7 +90,7 @@ var id = getParameterByName('id'); - apiClient.getLiveTvRecording(id, Dashboard.getCurrentUserId()).done(function (result) { + ApiClient.getLiveTvRecording(id, Dashboard.getCurrentUserId()).done(function (result) { renderRecording(page, result); @@ -115,4 +115,4 @@ currentItem = null; }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvrecordings.js b/dashboard-ui/scripts/livetvrecordings.js index 9efeefa4f9..2db1909550 100644 --- a/dashboard-ui/scripts/livetvrecordings.js +++ b/dashboard-ui/scripts/livetvrecordings.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function getRecordingGroupHtml(group) { @@ -67,7 +67,7 @@ Dashboard.showLoadingMsg(); - apiClient.getLiveTvRecordings({ + ApiClient.getLiveTvRecordings({ userId: Dashboard.getCurrentUserId(), IsInProgress: true @@ -78,7 +78,7 @@ }); - apiClient.getLiveTvRecordings({ + ApiClient.getLiveTvRecordings({ userId: Dashboard.getCurrentUserId(), limit: 12, @@ -90,7 +90,7 @@ }); - apiClient.getLiveTvRecordingGroups({ + ApiClient.getLiveTvRecordingGroups({ userId: Dashboard.getCurrentUserId() @@ -109,4 +109,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvseriestimer.js b/dashboard-ui/scripts/livetvseriestimer.js index 0ddb3fa77a..d72eef7f48 100644 --- a/dashboard-ui/scripts/livetvseriestimer.js +++ b/dashboard-ui/scripts/livetvseriestimer.js @@ -1,4 +1,4 @@ -(function (window, $, document, apiClient) { +(function (window, $, document) { var currentItem; @@ -105,7 +105,7 @@ var form = this; - apiClient.getLiveTvSeriesTimer(currentItem.Id).done(function (item) { + ApiClient.getLiveTvSeriesTimer(currentItem.Id).done(function (item) { item.PrePaddingSeconds = $('#txtPrePaddingSeconds', form).val() * 60; item.PostPaddingSeconds = $('#txtPostPaddingSeconds', form).val() * 60; @@ -235,13 +235,13 @@ var id = getParameterByName('id'); - apiClient.getLiveTvSeriesTimer(id).done(function (result) { + ApiClient.getLiveTvSeriesTimer(id).done(function (result) { renderTimer(page, result); }); - apiClient.getLiveTvRecordings({ + ApiClient.getLiveTvRecordings({ userId: Dashboard.getCurrentUserId(), seriesTimerId: id @@ -252,7 +252,7 @@ }); - apiClient.getLiveTvTimers({ + ApiClient.getLiveTvTimers({ seriesTimerId: id @@ -297,4 +297,4 @@ window.LiveTvSeriesTimerPage = new liveTvSeriesTimerPage(); -})(window, jQuery, document, ApiClient); \ No newline at end of file +})(window, jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvseriestimers.js b/dashboard-ui/scripts/livetvseriestimers.js index 9e903ebf1a..db7df3ae32 100644 --- a/dashboard-ui/scripts/livetvseriestimers.js +++ b/dashboard-ui/scripts/livetvseriestimers.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { var query = { @@ -93,7 +93,7 @@ Dashboard.showLoadingMsg(); - apiClient.getLiveTvSeriesTimers(query).done(function (result) { + ApiClient.getLiveTvSeriesTimers(query).done(function (result) { renderTimers(page, result.Items); @@ -143,4 +143,4 @@ updateFilterControls(this); }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvsuggested.js b/dashboard-ui/scripts/livetvsuggested.js index f7b3409810..03b8e91af7 100644 --- a/dashboard-ui/scripts/livetvsuggested.js +++ b/dashboard-ui/scripts/livetvsuggested.js @@ -1,10 +1,10 @@ -(function ($, document, apiClient) { +(function ($, document) { function reload(page) { Dashboard.showLoadingMsg(); - apiClient.getLiveTvRecommendedPrograms({ + ApiClient.getLiveTvRecommendedPrograms({ userId: Dashboard.getCurrentUserId(), IsAiring: true, @@ -26,7 +26,7 @@ $('.activeProgramItems', page).html(html).createCardMenus(); }); - apiClient.getLiveTvRecommendedPrograms({ + ApiClient.getLiveTvRecommendedPrograms({ userId: Dashboard.getCurrentUserId(), IsAiring: false, @@ -58,4 +58,4 @@ }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvtimer.js b/dashboard-ui/scripts/livetvtimer.js index 619b2ac507..349ee34eb7 100644 --- a/dashboard-ui/scripts/livetvtimer.js +++ b/dashboard-ui/scripts/livetvtimer.js @@ -1,4 +1,4 @@ -(function (window, $, document, apiClient) { +(function (window, $, document) { var currentItem; @@ -73,7 +73,7 @@ var form = this; - apiClient.getLiveTvTimer(currentItem.Id).done(function (item) { + ApiClient.getLiveTvTimer(currentItem.Id).done(function (item) { item.PrePaddingSeconds = $('#txtPrePaddingSeconds', form).val() * 60; item.PostPaddingSeconds = $('#txtPostPaddingSeconds', form).val() * 60; @@ -96,7 +96,7 @@ var id = getParameterByName('id'); - apiClient.getLiveTvTimer(id).done(function (result) { + ApiClient.getLiveTvTimer(id).done(function (result) { renderTimer(page, result); @@ -133,4 +133,4 @@ window.LiveTvTimerPage = new liveTvTimerPage(); -})(window, jQuery, document, ApiClient); \ No newline at end of file +})(window, jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/livetvtimers.js b/dashboard-ui/scripts/livetvtimers.js index d9a8066efb..83b6027018 100644 --- a/dashboard-ui/scripts/livetvtimers.js +++ b/dashboard-ui/scripts/livetvtimers.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function deleteTimer(page, id) { @@ -100,7 +100,7 @@ Dashboard.showLoadingMsg(); - apiClient.getLiveTvTimers().done(function (result) { + ApiClient.getLiveTvTimers().done(function (result) { renderTimers(page, result.Items); @@ -114,4 +114,4 @@ reload(page); }); -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/mypreferencesdisplay.js b/dashboard-ui/scripts/mypreferencesdisplay.js index 96006caef2..32c86713e1 100644 --- a/dashboard-ui/scripts/mypreferencesdisplay.js +++ b/dashboard-ui/scripts/mypreferencesdisplay.js @@ -237,6 +237,7 @@ $('.lnkDisplayPreferences', page).attr('href', 'mypreferencesdisplay.html?userId=' + userId); $('.lnkLanguagePreferences', page).attr('href', 'mypreferenceslanguages.html?userId=' + userId); $('.lnkWebClientPreferences', page).attr('href', 'mypreferenceswebclient.html?userId=' + userId); + $('.lnkMyProfile', page).attr('href', 'myprofile.html?userId=' + userId); }); window.DisplayPreferencesPage = { diff --git a/dashboard-ui/scripts/userimagepage.js b/dashboard-ui/scripts/myprofile.js similarity index 87% rename from dashboard-ui/scripts/userimagepage.js rename to dashboard-ui/scripts/myprofile.js index 5368c70b0d..2735df4b3b 100644 --- a/dashboard-ui/scripts/userimagepage.js +++ b/dashboard-ui/scripts/myprofile.js @@ -10,6 +10,7 @@ ApiClient.getUser(userId).done(function (user) { + $('.username', page).html(user.Name); $('#uploadUserImage', page).val('').trigger('change'); Dashboard.setPageTitle(user.Name); @@ -22,24 +23,24 @@ type: "Primary" }); - $('#fldImage', page).show().html('').html(""); + $('#fldImage', page).show().html('').html(""); } if (user.ConnectLinkType == 'Guest') { - $('.newImageSection', page).hide(); - $('#fldDeleteImage', page).hide(); + $('.newImageForm', page).hide(); + $('#btnDeleteImage', page).hide(); } else if (user.PrimaryImageTag) { - $('#fldDeleteImage', page).show(); + $('#btnDeleteImage', page).show(); $('#headerUploadNewImage', page).show(); - $('.newImageSection', page).show(); + $('.newImageForm', page).show(); } else { $('.newImageSection', page).show(); $('#fldImage', page).hide().html(''); - $('#fldDeleteImage', page).hide(); + $('#btnDeleteImage', page).hide(); $('#headerUploadNewImage', page).hide(); } @@ -139,11 +140,11 @@ return false; } - function userImagePage() { + function myProfilePage() { var self = this; - self.onSubmit = function () { + self.onImageSubmit = function () { var file = currentFile; @@ -164,29 +165,13 @@ return false; }; - self.deleteImage = function () { - - Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('DeleteImage'), function (result) { - - if (result) { - - Dashboard.showLoadingMsg(); - - var userId = getParameterByName("userId"); - - ApiClient.deleteUserImage(userId, "primary").done(processImageChangeResult); - } - - }); - }; - self.onFileUploadChange = function (fileUpload) { setFiles($.mobile.activePage, fileUpload.files); }; } - window.UserImagePage = new userImagePage(); + window.MyProfilePage = new myProfilePage(); $(document).on('pagebeforeshow', "#userImagePage", function () { @@ -201,7 +186,7 @@ } }); - }).on('pageshow', "#userImagePage", function () { + }).on('pageinit', "#userImagePage", function () { var page = this; @@ -209,11 +194,21 @@ $("#userImageDropZone", page).on('dragover', onImageDragOver).on('drop', onImageDrop); - }).on('pagehide', "#userImagePage", function () { + $('#btnDeleteImage', page).on('click', function () { - var page = this; + Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('DeleteImage'), function (result) { - $("#userImageDropZone", page).off('dragover', onImageDragOver).off('drop', onImageDrop); + if (result) { + + Dashboard.showLoadingMsg(); + + var userId = getParameterByName("userId"); + + ApiClient.deleteUserImage(userId, "primary").done(processImageChangeResult); + } + + }); + }); }); diff --git a/dashboard-ui/scripts/serversecurity.js b/dashboard-ui/scripts/serversecurity.js index 0592032e37..2e0a0f6379 100644 --- a/dashboard-ui/scripts/serversecurity.js +++ b/dashboard-ui/scripts/serversecurity.js @@ -1,4 +1,4 @@ -(function ($, document, apiClient) { +(function ($, document) { function revoke(page, key) { @@ -10,7 +10,7 @@ ApiClient.ajax({ type: "DELETE", - url: apiClient.getUrl('Auth/Keys/' + key) + url: ApiClient.getUrl('Auth/Keys/' + key) }).done(function () { @@ -125,7 +125,7 @@ ApiClient.ajax({ type: "POST", - url: apiClient.getUrl('Auth/Keys/', { + url: ApiClient.getUrl('Auth/Keys/', { App: $('#txtAppName', form).val() @@ -142,4 +142,4 @@ } }; -})(jQuery, document, ApiClient); \ No newline at end of file +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 632f45f432..162bd30b7d 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -97,6 +97,32 @@ var Dashboard = { return store.getItem('token'); }, + serverAddress: function (val) { + + if (val != null) { + store.setItem('serverAddress', val); + } + + var address = store.getItem('serverAddress'); + + if (!address) { + var loc = window.location; + + address = loc.protocol + '//' + loc.hostname; + + if (loc.port) { + address += ':' + loc.port; + } + } + + return address; + }, + + changeServer: function () { + + + }, + getCurrentUserId: function () { var autoLoginUserId = getParameterByName('u'); @@ -1165,7 +1191,7 @@ var Dashboard = { alert(Globalize.translate('MessageBrowserDoesNotSupportWebSockets')); } - window.ApiClient = MediaBrowser.ApiClient.create("Dashboard", window.dashboardVersion, MediaBrowser.ApiClient.generateDeviceName(), MediaBrowser.ApiClient.generateDeviceId()); + window.ApiClient = new MediaBrowser.ApiClient(Dashboard.serverAddress(), "Dashboard", window.dashboardVersion, MediaBrowser.ApiClient.generateDeviceName(), MediaBrowser.ApiClient.generateDeviceId()); $(ApiClient).on("websocketopen", Dashboard.onWebSocketOpened) .on("websocketmessage", Dashboard.onWebSocketMessageReceived); diff --git a/dashboard-ui/scripts/useredit.js b/dashboard-ui/scripts/useredit.js index 047453da81..ac3fdeada7 100644 --- a/dashboard-ui/scripts/useredit.js +++ b/dashboard-ui/scripts/useredit.js @@ -260,6 +260,7 @@ var page = this; loadData(page); + }); })(jQuery, window, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/userlibraryaccess.js b/dashboard-ui/scripts/userlibraryaccess.js index 113c6e5ae6..3c01606194 100644 --- a/dashboard-ui/scripts/userlibraryaccess.js +++ b/dashboard-ui/scripts/userlibraryaccess.js @@ -58,6 +58,8 @@ function loadUser(page, user, loggedInUser, mediaFolders, channels) { + $(page).trigger('userloaded', [user]); + Dashboard.setPageTitle(user.Name); loadChannels(page, user, channels); diff --git a/dashboard-ui/thirdparty/apiclient/connectionmanager.js b/dashboard-ui/thirdparty/apiclient/connectionmanager.js new file mode 100644 index 0000000000..7ec8ac3539 --- /dev/null +++ b/dashboard-ui/thirdparty/apiclient/connectionmanager.js @@ -0,0 +1,20 @@ +if (!window.MediaBrowser) { + window.MediaBrowser = {}; +} + +MediaBrowser.ConnectionManager = function () { + + return function () { + + var self = this; + + self.getServers = function (currentApiClient) { + + }; + + self.changeServer = function (currentApiClient, server) { + + }; + }; + +}(); \ No newline at end of file diff --git a/dashboard-ui/thirdparty/mediabrowser.apiclient.js b/dashboard-ui/thirdparty/apiclient/mediabrowser.apiclient.js similarity index 93% rename from dashboard-ui/thirdparty/mediabrowser.apiclient.js rename to dashboard-ui/thirdparty/apiclient/mediabrowser.apiclient.js index 9dd9b11395..0826747b01 100644 --- a/dashboard-ui/thirdparty/mediabrowser.apiclient.js +++ b/dashboard-ui/thirdparty/apiclient/mediabrowser.apiclient.js @@ -2279,7 +2279,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi var url = self.getUrl("Users/authenticatebyname"); var postData = { - password: MediaBrowser.SHA1(password || ""), + password: sha1(password || ""), Username: name }; @@ -2292,32 +2292,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; - /** - * Authenticates a user - * @param {String} userId - * @param {String} password - */ - self.authenticateUser = function (userId, password) { - - if (!userId) { - throw new Error("null userId"); - } - - var url = self.getUrl("Users/" + userId + "/authenticate"); - - var postData = { - password: MediaBrowser.SHA1(password || "") - }; - - return self.ajax({ - type: "POST", - url: url, - data: JSON.stringify(postData), - dataType: "json", - contentType: "application/json" - }); - }; - /** * Updates a user's password * @param {String} userId @@ -2336,7 +2310,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }; - postData.currentPassword = MediaBrowser.SHA1(currentPassword); + postData.currentPassword = sha1(currentPassword); if (newPassword) { postData.newPassword = newPassword; @@ -3237,7 +3211,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi } keys.push(randomId); - return MediaBrowser.SHA1(keys.join('|')); + return sha1(keys.join('|')); }; MediaBrowser.ApiClient.generateDeviceName = function () { @@ -3274,194 +3248,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi })(window.store); -/** - * Provides a friendly way to create an api client instance using information from the browser's current url - */ -MediaBrowser.ApiClient.create = function (clientName, applicationVersion, deviceName, deviceId) { - - var loc = window.location; - - var address = loc.protocol + '//' + loc.hostname; - - if (loc.port) { - address += ':' + loc.port; - } - - return new MediaBrowser.ApiClient(address, clientName, applicationVersion, deviceName, deviceId); -}; - -/** -* -* Secure Hash Algorithm (SHA1) -* http://www.webtoolkit.info/ -* -**/ -MediaBrowser.SHA1 = function (msg) { - - function rotate_left(n, s) { - var t4 = (n << s) | (n >>> (32 - s)); - return t4; - } - - function lsb_hex(val) { - var str = ""; - var i; - var vh; - var vl; - - for (i = 0; i <= 6; i += 2) { - vh = (val >>> (i * 4 + 4)) & 0x0f; - vl = (val >>> (i * 4)) & 0x0f; - str += vh.toString(16) + vl.toString(16); - } - return str; - } - - function cvt_hex(val) { - var str = ""; - var i; - var v; - - for (i = 7; i >= 0; i--) { - v = (val >>> (i * 4)) & 0x0f; - str += v.toString(16); - } - return str; - } - - function Utf8Encode(string) { - string = string.replace(/\r\n/g, "\n"); - var utftext = ""; - - for (var n = 0; n < string.length; n++) { - - var c = string.charCodeAt(n); - - if (c < 128) { - utftext += String.fromCharCode(c); - } - else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } - else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - - return utftext; - } - - var blockstart; - var i, j; - var W = new Array(80); - var H0 = 0x67452301; - var H1 = 0xEFCDAB89; - var H2 = 0x98BADCFE; - var H3 = 0x10325476; - var H4 = 0xC3D2E1F0; - var A, B, C, D, E; - var temp; - - msg = Utf8Encode(msg); - - var msg_len = msg.length; - - var word_array = new Array(); - for (i = 0; i < msg_len - 3; i += 4) { - j = msg.charCodeAt(i) << 24 | msg.charCodeAt(i + 1) << 16 | - msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3); - word_array.push(j); - } - - switch (msg_len % 4) { - case 0: - i = 0x080000000; - break; - case 1: - i = msg.charCodeAt(msg_len - 1) << 24 | 0x0800000; - break; - - case 2: - i = msg.charCodeAt(msg_len - 2) << 24 | msg.charCodeAt(msg_len - 1) << 16 | 0x08000; - break; - - case 3: - i = msg.charCodeAt(msg_len - 3) << 24 | msg.charCodeAt(msg_len - 2) << 16 | msg.charCodeAt(msg_len - 1) << 8 | 0x80; - break; - } - - word_array.push(i); - - while ((word_array.length % 16) != 14) word_array.push(0); - - word_array.push(msg_len >>> 29); - word_array.push((msg_len << 3) & 0x0ffffffff); - - - for (blockstart = 0; blockstart < word_array.length; blockstart += 16) { - - for (i = 0; i < 16; i++) W[i] = word_array[blockstart + i]; - for (i = 16; i <= 79; i++) W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); - - A = H0; - B = H1; - C = H2; - D = H3; - E = H4; - - for (i = 0; i <= 19; i++) { - temp = (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff; - E = D; - D = C; - C = rotate_left(B, 30); - B = A; - A = temp; - } - - for (i = 20; i <= 39; i++) { - temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff; - E = D; - D = C; - C = rotate_left(B, 30); - B = A; - A = temp; - } - - for (i = 40; i <= 59; i++) { - temp = (rotate_left(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff; - E = D; - D = C; - C = rotate_left(B, 30); - B = A; - A = temp; - } - - for (i = 60; i <= 79; i++) { - temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff; - E = D; - D = C; - C = rotate_left(B, 30); - B = A; - A = temp; - } - - H0 = (H0 + A) & 0x0ffffffff; - H1 = (H1 + B) & 0x0ffffffff; - H2 = (H2 + C) & 0x0ffffffff; - H3 = (H3 + D) & 0x0ffffffff; - H4 = (H4 + E) & 0x0ffffffff; - - } - - var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4); - - return temp.toLowerCase(); -}; - (function (jQuery, window, undefined) { "use strict"; diff --git a/dashboard-ui/thirdparty/apiclient/sha1.js b/dashboard-ui/thirdparty/apiclient/sha1.js new file mode 100644 index 0000000000..9ea527331f --- /dev/null +++ b/dashboard-ui/thirdparty/apiclient/sha1.js @@ -0,0 +1,171 @@ +/** +* +* Secure Hash Algorithm (SHA1) +* http://www.webtoolkit.info/ +* +**/ +var sha1 = function (msg) { + + function rotate_left(n, s) { + var t4 = (n << s) | (n >>> (32 - s)); + return t4; + } + + function lsb_hex(val) { + var str = ""; + var i; + var vh; + var vl; + + for (i = 0; i <= 6; i += 2) { + vh = (val >>> (i * 4 + 4)) & 0x0f; + vl = (val >>> (i * 4)) & 0x0f; + str += vh.toString(16) + vl.toString(16); + } + return str; + } + + function cvt_hex(val) { + var str = ""; + var i; + var v; + + for (i = 7; i >= 0; i--) { + v = (val >>> (i * 4)) & 0x0f; + str += v.toString(16); + } + return str; + } + + function Utf8Encode(string) { + string = string.replace(/\r\n/g, "\n"); + var utftext = ""; + + for (var n = 0; n < string.length; n++) { + + var c = string.charCodeAt(n); + + if (c < 128) { + utftext += String.fromCharCode(c); + } + else if ((c > 127) && (c < 2048)) { + utftext += String.fromCharCode((c >> 6) | 192); + utftext += String.fromCharCode((c & 63) | 128); + } + else { + utftext += String.fromCharCode((c >> 12) | 224); + utftext += String.fromCharCode(((c >> 6) & 63) | 128); + utftext += String.fromCharCode((c & 63) | 128); + } + + } + + return utftext; + } + + var blockstart; + var i, j; + var W = new Array(80); + var H0 = 0x67452301; + var H1 = 0xEFCDAB89; + var H2 = 0x98BADCFE; + var H3 = 0x10325476; + var H4 = 0xC3D2E1F0; + var A, B, C, D, E; + var temp; + + msg = Utf8Encode(msg); + + var msg_len = msg.length; + + var word_array = new Array(); + for (i = 0; i < msg_len - 3; i += 4) { + j = msg.charCodeAt(i) << 24 | msg.charCodeAt(i + 1) << 16 | + msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3); + word_array.push(j); + } + + switch (msg_len % 4) { + case 0: + i = 0x080000000; + break; + case 1: + i = msg.charCodeAt(msg_len - 1) << 24 | 0x0800000; + break; + + case 2: + i = msg.charCodeAt(msg_len - 2) << 24 | msg.charCodeAt(msg_len - 1) << 16 | 0x08000; + break; + + case 3: + i = msg.charCodeAt(msg_len - 3) << 24 | msg.charCodeAt(msg_len - 2) << 16 | msg.charCodeAt(msg_len - 1) << 8 | 0x80; + break; + } + + word_array.push(i); + + while ((word_array.length % 16) != 14) word_array.push(0); + + word_array.push(msg_len >>> 29); + word_array.push((msg_len << 3) & 0x0ffffffff); + + + for (blockstart = 0; blockstart < word_array.length; blockstart += 16) { + + for (i = 0; i < 16; i++) W[i] = word_array[blockstart + i]; + for (i = 16; i <= 79; i++) W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + A = H0; + B = H1; + C = H2; + D = H3; + E = H4; + + for (i = 0; i <= 19; i++) { + temp = (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff; + E = D; + D = C; + C = rotate_left(B, 30); + B = A; + A = temp; + } + + for (i = 20; i <= 39; i++) { + temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff; + E = D; + D = C; + C = rotate_left(B, 30); + B = A; + A = temp; + } + + for (i = 40; i <= 59; i++) { + temp = (rotate_left(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff; + E = D; + D = C; + C = rotate_left(B, 30); + B = A; + A = temp; + } + + for (i = 60; i <= 79; i++) { + temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff; + E = D; + D = C; + C = rotate_left(B, 30); + B = A; + A = temp; + } + + H0 = (H0 + A) & 0x0ffffffff; + H1 = (H1 + B) & 0x0ffffffff; + H2 = (H2 + C) & 0x0ffffffff; + H3 = (H3 + D) & 0x0ffffffff; + H4 = (H4 + E) & 0x0ffffffff; + + } + + var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4); + + return temp.toLowerCase(); +}; diff --git a/dashboard-ui/useredit.html b/dashboard-ui/useredit.html index 74cf5616fd..de73ed6e20 100644 --- a/dashboard-ui/useredit.html +++ b/dashboard-ui/useredit.html @@ -11,7 +11,6 @@