$(document).ready(function(){
// Initialize the editable-table functionality
$('#usertable').editableTableWidget();
// Add eventhandlers to buttons
$('#usertable button.session').click(function() {
$.post("lucidAuth.manage.php", {
do: "retrievesessions",
userid: $(this).closest('tr').find('td:nth-child(1)').data('userid')
})
.done(function(data,_status) {
if (data.Result === 'Success') {
} else {
}
});
});
$('#usertable button.delete').click(function() {
$(this).closest('tr').addClass('removed');
});
$('#btnnewuser').click(function() {
// Create a new user; generate pseudo-random username
var newUser = 'User' + String(Math.floor(Math.random() * Math.floor(9999))).padStart(4, '0');
// Add new user to the interface
// (new `
` in `
`)
$('#usertable tbody').append($('
', {class: 'new'})
.append($('
', {
text: newUser
}))
.append($('
', {
text: 'User'
}))
.append($('
', {
class: 'immutable',
html: ' ' +
''
}))
);
// Call `editableTableWidget()` again to include the newly added `
`
// To prevent recreating multiple new editors; reference the already existing ``
$('#usertable').editableTableWidget({editor: $('#editor')});
// Add eventhandlers to buttons of newly added `