var UserProfilesPage = { onPageShow: function () { UserProfilesPage.loadPageData(); }, loadPageData: function () { Dashboard.showLoadingMsg(); ApiClient.getUsers().done(UserProfilesPage.renderUsers); }, renderUsers: function (users) { var html = ""; html += '
  • ' + Globalize.translate("Users") + '

  • '; for (var i = 0, length = users.length; i < length; i++) { var user = users[i]; html += "
  • "; html += ""; if (user.PrimaryImageTag) { var url = ApiClient.getUserImageUrl(user.Id, { width: 225, tag: user.PrimaryImageTag, type: "Primary" }); html += ""; } else { html += ""; } html += "

    " + user.Name; html += "

    "; html += "

    "; if (user.Configuration.HasPassword) html += '' + Globalize.translate('; if (user.Configuration.IsAdministrator) html += '' + Globalize.translate('; html += "

    "; html += "
    "; html += "" + Globalize.translate("Delete") + ""; html += "
  • "; } $('#ulUserProfiles', $('#userProfilesPage')).html(html).listview('refresh'); Dashboard.hideLoadingMsg(); }, deleteUser: function (link) { var page = $.mobile.activePage; var name = link.getAttribute('data-username'); var msg = Globalize.translate("DeleteUserConfirmation").replace('{0}', name); Dashboard.confirm(msg, Globalize.translate("DeleteUser"), function (result) { if (result) { Dashboard.showLoadingMsg(); var id = link.getAttribute('data-userid'); ApiClient.deleteUser(id).done(function () { Dashboard.validateCurrentUser(page); UserProfilesPage.loadPageData(); }); } }); } }; $(document).on('pageshow', "#userProfilesPage", UserProfilesPage.onPageShow);