58 lines
1.6 KiB
HTML
Raw Normal View History

2024-05-16 21:26:25 +02:00
<div id="panels">
<div id="left_panel">
2024-05-20 19:16:00 +02:00
Zde budou uživatelé.
2024-05-16 21:26:25 +02:00
</div>
<div id="right_panel">
<div id="buttons">
2024-05-22 18:40:36 +02:00
<button onclick="update()" class="btn">Uložit Změny</button>
<button onclick="remove_user()" class="btn">Odstranit Uživatele</button>
</div>
2024-05-16 21:26:25 +02:00
</div>
2024-05-20 19:16:00 +02:00
</div>
<script>
2024-05-21 17:49:26 +02:00
var right_panel_buffer = null;
var username = null;
2024-05-20 19:16:00 +02:00
$.ajax
({
2024-05-20 20:07:28 +02:00
url: "./res/forum/api/list_users.php",
2024-05-20 19:16:00 +02:00
success: function(result)
{
2024-05-21 20:02:52 +02:00
let users = "";
for (let i in result.users)
{
users += "<div class=\"output\">" + result.users[i] + "</div>";
}
$("#left_panel").html(users);
2024-05-20 19:16:00 +02:00
}
});
$("#left_panel").on("click", ".output", function(event)
{
$("#buttons").show();
if (right_panel_buffer == null) right_panel_buffer = document.getElementById("right_panel").innerHTML;
2024-05-21 17:49:26 +02:00
username = event.target.innerHTML;
2024-05-22 18:19:19 +02:00
inject_info("#right_panel", username, right_panel_buffer);
});
2024-05-21 17:49:26 +02:00
function remove_user()
{
$.ajax
({
url: "./res/forum/api/remove_user.php?username=" + username,
success: function(result)
{
//location.reload();
show("admin");
}
});
}
2024-05-22 16:49:31 +02:00
2024-05-22 18:40:36 +02:00
function update()
2024-05-22 17:25:34 +02:00
{
2024-05-22 18:40:36 +02:00
update_user(username, document.getElementById("username").value, document.getElementById("nickname").value, document.getElementById("admin").value, document.getElementById("sex").value,document.getElementById("bio").value, "admin");
2024-05-22 17:25:34 +02:00
}
2024-05-20 19:16:00 +02:00
</script>