- batch user import basics

This commit is contained in:
Wiesner András 2024-03-08 18:14:53 +01:00
parent a2c6ddabb3
commit b7bca5c6c1
3 changed files with 21 additions and 5 deletions

View File

@ -372,6 +372,13 @@ switch ($action) {
$result = json_encode($user_data_filtered); $result = json_encode($user_data_filtered);
} }
break; break;
case "import_users_from_csv":
{
if (!isset($_FILES["users_table"])) {
goto print_result;
}
}
break;
} }
// ---------- // ----------

View File

@ -10,8 +10,12 @@ function create_table_cell(content, styleClass = "") {
return td; return td;
} }
function highlight_row(nickname) { function highlight_row(rowid) {
let hl_on = document.getElementById("user_chk_" + nickname).checked; let hl_on = document.getElementById("chk_" + rowid).checked;
let row = document.getElementById("row_" + nickname); let row = document.getElementById("row_" + rowid);
row.setAttribute("highlight", hl_on ? "true" : "false"); if (hl_on) {
row.setAttribute("highlight", "true");
} else {
row.removeAttribute("highlight");
}
} }

View File

@ -7,10 +7,15 @@ function list_all_users() {
for (let i = 0; i < users.length; i++) { for (let i = 0; i < users.length; i++) {
let u = users[i]; let u = users[i];
let row = document.createElement("tr"); let row = document.createElement("tr");
row.id = "row_" + u["nickname"];
let chkbox = document.createElement("input"); let chkbox = document.createElement("input");
chkbox.type = "checkbox"; chkbox.type = "checkbox";
chkbox.name = "user_chkbox"; chkbox.name = "user_chkbox";
chkbox.user = u; chkbox.user = u;
chkbox.id = "chk_" + u["nickname"];
chkbox.addEventListener("input", () => {
highlight_row(u["nickname"]);
});
let tdChkBox = document.createElement("td"); let tdChkBox = document.createElement("td");
tdChkBox.appendChild(chkbox); tdChkBox.appendChild(chkbox);
tdChkBox.classList.add("checkbox"); tdChkBox.classList.add("checkbox");