58 lines
1.6 KiB
HTML
58 lines
1.6 KiB
HTML
<div id="panels">
|
|
<div id="left_panel">
|
|
Zde budou uživatelé.
|
|
</div>
|
|
<div id="right_panel">
|
|
<div id="buttons">
|
|
<button onclick="update()" class="btn">Uložit Změny</button>
|
|
<button onclick="remove_user()" class="btn">Odstranit Uživatele</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var right_panel_buffer = null;
|
|
var username = null;
|
|
|
|
$.ajax
|
|
({
|
|
url: "./res/forum/api/list_users.php",
|
|
success: function(result)
|
|
{
|
|
let users = "";
|
|
for (let i in result.users)
|
|
{
|
|
users += "<div class=\"output\">" + result.users[i] + "</div>";
|
|
}
|
|
|
|
$("#left_panel").html(users);
|
|
}
|
|
});
|
|
|
|
$("#left_panel").on("click", ".output", function(event)
|
|
{
|
|
$("#buttons").show();
|
|
if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML;
|
|
|
|
username = event.target.innerHTML;
|
|
|
|
inject_info("#right_panel", username, right_panel_buffer);
|
|
});
|
|
|
|
function remove_user()
|
|
{
|
|
$.ajax
|
|
({
|
|
url: "./res/forum/api/remove_user.php?username=" + username,
|
|
success: function(result)
|
|
{
|
|
//location.reload();
|
|
show("admin");
|
|
}
|
|
});
|
|
}
|
|
|
|
function update()
|
|
{
|
|
update_user(username, document.getElementById("username").value, document.getElementById("nickname").value, document.getElementById("admin").value, document.getElementById("sex").value,document.getElementById("bio").value, "admin");
|
|
}
|
|
</script> |