diff --git a/lib/Froxlor/Ajax/Ajax.php b/lib/Froxlor/Ajax/Ajax.php index 9af17e2d..0bea38b1 100644 --- a/lib/Froxlor/Ajax/Ajax.php +++ b/lib/Froxlor/Ajax/Ajax.php @@ -110,8 +110,10 @@ class Ajax return $this->getUpdateCheck(); case 'searchglobal': return $this->searchGlobal(); - case 'tablelisting': + case 'updatetablelisting': return $this->updateTablelisting(); + case 'resettablelisting': + return $this->resetTablelisting(); case 'editapikey': return $this->editApiKey(); default: @@ -248,15 +250,19 @@ class Ajax private function updateTablelisting() { $columns = []; - foreach (Request::get('columns') as $requestedColumn => $value) { - $columns[] = $requestedColumn; + foreach (Request::get('columns') as $value) { + $columns[] = $value; } - Listing::storeColumnListingForUser([Request::get('listing') => $columns]); - return $this->jsonResponse($columns); } + private function resetTablelisting() + { + Listing::deleteColumnListingForUser([Request::get('listing') => []]); + return $this->jsonResponse([]); + } + private function editApiKey() { $keyid = isset($_POST['id']) ? (int) $_POST['id'] : 0; diff --git a/lib/Froxlor/UI/Listing.php b/lib/Froxlor/UI/Listing.php index 98abd469..2e8565e5 100644 --- a/lib/Froxlor/UI/Listing.php +++ b/lib/Froxlor/UI/Listing.php @@ -197,6 +197,29 @@ class Listing return $result; } + /** + * delete column listing selection of user from database + * + * @param array $tabellisting + * @return bool + */ + public static function deleteColumnListingForUser(array $tabellisting): bool + { + $section = array_key_first($tabellisting); + if (empty($section)) { + throw new InvalidArgumentException("Invalid selection array for " . __METHOD__); + } + $userid = 'customerid'; + if (CurrentUser::isAdmin()) { + $userid = 'adminid'; + } + $del_stmt = Database::prepare(" + DELETE FROM `" . TABLE_PANEL_USERCOLUMNS . "` WHERE `" . $userid . "` = :uid AND `section` = :section + "); + Database::pexecute($del_stmt, ['uid' => CurrentUser::getField($userid), 'section' => $section]); + return true; + } + /** * store column listing selection of user to database * the selection array should look like this: @@ -208,8 +231,7 @@ class Listing * ] * ] * - * @param array $tablelisting - * + * @param array $tabellisting * @return bool */ public static function storeColumnListingForUser(array $tabellisting): bool @@ -223,10 +245,7 @@ class Listing $userid = 'adminid'; } // delete possible existing entry - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_PANEL_USERCOLUMNS . "` WHERE `" . $userid . "` = :uid AND `section` = :section - "); - Database::pexecute($del_stmt, ['uid' => CurrentUser::getField($userid), 'section' => $section]); + self::deleteColumnListingForUser($tabellisting); // add new entry $ins_stmt = Database::prepare(" INSERT INTO `" . TABLE_PANEL_USERCOLUMNS . "` SET diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php index 2ca442aa..84aee867 100644 --- a/lib/tablelisting/admin/tablelisting.domains.php +++ b/lib/tablelisting/admin/tablelisting.domains.php @@ -52,6 +52,80 @@ return [ 'label' => $lng['domains']['aliasdomain'], 'field' => 'aliasdomain', ], + 'd.documentroot' => [ + 'label' => $lng['domains']['documentroot'], + 'field' => 'documentroot', + ], + 'd.isbinddomain' => [ + 'label' => $lng['domains']['isbinddomain'], + 'field' => 'isbinddomain', + 'callback' => [Text::class, 'boolean'], + ], + 'd.isemaildomain' => [ + 'label' => $lng['domains']['isemaildomain'], + 'field' => 'isemaildomain', + 'callback' => [Text::class, 'boolean'], + ], + 'd.email_only' => [ + 'label' => $lng['domains']['email_only'], + 'field' => 'email_only', + 'callback' => [Text::class, 'boolean'], + ], + 'd.iswildcarddomain' => [ + 'label' => $lng['domains']['iswildcarddomain'], + 'field' => 'iswildcarddomain', + 'callback' => [Text::class, 'boolean'], + ], + 'd.subcanemaildomain' => [ + 'label' => $lng['domains']['subcanemaildomain'], + 'field' => 'subcanemaildomain', + 'callback' => [Text::class, 'boolean'], + ], + 'd.caneditdomain' => [ + 'label' => $lng['domains']['caneditdomain'], + 'field' => 'caneditdomain', + 'callback' => [Text::class, 'boolean'], + ], + 'd.dkim' => [ + 'label' => $lng['domains']['dkim'], + 'field' => 'dkim', + 'callback' => [Text::class, 'boolean'], + ], + 'd.phpenabled' => [ + 'label' => $lng['admin']['phpenabled'], + 'field' => 'phpenabled', + 'callback' => [Text::class, 'boolean'], + ], + 'd.openbasedir' => [ + 'label' => $lng['domains']['openbasedir'], + 'field' => 'openbasedir', + 'callback' => [Text::class, 'boolean'], + ], + 'd.speciallogfile' => [ + 'label' => $lng['domains']['speciallogfile'], + 'field' => 'speciallogfile', + 'callback' => [Text::class, 'boolean'], + ], + 'd.hsts' => [ + 'label' => $lng['domains']['hsts'], + 'field' => 'hsts', + 'callback' => [Text::class, 'boolean'], + ], + 'd.http2' => [ + 'label' => $lng['domains']['http2'], + 'field' => 'http2', + 'callback' => [Text::class, 'boolean'], + ], + 'd.letsencrypt' => [ + 'label' => $lng['domains']['letsencrypt'], + 'field' => 'letsencrypt', + 'callback' => [Text::class, 'boolean'], + ], + 'd.deactivated' => [ + 'label' => $lng['domains']['deactivated'], + 'field' => 'deactivated', + 'callback' => [Text::class, 'boolean'], + ], ], 'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [ 'd.domain_ace', diff --git a/templates/Froxlor/src/js/components/tablecolumns.js b/templates/Froxlor/src/js/components/tablecolumns.js index 09da15a0..f7a3cc4f 100644 --- a/templates/Froxlor/src/js/components/tablecolumns.js +++ b/templates/Froxlor/src/js/components/tablecolumns.js @@ -3,19 +3,35 @@ $(document).ready(function () { * table columns - manage columns modal */ let form = $('#manageColumnsModal form'); + form.submit(function (event) { $.ajax({ - url: 'lib/ajax.php?action=tablelisting&listing=' + form.data('listing') + '&theme=' + window.$theme, + url: 'lib/ajax.php?action=updatetablelisting&listing=' + form.data('listing') + '&theme=' + window.$theme, type : 'POST', dataType : 'json', data : form.serialize(), - success : function (result) { - window.location.reload(); + success : function () { + window.location.href = ''; }, - error: function (xhr, resp, text) { - console.log(xhr, resp, text); + error: function (request) { + alert(request.responseJSON.message); } }); event.preventDefault(); }); + + $('#manageColumnsModal form #reset').click(function () { + $.ajax({ + url: 'lib/ajax.php?action=resettablelisting&listing=' + form.data('listing') + '&theme=' + window.$theme, + type : 'POST', + dataType : 'json', + data : {}, + success : function () { + window.location.href = ''; + }, + error: function (request) { + alert(request.responseJSON.message); + } + }); + }); }); diff --git a/templates/Froxlor/src/js/main.js b/templates/Froxlor/src/js/main.js index fd3e3e78..27c7e48c 100644 --- a/templates/Froxlor/src/js/main.js +++ b/templates/Froxlor/src/js/main.js @@ -7,7 +7,7 @@ import 'chart.js/dist/chart'; global.$ = require('jquery'); global.bootstrap = require('bootstrap'); -$(function() { +$(function () { window.$theme = 'Froxlor'; }); diff --git a/templates/Froxlor/src/scss/_global.scss b/templates/Froxlor/src/scss/_global.scss index 6cfc9b0a..66fc33a2 100644 --- a/templates/Froxlor/src/scss/_global.scss +++ b/templates/Froxlor/src/scss/_global.scss @@ -58,3 +58,8 @@ border-bottom: none; } } + +.focus-none { + outline: none !important; + box-shadow: none !important; +} diff --git a/templates/Froxlor/table/table.html.twig b/templates/Froxlor/table/table.html.twig index 92ab6803..a123591d 100644 --- a/templates/Froxlor/table/table.html.twig +++ b/templates/Froxlor/table/table.html.twig @@ -11,8 +11,8 @@ {% else %}
-
- +
+
@@ -74,7 +74,7 @@

{{ lng('panel.managetablecolumnsmodal.description') }}

{% for key, column in listing.available_columns %}
- + @@ -82,6 +82,7 @@ {% endfor %}