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

[Web] Show label for relayed domains; Return total bytes and msgs of domain in API (WIP)

0095388f
andryyy <[email protected]> 6 years ago
data/web/inc/functions.mailbox.inc.php | 11 ++++++++++-
 data/web/js/site/mailbox.js            |  8 +++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

Diff

diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php
index a77d734a..272003b4 100644
--- a/data/web/inc/functions.mailbox.inc.php
+++ b/data/web/inc/functions.mailbox.inc.php
@@ -3220,7 +3220,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
                 WHERE `kind` NOT REGEXP 'location|thing|group'
                   AND `domain` = :domain");
           $stmt->execute(array(':domain' => $row['domain']));
-          $MailboxDataDomain	= $stmt->fetch(PDO::FETCH_ASSOC);
+          $MailboxDataDomain = $stmt->fetch(PDO::FETCH_ASSOC);
+          $stmt = $pdo->prepare("SELECT SUM(bytes) AS `bytes_total`, SUM(messages) AS `msgs_total` FROM `quota2`
+            WHERE `username` IN (
+              SELECT `username` FROM `mailbox`
+                WHERE `domain` = :domain
+            );");
+          $stmt->execute(array(':domain' => $row['domain']));
+          $SumQuotaInUse = $stmt->fetch(PDO::FETCH_ASSOC);
           $rl = ratelimit('get', 'domain', $_data);
           $domaindata['max_new_mailbox_quota']	= ($row['quota'] * 1048576) - $MailboxDataDomain['in_use'];
           if ($domaindata['max_new_mailbox_quota'] > ($row['maxquota'] * 1048576)) {
@@ -3231,6 +3238,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
             $domaindata['def_new_mailbox_quota'] = ($row['defquota'] * 1048576);
           }
           $domaindata['quota_used_in_domain'] = $MailboxDataDomain['in_use'];
+          $domaindata['bytes_total'] = $SumQuotaInUse['bytes_total'];
+          $domaindata['msgs_total'] = $SumQuotaInUse['msgs_total'];
           $domaindata['mboxes_in_domain'] = $MailboxDataDomain['count'];
           $domaindata['mboxes_left'] = $row['mailboxes']	- $MailboxDataDomain['count'];
           $domaindata['domain_name'] = $row['domain'];
diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js
index 33f5cb16..baefd8c7 100644
--- a/data/web/js/site/mailbox.js
+++ b/data/web/js/site/mailbox.js
@@ -287,7 +287,13 @@ jQuery(function($){
             }
             item.action += '<a href="#dnsInfoModal" class="btn btn-xs btn-info" data-toggle="modal" data-domain="' + encodeURIComponent(item.domain_name) + '"><span class="glyphicon glyphicon-question-sign"></span> DNS</a></div>';
             if (item.backupmx_int == 1) {
-              item.domain_name = '<span class="glyphicon glyphicon-export"></span> ' + item.domain_name;
+              if (item.relay_unknown_only_int == 1) {
+                item.domain_name = '<div class="label label-info">Relay Non-Local</div> ' + item.domain_name;
+              } else if (item.relay_all_recipients_int == 1) {
+                item.domain_name = '<div class="label label-info">Relay All</div> ' + item.domain_name;
+              } else {
+                item.domain_name = '<div class="label label-info">Relay</div> ' + item.domain_name;
+              }
             }
           });
         }