From dbe32336327995364aa4b05ef51e64ff675c2539 Mon Sep 17 00:00:00 2001 From: Serjoscha Bassauer Date: Thu, 12 Oct 2017 00:29:46 +0200 Subject: [PATCH] - moved the configuration interface elements (logs, users, webadmins) to tabs; this makes useability a tiny bit better - "enabled" in the user config is now a checkbox that can be toggled in order to activate or deactivate the user --- include/html/grids.php | 147 ++++++++++++++++++++++------------------- js/grids.js | 33 ++++++++- 2 files changed, 112 insertions(+), 68 deletions(-) diff --git a/include/html/grids.php b/include/html/grids.php index 2d7bad1..5c4845f 100644 --- a/include/html/grids.php +++ b/include/html/grids.php @@ -1,80 +1,93 @@ - -
-

- OpenVPN Users -

-
+ +
+ + - -
-

- Web Admins -

-
+ + diff --git a/js/grids.js b/js/grids.js index f74c6db..637800e 100644 --- a/js/grids.js +++ b/js/grids.js @@ -17,6 +17,10 @@ $(function () { alert('Error: ' + textStatus); } + function checkFormatter(value, row, index) { + return ''; + } + // ------------------------- USERS definitions ------------------------- var $userTable = $('#table-users'); var $modalUserAdd = $('#modal-user-add'); @@ -53,6 +57,23 @@ $(function () { }); } + function genericSetField(field, new_value, pk) { + $.ajax({ + url: gridsUrl, + data: { + set_user: true, + name: field, + value: new_value, + pk : pk + }, + method: 'POST', + success: function() { + refreshTable($userTable); + }, + error: onAjaxError + }); + } + var userEditable = { url: gridsUrl, params: function (params) { @@ -131,6 +152,7 @@ $(function () { $userTable.bootstrapTable({ url: gridsUrl, sortable: false, + checkboxHeader: false, queryParams: function (params) { params.select = 'user'; return params; @@ -143,7 +165,16 @@ $(function () { { title: "Mail", field: "user_mail", editable: userEditable }, { title: "Phone", field: "user_phone", editable: userEditable }, { title: "Online", field: "user_online" }, - { title: "Enabled", field: "user_enable" }, + { + title: "Enabled", + field: "user_enable", + formatter : checkFormatter, + events: { + 'click input': function (e, value, row) { + genericSetField('user_enable', $(this).is(':checked') ? '1' : '0', row.user_id); + } + } + }, { title: "Start Date", field: "user_start_date", editable: userDateEditable }, { title: "End Date", field: "user_end_date", editable: userDateEditable }, {