| ⫧ Name |
⫧ UID |
- ⫧ Org |
+ ⫧ Org |
⫧ Mail |
⫧ Groups |
Actions |
+ value;
+ echo "⫧ $val | ";
+ }
+ ?>
value] = $LDAP->userFlagGroups[$flag->value]->getMemberUIDs();
+ }
usort($user_attributes, fn ($a, $b) => strcmp($a["uid"][0], $b["uid"][0]));
foreach ($user_attributes as $attributes) {
$uid = $attributes["uid"][0];
@@ -73,8 +83,8 @@ class="filterSearch"
";
echo "";
- if (count($UID2PIGIDs[$uid] ?? []) > 0) {
- echo "";
+ if (array_key_exists($uid, $UID2PIGIDs) && count($UID2PIGIDs[$uid] ?? []) > 0) {
+ echo "";
foreach ($UID2PIGIDs[$uid] as $gid) {
echo "| $gid | ";
}
@@ -90,6 +100,13 @@ class="filterSearch"
";
echo "";
+ foreach (UserFlag::cases() as $flag) {
+ echo "";
+ if (in_array($uid, $users_with_flags[$flag->value])) {
+ echo $flag->value;
+ }
+ echo " | ";
+ }
echo "";
}
?>
diff --git a/webroot/js/tables.js b/webroot/js/tables.js
index 7e6c65a40..12c6f61c5 100644
--- a/webroot/js/tables.js
+++ b/webroot/js/tables.js
@@ -53,3 +53,37 @@ $("#tableSearch").keyup(function () {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
+
+function setColumnVisibility(table_id, column_index, is_visible) {
+ $(`#${table_id} tr > :nth-child(${column_index})`).toggle(is_visible);
+}
+
+$("table.column-toggle").each(function () {
+ const table = $(this);
+ const id = $(this).attr("id");
+ if (typeof id === "undefined") {
+ console.log("error: table does not have id attribute");
+ return;
+ }
+ const checkboxTable = $(``);
+ const checkboxTableRow = $(" ");
+ table.find('th').each((index, th) => {
+ const checkboxTableCell = $(" | ");
+ const checkboxLabel = $(``);
+ const checkbox = $('');
+ if (th.classList.contains("hidden-by-default")) {
+ setColumnVisibility(id, index + 1, false);
+ checkbox.prop("checked", false);
+ } else {
+ checkbox.prop("checked", true);
+ }
+ checkbox.on('change', function () {
+ setColumnVisibility(id, index + 1, this.checked);
+ });
+ checkboxLabel.append(checkbox);
+ checkboxTableCell.append(checkboxLabel);
+ checkboxTableRow.append(checkboxTableCell);
+ });
+ checkboxTable.append(checkboxTableRow);
+ table.before(checkboxTable);
+});
|