diff --git a/dashboard-ui/css/card.css b/dashboard-ui/css/card.css index cee9051ffe..6fa7ebefe7 100644 --- a/dashboard-ui/css/card.css +++ b/dashboard-ui/css/card.css @@ -89,6 +89,11 @@ background: #fff; } +.visualCardBox-b { + border-radius: 3px; + background: #111; +} + .cardScalable { position: relative; } @@ -125,7 +130,7 @@ right: 0; } - /*.cardContent:hover { +/*.cardContent:hover { -moz-box-shadow: 0 0 0 5px #38c; -webkit-box-shadow: 0 0 0 5px #38c; box-shadow: 0 0 0 5px #38c; @@ -723,4 +728,4 @@ .touch .mobileItemsContainer .homePageSquareCard { max-width: 200px; -}*/ \ No newline at end of file +}*/ diff --git a/dashboard-ui/css/images/server.png b/dashboard-ui/css/images/server.png new file mode 100644 index 0000000000..85818b8ef1 Binary files /dev/null and b/dashboard-ui/css/images/server.png differ diff --git a/dashboard-ui/css/librarybrowser.css b/dashboard-ui/css/librarybrowser.css index 1f18d14891..7aab4a7950 100644 --- a/dashboard-ui/css/librarybrowser.css +++ b/dashboard-ui/css/librarybrowser.css @@ -108,6 +108,13 @@ top: 3px; } +@media all and (min-width: 600px) { + + .ehsContent { + width: 95%; + } +} + @media all and (min-width: 1200px) { .ehsContent { diff --git a/dashboard-ui/css/mediaplayer.css b/dashboard-ui/css/mediaplayer.css index 1cbb3bc10f..56f5059d90 100644 --- a/dashboard-ui/css/mediaplayer.css +++ b/dashboard-ui/css/mediaplayer.css @@ -90,7 +90,7 @@ } .sliderContainer .ui-slider-track { - margin-left: 15px !important; + margin: 0 15px !important; } .volumeSliderContainer .ui-slider-track { diff --git a/dashboard-ui/css/site.css b/dashboard-ui/css/site.css index 04aa43678a..9a5363a0f2 100644 --- a/dashboard-ui/css/site.css +++ b/dashboard-ui/css/site.css @@ -42,7 +42,7 @@ /* For some reason jquery mobile 1.4.5 wants to horitontally pad mini form fields. */ .ui-mini { - margin: .5em 0; + margin-left: 0; } * { diff --git a/dashboard-ui/scripts/medialibrarypage.js b/dashboard-ui/scripts/medialibrarypage.js index 01becfb6c8..12c0cab272 100644 --- a/dashboard-ui/scripts/medialibrarypage.js +++ b/dashboard-ui/scripts/medialibrarypage.js @@ -111,7 +111,7 @@ html += ''; if (addPathMappingInfo) { - html += '

'+Globalize.translate('LabelPathSubstitutionHelp')+'

'; + html += '
' + Globalize.translate('LabelPathSubstitutionHelp') + '
'; } html += '

'; diff --git a/dashboard-ui/scripts/selectserver.js b/dashboard-ui/scripts/selectserver.js index 3f6a66097c..286d25f884 100644 --- a/dashboard-ui/scripts/selectserver.js +++ b/dashboard-ui/scripts/selectserver.js @@ -37,6 +37,58 @@ }); } + function getServerHtml(server) { + + var html = ''; + + var cssClass = "card homePageSquareCard alternateHover bottomPaddedCard"; + + html += "

