2014-09-13 07:10:30 -07:00
|
|
|
|
(function (document, window, $) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
function renderLibrarySharingList(page, result) {
|
|
|
|
|
|
|
|
|
|
var folderHtml = '';
|
|
|
|
|
|
|
|
|
|
folderHtml += '<div data-role="controlgroup">';
|
|
|
|
|
|
|
|
|
|
folderHtml += result.Items.map(function (i) {
|
|
|
|
|
|
|
|
|
|
var currentHtml = '';
|
|
|
|
|
|
|
|
|
|
var id = 'chkShareFolder' + i.Id;
|
|
|
|
|
|
|
|
|
|
currentHtml += '<label for="' + id + '">' + i.Name + '</label>';
|
|
|
|
|
|
|
|
|
|
var isChecked = true;
|
|
|
|
|
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
|
|
|
|
|
|
|
|
|
currentHtml += '<input data-mini="true" class="chkShareFolder" data-folderid="' + i.Id + '" type="checkbox" id="' + id + '"' + checkedHtml + ' />';
|
|
|
|
|
|
|
|
|
|
return currentHtml;
|
|
|
|
|
|
|
|
|
|
}).join('');
|
|
|
|
|
|
|
|
|
|
folderHtml += '</div>';
|
|
|
|
|
|
|
|
|
|
$('.librarySharingList', page).html(folderHtml).trigger('create');
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
function deleteUser(page, id) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 12:27:29 -07:00
|
|
|
|
$('.userMenu', page).on("popupafterclose.deleteuser", function () {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
$(this).off('popupafterclose.deleteuser');
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
var msg = Globalize.translate('DeleteUserConfirmation');
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
Dashboard.confirm(msg, Globalize.translate('DeleteUser'), function (result) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
if (result) {
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.deleteUser(id).done(function () {
|
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
loadData(page);
|
2014-09-14 08:10:51 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).popup('close');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showUserMenu(elem) {
|
|
|
|
|
|
|
|
|
|
var card = $(elem).parents('.card');
|
|
|
|
|
var page = $(elem).parents('.page');
|
|
|
|
|
var userId = card.attr('data-userid');
|
|
|
|
|
|
|
|
|
|
$('.userMenu', page).popup("close").remove();
|
|
|
|
|
|
2014-10-25 11:32:58 -07:00
|
|
|
|
var html = '<div data-role="popup" class="userMenu" data-theme="a">';
|
2014-09-14 08:10:51 -07:00
|
|
|
|
|
|
|
|
|
html += '<ul data-role="listview" style="min-width: 180px;">';
|
2014-09-15 20:33:30 -07:00
|
|
|
|
html += '<li data-role="list-divider">' + Globalize.translate('HeaderMenu') + '</li>';
|
2014-09-14 08:10:51 -07:00
|
|
|
|
|
|
|
|
|
html += '<li><a href="useredit.html?userid=' + userId + '">' + Globalize.translate('ButtonOpen') + '</a></li>';
|
|
|
|
|
|
2014-10-14 17:05:09 -07:00
|
|
|
|
html += '<li><a href="userlibraryaccess.html?userid=' + userId + '">' + Globalize.translate('ButtonLibraryAccess') + '</a></li>';
|
|
|
|
|
html += '<li><a href="userparentalcontrol.html?userid=' + userId + '">' + Globalize.translate('ButtonParentalControl') + '</a></li>';
|
|
|
|
|
|
|
|
|
|
html += '<li><a href="#" class="btnDeleteUser" data-userid="' + userId + '">' + Globalize.translate('ButtonDelete') + '</a></li>';
|
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
html += '</ul>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
page.append(html);
|
|
|
|
|
|
|
|
|
|
var flyout = $('.userMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () {
|
|
|
|
|
|
|
|
|
|
$(this).off("popupafterclose").remove();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.btnDeleteUser', flyout).on('click', function () {
|
2014-09-23 18:44:05 -07:00
|
|
|
|
deleteUser(page, this.getAttribute('data-userid'));
|
2014-09-13 07:10:30 -07:00
|
|
|
|
});
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
function getUserHtml(user, addConnectIndicator) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
var html = '';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-10-13 21:22:17 -07:00
|
|
|
|
var cssClass = "card squareCard alternateHover bottomPaddedCard";
|
2014-09-14 08:10:51 -07:00
|
|
|
|
|
|
|
|
|
if (user.Configuration.IsDisabled) {
|
|
|
|
|
cssClass += ' grayscale';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += "<div data-userid='" + user.Id + "' class='" + cssClass + "'>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardBox visualCardBox">';
|
|
|
|
|
html += '<div class="cardScalable">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardPadder"></div>';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
var href = "useredit.html?userId=" + user.Id + "";
|
|
|
|
|
html += '<a class="cardContent" href="' + href + '">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
var imgUrl;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
if (user.PrimaryImageTag) {
|
2013-03-30 08:04:59 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
imgUrl = ApiClient.getUserImageUrl(user.Id, {
|
2014-09-14 08:10:51 -07:00
|
|
|
|
width: 300,
|
2014-09-13 07:10:30 -07:00
|
|
|
|
tag: user.PrimaryImageTag,
|
|
|
|
|
type: "Primary"
|
|
|
|
|
});
|
2013-03-29 19:39:36 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
} else {
|
|
|
|
|
imgUrl = 'css/images/userflyoutdefault.png';
|
|
|
|
|
}
|
2013-03-30 08:04:59 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardImage" style="background-image:url(\'' + imgUrl + '\');">';
|
2013-03-30 08:04:59 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
if (user.ConnectUserId && addConnectIndicator) {
|
2014-09-14 12:27:29 -07:00
|
|
|
|
html += '<div class="playedIndicator" title="' + Globalize.translate('TooltipLinkedToMediaBrowserConnect') + '"><div class="ui-icon-cloud ui-btn-icon-notext"></div></div>';
|
2014-09-14 11:47:48 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
// cardContent
|
|
|
|
|
html += "</a>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
// cardScalable
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardFooter">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardText" style="text-align:right; float:right;">';
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
html += '<button class="btnUserMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
|
|
|
|
html += user.Name;
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
// cardFooter
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
// cardBox
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-13 07:10:30 -07:00
|
|
|
|
// card
|
|
|
|
|
html += "</div>";
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
function getUserSectionHtml(users, addConnectIndicator) {
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
var html = '';
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
html += users.map(function (u) {
|
|
|
|
|
|
|
|
|
|
return getUserHtml(u, addConnectIndicator);
|
|
|
|
|
|
|
|
|
|
}).join('');
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
return html;
|
|
|
|
|
}
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
function renderUsersIntoElement(elem, users, addConnectIndicator) {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-13 21:59:34 -07:00
|
|
|
|
var html = getUserSectionHtml(users, addConnectIndicator);
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
|
|
|
|
elem.html(html).trigger('create');
|
|
|
|
|
|
|
|
|
|
$('.btnUserMenu', elem).on('click', function () {
|
|
|
|
|
showUserMenu(this);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
function renderUsers(page, users) {
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-10-13 21:22:17 -07:00
|
|
|
|
renderUsersIntoElement($('.localUsers', page), users.filter(function (u) {
|
|
|
|
|
return u.ConnectLinkType != 'Guest';
|
2014-10-13 21:59:34 -07:00
|
|
|
|
}), true);
|
2014-10-13 21:22:17 -07:00
|
|
|
|
|
|
|
|
|
renderUsersIntoElement($('.connectUsers', page), users.filter(function (u) {
|
|
|
|
|
return u.ConnectLinkType == 'Guest';
|
|
|
|
|
}));
|
2014-10-13 13:14:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showPendingUserMenu(elem) {
|
|
|
|
|
|
|
|
|
|
var card = $(elem).parents('.card');
|
|
|
|
|
var page = $(elem).parents('.page');
|
|
|
|
|
var id = card.attr('data-id');
|
|
|
|
|
|
|
|
|
|
$('.userMenu', page).popup("close").remove();
|
|
|
|
|
|
2014-10-25 11:32:58 -07:00
|
|
|
|
var html = '<div data-role="popup" class="userMenu" data-theme="a">';
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
|
|
|
|
html += '<ul data-role="listview" style="min-width: 180px;">';
|
|
|
|
|
html += '<li data-role="list-divider">' + Globalize.translate('HeaderMenu') + '</li>';
|
|
|
|
|
|
|
|
|
|
html += '<li><a href="#" class="btnDelete" data-id="' + id + '">' + Globalize.translate('ButtonCancel') + '</a></li>';
|
|
|
|
|
|
|
|
|
|
html += '</ul>';
|
|
|
|
|
|
|
|
|
|
html += '</div>';
|
|
|
|
|
|
|
|
|
|
page.append(html);
|
|
|
|
|
|
|
|
|
|
var flyout = $('.userMenu', page).popup({ positionTo: elem || "window" }).trigger('create').popup("open").on("popupafterclose", function () {
|
|
|
|
|
|
|
|
|
|
$(this).off("popupafterclose").remove();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.btnDelete', flyout).on('click', function () {
|
|
|
|
|
cancelAuthorization(page, this.getAttribute('data-id'));
|
|
|
|
|
$('.userMenu', page).popup("close").remove();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPendingUserHtml(user) {
|
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
var html = '';
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-10-13 21:22:17 -07:00
|
|
|
|
var cssClass = "card squareCard alternateHover bottomPaddedCard";
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
|
|
|
|
html += "<div data-id='" + user.Id + "' class='" + cssClass + "'>";
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardBox visualCardBox">';
|
|
|
|
|
html += '<div class="cardScalable">';
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardPadder"></div>';
|
|
|
|
|
|
|
|
|
|
var href = "#";
|
|
|
|
|
html += '<a class="cardContent" href="' + href + '">';
|
|
|
|
|
|
|
|
|
|
var imgUrl = user.ImageUrl || 'css/images/userflyoutdefault.png';
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardImage" style="background-image:url(\'' + imgUrl + '\');">';
|
|
|
|
|
|
|
|
|
|
html += "</div>";
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
// cardContent
|
|
|
|
|
html += "</a>";
|
|
|
|
|
|
|
|
|
|
// cardScalable
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardFooter">';
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardText" style="text-align:right; float:right;">';
|
|
|
|
|
|
|
|
|
|
html += '<button class="btnUserMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
|
|
|
|
html += user.UserName;
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
// cardFooter
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
// cardBox
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
// card
|
|
|
|
|
html += "</div>";
|
|
|
|
|
|
|
|
|
|
return html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function renderPendingGuests(page, users) {
|
|
|
|
|
|
|
|
|
|
if (users.length) {
|
|
|
|
|
$('.sectionPendingGuests', page).show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.sectionPendingGuests', page).hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var html = users.map(getPendingUserHtml).join('');
|
|
|
|
|
|
|
|
|
|
var elem = $('.pending', page).html(html).trigger('create');
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
$('.btnUserMenu', elem).on('click', function () {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
showPendingUserMenu(this);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cancelAuthorization(page, id) {
|
2014-10-13 21:22:17 -07:00
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
// Add/Update connect info
|
|
|
|
|
ApiClient.ajax({
|
|
|
|
|
|
|
|
|
|
type: "DELETE",
|
|
|
|
|
url: ApiClient.getUrl('Connect/Pending', {
|
|
|
|
|
|
|
|
|
|
Id: id
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}).done(function () {
|
|
|
|
|
|
|
|
|
|
loadData(page);
|
|
|
|
|
|
2014-09-14 08:10:51 -07:00
|
|
|
|
});
|
2014-09-13 07:10:30 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
function loadData(page) {
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
|
|
|
|
ApiClient.getUsers().done(function (users) {
|
2014-09-14 08:10:51 -07:00
|
|
|
|
renderUsers(page, users);
|
2014-09-13 07:10:30 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2013-02-20 18:33:05 -07:00
|
|
|
|
});
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-13 21:22:17 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl('Connect/Pending')).done(function (pending) {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
|
|
|
|
renderPendingGuests(page, pending);
|
|
|
|
|
});
|
2014-10-30 21:57:24 -07:00
|
|
|
|
|
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders", { IsHidden: false })).done(function (result) {
|
|
|
|
|
|
|
|
|
|
renderLibrarySharingList(page, result);
|
|
|
|
|
});
|
2014-10-13 13:14:53 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function inviteUser(page) {
|
|
|
|
|
|
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
ApiClient.getJSON(ApiClient.getUrl("Channels", {})).done(function (channelsResult) {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
var shareExcludes = $(".chkShareFolder:not(:checked)", page).get().map(function (i) {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
return i.getAttribute('data-folderid');
|
|
|
|
|
});
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
// Add/Update connect info
|
|
|
|
|
ApiClient.ajax({
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
type: "POST",
|
|
|
|
|
url: ApiClient.getUrl('Connect/Invite'),
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
data: {
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
ConnectUsername: $('#txtConnectUsername', page).val(),
|
|
|
|
|
ExcludedLibraries: shareExcludes.join(','),
|
|
|
|
|
ExcludedChannels: channelsResult.Items.map(function (c) { return c.Id; }).join(','),
|
|
|
|
|
SendingUserId: Dashboard.getCurrentUserId(),
|
|
|
|
|
EnableLiveTv: false
|
|
|
|
|
}
|
2014-10-22 21:26:01 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
}).done(function (result) {
|
2014-10-22 21:26:01 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
$('#popupInvite').popup('close');
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
2014-10-13 13:14:53 -07:00
|
|
|
|
|
2014-10-30 21:57:24 -07:00
|
|
|
|
showNewUserInviteMessage(page, result);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
2013-02-20 18:33:05 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-22 21:26:01 -07:00
|
|
|
|
function showNewUserInviteMessage(page, result) {
|
|
|
|
|
|
|
|
|
|
if (!result.IsNewUserInvitation && !result.IsPending) {
|
|
|
|
|
|
|
|
|
|
// It was immediately approved
|
|
|
|
|
loadData(page);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var message = result.IsNewUserInvitation ?
|
|
|
|
|
Globalize.translate('MessageInvitationSentToNewUser', result.GuestDisplayName) :
|
|
|
|
|
Globalize.translate('MessageInvitationSentToUser', result.GuestDisplayName);
|
|
|
|
|
|
|
|
|
|
// Need a timeout because jquery mobile will not show a popup while a previous one is in the act of closing
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
|
|
Dashboard.alert({
|
|
|
|
|
message: message,
|
|
|
|
|
title: Globalize.translate('HeaderInvitationSent'),
|
|
|
|
|
callback: function () {
|
|
|
|
|
loadData(page);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}, 300);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-13 21:22:17 -07:00
|
|
|
|
function showInvitePopup(page) {
|
|
|
|
|
|
|
|
|
|
$('#popupInvite', page).popup('open');
|
|
|
|
|
|
|
|
|
|
$('#txtConnectUsername', page).val('');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(document).on('pageinit', "#userProfilesPage", function () {
|
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
|
|
|
|
$('.btnInvite', page).on('click', function () {
|
|
|
|
|
|
|
|
|
|
showInvitePopup(page);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}).on('pagebeforeshow', "#userProfilesPage", function () {
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
loadData(page);
|
2014-09-13 07:10:30 -07:00
|
|
|
|
});
|
|
|
|
|
|
2014-10-13 13:14:53 -07:00
|
|
|
|
window.UserProfilesPage = {
|
|
|
|
|
|
|
|
|
|
onSubmit: function () {
|
|
|
|
|
|
|
|
|
|
var form = this;
|
|
|
|
|
|
|
|
|
|
var page = $(form).parents('.page');
|
|
|
|
|
|
|
|
|
|
inviteUser(page);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
2014-09-13 07:10:30 -07:00
|
|
|
|
|
|
|
|
|
})(document, window, jQuery);
|