NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

Mailboxes datatable - server side processing ordering

Signed-off-by: Kristian Feldsam <[email protected]>

efcca61f
Kristian Feldsam <[email protected]> 2 years, 8 months ago
data/web/js/site/mailbox.js | 8 +-------
 data/web/json_api.php       | 5 +++++
 2 files changed, 6 insertions(+), 7 deletions(-)

Diff

diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js
index c6f57d45..b1ec9482 100644
--- a/data/web/js/site/mailbox.js
+++ b/data/web/js/site/mailbox.js
@@ -1002,7 +1002,6 @@ jQuery(function($){
           title: lang.last_mail_login,
           data: 'last_mail_login',
           searchable: false,
-          orderable: false,
           defaultContent: '',
           responsivePriority: 7,
           render: function (data, type) {
@@ -1016,18 +1015,15 @@ jQuery(function($){
           title: lang.last_pw_change,
           data: 'last_pw_change',
           searchable: false,
-          orderable: false,
           defaultContent: ''
         },
         {
           title: lang.in_use,
           data: 'in_use.value',
           searchable: false,
-          orderable: false,
           defaultContent: '',
           responsivePriority: 9,
-          className: 'dt-data-w100',
-          orderData: 24
+          className: 'dt-data-w100'
         },
         {
           title: lang.fname,
@@ -1093,7 +1089,6 @@ jQuery(function($){
           title: lang.msg_num,
           data: 'messages',
           searchable: false,
-          orderable: false,
           defaultContent: '',
           responsivePriority: 5
         },
@@ -1119,7 +1114,6 @@ jQuery(function($){
           title: lang.active,
           data: 'active',
           searchable: false,
-          orderable: false,
           defaultContent: '',
           responsivePriority: 4,
           render: function (data, type) {
diff --git a/data/web/json_api.php b/data/web/json_api.php
index 0f0c23b1..403b5a79 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -1057,6 +1057,11 @@ if (isset($_GET['query'])) {
                 $columns = [
                   ['db' => 'username', 'dt' => 2],
                   ['db' => 'quota', 'dt' => 3],
+                  ['db' => 'last_mail_login', 'dt' => 4, 'dummy' => true, 'order_subquery' => "SELECT MAX(`datetime`) FROM `sasl_log` WHERE `service` != 'SSO' AND `username` = `m`.`username`"],
+                  ['db' => 'last_pw_change', 'dt' => 5, 'dummy' => true, 'order_subquery' => "JSON_EXTRACT(attributes, '$.passwd_update')"],
+                  ['db' => 'in_use', 'dt' => 6, 'dummy' => true, 'order_subquery' => "(SELECT SUM(bytes) FROM `quota2` WHERE `quota2`.`username` = `m`.`username`) / `m`.`quota`"],
+                  ['db' => 'messages', 'dt' => 17, 'dummy' => true, 'order_subquery' => "SELECT SUM(messages) FROM `quota2` WHERE `quota2`.`username` = `m`.`username`"],
+                  ['db' => 'active', 'dt' => 21]
                 ];
 
                 require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/lib/ssp.class.php';