"; + + html += '
'; + html += '
'; + + html += '
'; + + var href = "#"; + html += ''; + + var imgUrl = 'css/images/server.png'; + + html += '
'; + + html += "
"; + + // cardContent + html += "
"; + + // cardScalable + html += "
"; + + html += '
'; + + html += '
'; + + //html += ''; + + html += "
"; + + html += '
'; + html += server.Name; + html += "
"; + + // cardFooter + html += "
"; + + // cardBox + html += "
"; + + // card + html += "
"; + + return html; + } + function renderServers(page, servers) { if (servers.length) { @@ -45,27 +97,9 @@ $('.noServersMessage', page).show(); } - var html = ''; + html += servers.map(getServerHtml).join(''); var elem = $('.serverList', page).html(html).trigger('create'); @@ -78,6 +112,205 @@ connectToServer(page, server); }); + + $('.btnServerMenu', elem).on('click', function () { + showServerMenu(this); + }); + } + + function showGeneralError() { + + // Need the timeout because jquery mobile will not show a popup if there's currently already one in the process of closing + setTimeout(function () { + + Dashboard.hideLoadingMsg(); + Dashboard.alert({ + message: Globalize.translate('DefaultErrorMessage') + }); + }, 300); + + } + + function acceptInvitation(page, id) { + + Dashboard.showLoadingMsg(); + + // Add/Update connect info + ConnectionManager.acceptServer(id).done(function () { + + Dashboard.hideLoadingMsg(); + loadPage(page); + + }).fail(function () { + + showGeneralError(); + }); + } + + function rejectInvitation(page, id) { + + Dashboard.showLoadingMsg(); + + // Add/Update connect info + ConnectionManager.deleteServer(id).done(function () { + + Dashboard.hideLoadingMsg(); + loadPage(page); + + }).fail(function () { + + showGeneralError(); + + }); + } + + function showServerMenu(elem) { + + var card = $(elem).parents('.card'); + var page = $(elem).parents('.page'); + var id = card.attr('data-id'); + + $('.serverMenu', page).popup("close").remove(); + + var html = '
'; + + html += ''; + + html += '
'; + + page.append(html); + + var flyout = $('.serverMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () { + + $(this).off("popupafterclose").remove(); + + }); + + $('.btnDelete', flyout).on('click', function () { + rejectInvitation(page, this.getAttribute('data-id')); + $('.serverMenu', page).popup("close").remove(); + }); + } + + function showPendingInviteMenu(elem) { + + var card = $(elem).parents('.card'); + var page = $(elem).parents('.page'); + var id = card.attr('data-id'); + + $('.inviteMenu', page).popup("close").remove(); + + var html = '
'; + + html += ''; + + html += '
'; + + page.append(html); + + var flyout = $('.inviteMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () { + + $(this).off("popupafterclose").remove(); + + }); + + $('.btnAccept', flyout).on('click', function () { + acceptInvitation(page, this.getAttribute('data-id')); + $('.inviteMenu', page).popup("close").remove(); + }); + + $('.btnReject', flyout).on('click', function () { + rejectInvitation(page, this.getAttribute('data-id')); + $('.inviteMenu', page).popup("close").remove(); + }); + } + + function getPendingInviteHtml(invite) { + + var html = ''; + + var cssClass = "card homePageSquareCard alternateHover bottomPaddedCard"; + + html += "
"; + + html += '
'; + html += '
'; + + html += '
'; + + var href = "#"; + html += ''; + + var imgUrl = 'css/images/server.png'; + + html += '
'; + + html += "
"; + + // cardContent + html += "
"; + + // cardScalable + html += "
"; + + html += '
'; + + html += '
'; + + html += ''; + html += "
"; + + html += '
'; + html += invite.Name; + html += "
"; + + // cardFooter + html += "
"; + + // cardBox + html += "
"; + + // card + html += "
"; + + return html; + } + + function renderInvitations(page, list) { + + if (list.length) { + $('.invitationSection', page).show(); + } else { + $('.invitationSection', page).hide(); + } + + var html = list.map(getPendingInviteHtml).join(''); + + var elem = $('.invitationList', page).html(html).trigger('create'); + + $('.btnInviteMenu', elem).on('click', function () { + showPendingInviteMenu(this); + }); + } + + function loadInvitations(page) { + + ConnectionManager.getUserInvitations().done(function (list) { + + renderInvitations(page, list); + + }); } function loadPage(page) { @@ -90,6 +323,8 @@ Dashboard.hideLoadingMsg(); }); + + loadInvitations(page); } $(document).on('pageshow', "#selectServerPage", function () { diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 005dc62603..b761374ab6 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -437,7 +437,7 @@ var Dashboard = { Dashboard.alert("Settings saved."); }, - defaultErrorMessage: "There was an error processing the request.", + defaultErrorMessage: Globalize.translate('DefaultErrorMessage'), processServerConfigurationUpdateResult: function (result) { @@ -567,11 +567,13 @@ var Dashboard = { html += '
'; + var isConnectMode = Dashboard.isConnectMode(); + if (user.localUser && user.localUser.Configuration.EnableUserPreferenceAccess) { html += '

' + Globalize.translate('ButtonMyPreferences') + ''; } - if (Dashboard.isConnectMode()) { + if (isConnectMode) { html += '

' + Globalize.translate('ButtonSelectServer') + ''; } diff --git a/dashboard-ui/scripts/userparentalcontrol.js b/dashboard-ui/scripts/userparentalcontrol.js index d4bd4d5abd..521893e55d 100644 --- a/dashboard-ui/scripts/userparentalcontrol.js +++ b/dashboard-ui/scripts/userparentalcontrol.js @@ -111,12 +111,6 @@ Dashboard.hideLoadingMsg(); } - function getDisplayTime(hour) { - - return new Date(2000, 1, 1, hour, 0, 0, 0).toLocaleTimeString(); - - } - function deleteAccessSchedule(page, schedules, index) { schedules.splice(index, 1); @@ -214,6 +208,19 @@ } }; + function getDisplayTime(hours) { + + var minutes = 0; + + var pct = hours % 1; + + if (pct) { + minutes = parseInt(pct * 60); + } + + return new Date(2000, 1, 1, hours, minutes, 0, 0).toLocaleTimeString(); + } + function populateHours(page) { var html = ''; @@ -223,6 +230,8 @@ html += ''; } + html += ''; + $('#selectStart', page).html(html).selectmenu('refresh'); $('#selectEnd', page).html(html).selectmenu('refresh'); } @@ -290,7 +299,7 @@ $('.btnAddSchedule', page).on('click', function () { - showSchedulePopup(page, {}, -1); + showSchedulePopup(page, {}, -1); }); populateHours(page); diff --git a/dashboard-ui/selectserver.html b/dashboard-ui/selectserver.html index 5b9405cf8d..e1b6273b25 100644 --- a/dashboard-ui/selectserver.html +++ b/dashboard-ui/selectserver.html @@ -8,14 +8,23 @@

-
-

${HeaderSelectServer}

+
+

${HeaderSelectServer}


-
diff --git a/dashboard-ui/thirdparty/apiclient/connectionmanager.js b/dashboard-ui/thirdparty/apiclient/connectionmanager.js index f3b1aca3b9..87bed7d3f6 100644 --- a/dashboard-ui/thirdparty/apiclient/connectionmanager.js +++ b/dashboard-ui/thirdparty/apiclient/connectionmanager.js @@ -751,19 +751,25 @@ }); }; + function replaceAll(str, find, replace) { + + return str.split(find).join(replace); + + //return str.replace(new RegExp(find, 'g'), replace); + } + self.getConnectPasswordHash = function (password) { password = password || ''; - password = password - .replace("&", "&") - .replace("/", "\") - .replace("!", "!") - .replace("$", "$") - .replace("\"", """) - .replace("<", "<") - .replace(">", ">") - .replace("'", "'"); + password = replaceAll(password, "&", "&"); + password = replaceAll(password, "/", "\"); + password = replaceAll(password, "!", "!"); + password = replaceAll(password, "$", "$"); + password = replaceAll(password, "\"", """); + password = replaceAll(password, "<", "<"); + password = replaceAll(password, ">", ">"); + password = replaceAll(password, "'", "'"); return CryptoJS.MD5(password).toString(); }; @@ -784,6 +790,50 @@ })[0]; }; + + self.getUserInvitations = function () { + + var url = "https://connect.mediabrowser.tv/service/servers?userId=" + self.connectUserId() + "&status=Waiting"; + + return $.ajax({ + type: "GET", + url: url, + dataType: "json", + headers: { + "X-Connect-UserToken": self.connectToken() + } + + }); + }; + + self.deleteServer = function (serverId) { + + var url = "https://connect.mediabrowser.tv/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId(); + + return $.ajax({ + type: "DELETE", + url: url, + headers: { + "X-Connect-UserToken": self.connectToken() + } + + }); + }; + + self.acceptServer = function (authorizationId) { + + var url = "https://connect.mediabrowser.tv/service/ServerAuthorizations/accept?id=" + authorizationId; + + return $.ajax({ + type: "GET", + url: url, + headers: { + "X-Connect-UserToken": self.connectToken() + } + + }); + }; + }; })(window, jQuery); \ No newline at end of file