All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.js.users.js Maven / Gradle / Ivy

function updateUserListTable(token) {
	$.getJSON("/api/users/list?token=" + token, function() {
	})
	.done(function(data) {
		
		$("#userlisttable > tbody").html("");
		$("#userlisttable").append(
			    $.map(data.users, function (item, index) {
			    	
			    	var lastlogin = item.lastlogin;
			    	if (typeof lastlogin === "undefined") {
			    		lastlogin = "never logged in";
			    	}
			    	
			    	return '' 
			    		+ '' + item.email + '' 
			    		+ '' + item.role + '' 
			    		+ '' + item.status + ''
			    		+ '' + lastlogin + ''
			    		+ ''
			    		+ '' 
			    		+ '';
		}).join());
		
		if (data.prevtoken === undefined) {
			$('#prev-button').hide();
		} else {
			$('#prev-button').show();
			$('#prev-button').data('token', data.prevtoken);
		}
		
		if (data.nexttoken === undefined) {
			$('#next-button').hide();
		} else {
			$("#next-button").data("token", data.nexttoken );			
			$('#next-button').show();
		}	
	})
	.fail(function(data) {
		
		var text = JSON.parse(data.responseText)
		showerror("#usereditdiv", "Unable to Get User List - " + text.data);
	});
}

$(document).ready(function() {
	
	updateUserListTable("");	

	$("#next-button").click(function() {
		var token = $("#next-button").data("token");
		updateUserListTable(token);
	});
	
	$("#prev-button").click(function() {
		var token = $("#prev-button").data("token");
		updateUserListTable(token);
	});
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy