From 15ab633d807a6f7ae31a1b80816c6442dd40415e Mon Sep 17 00:00:00 2001 From: andryyy Date: Sat, 22 Feb 2020 10:12:39 +0100 Subject: [PATCH] [Web] Allow to change page size in table header for /mailbox tables --- data/web/js/site/mailbox.js | 23 ++++++-- data/web/lang/lang.de.json | 2 + data/web/lang/lang.en.json | 2 + data/web/mailbox.php | 112 +++++++++++++++++++++++++++++++++++- 4 files changed, 134 insertions(+), 5 deletions(-) diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index fe623b32..cb1d5d2e 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -51,9 +51,19 @@ $(document).ready(function() { // todo $('[data-page-size]').on('click', function(e){ e.preventDefault(); - var newSize = $(this).data('page-size'); - var nextTable = $(this).nextAll('.table-responsive').find('table'); - FooTable.get(nextTable).pageSize(newSize); + var new_size = $(this).data('page-size'); + var parent_ul = $(this).closest('ul'); + var table_id = $(parent_ul).data('table-id'); + FooTable.get('#' + table_id).pageSize(new_size); + //$(this).parent().addClass('active').siblings().removeClass('active') + heading = $(this).parents('.panel').find('.panel-heading') + var n_results = $(heading).children('.table-lines').text().split(' / ')[1]; + $(heading).children('.table-lines').text(function(){ + if (new_size > n_results) { + new_size = n_results; + } + return new_size + ' / ' + n_results; + }) }); // Clone mailbox mass actions $("div").find("[data-actions-header='true'").each(function() { @@ -208,7 +218,12 @@ jQuery(function($){ heading = ft.$el.parents('.panel').find('.panel-heading') var ft_paging = ft.use(FooTable.Paging) $(heading).children('.table-lines').text(function(){ - return ft_paging.totalRows; + var total_rows = ft_paging.totalRows; + var size = ft_paging.size; + if (size > total_rows) { + size = total_rows; + } + return size + ' / ' + total_rows; }) } function draw_domain_table() { diff --git a/data/web/lang/lang.de.json b/data/web/lang/lang.de.json index aaab881b..99b8432d 100644 --- a/data/web/lang/lang.de.json +++ b/data/web/lang/lang.de.json @@ -561,6 +561,8 @@ "notified": "Benachrichtigt" }, "mailbox": { + "table_size": "Tabellengröße", + "table_size_show_n": "Zeige %s Einträge", "tls_policy_maps": "TLS-Richtlinien", "sogo_allow_admin_hint": "Administrative SOGo Logins sind nur für Mailboxen verfügbar, die bereits ein SOGo Profil besitzen. Ein Benutzer muss zumindest einmal in SOGo eingeloggt gewesen sein, um ein Profil zu besitzen.", "tls_policy_maps_long": "Ausgehende TLS-Richtlinien", diff --git a/data/web/lang/lang.en.json b/data/web/lang/lang.en.json index 789d5708..7ec7cde8 100644 --- a/data/web/lang/lang.en.json +++ b/data/web/lang/lang.en.json @@ -560,6 +560,8 @@ "notified": "Notified" }, "mailbox": { + "table_size": "Table size", + "table_size_show_n": "Show %s items", "tls_policy_maps": "TLS policy maps", "sogo_allow_admin_hint": "Administrative SOGo logins are only available for mailboxes with an existing SOGo profile. A user must have been logged in to SOGo at least once.", "tls_policy_maps_long": "Outgoing TLS policy map overrides", diff --git a/data/web/mailbox.php b/data/web/mailbox.php index f6e509c2..3848023a 100644 --- a/data/web/mailbox.php +++ b/data/web/mailbox.php @@ -33,8 +33,19 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
- + + +
@@ -68,6 +79,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +
+ +
@@ -154,6 +187,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +
@@ -183,6 +227,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +
@@ -218,6 +273,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +
@@ -249,6 +315,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +

@@ -282,6 +359,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +

@@ -312,6 +400,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +

@@ -342,6 +441,17 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
+ +