From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 161578CC7B for ; Fri, 4 Nov 2022 16:05:00 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D405C56B2 for ; Fri, 4 Nov 2022 16:04:29 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 4 Nov 2022 16:04:27 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 997DC44D45 for ; Fri, 4 Nov 2022 16:04:26 +0100 (CET) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Date: Fri, 4 Nov 2022 16:04:22 +0100 Message-Id: <20221104150425.124194-4-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221104150425.124194-1-d.csapak@proxmox.com> References: <20221104150425.124194-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.066 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [data.id] Subject: [pmg-devel] [PATCH pmg-gui 2/5] quarantines: add attachment grid to spam and virus quarantine X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2022 15:05:00 -0000 So that admins can easily see which attachments exist for a mail, without parsing the 'raw' mail content. Disable the download button for these quarantines though, since it should not be necessary to download the attachments for these. Signed-off-by: Dominik Csapak --- js/AttachmentGrid.js | 6 ++++++ js/SpamQuarantine.js | 17 +++++++++++++++++ js/VirusQuarantine.js | 17 +++++++++++++++++ js/controller/QuarantineController.js | 8 ++++++++ 4 files changed, 48 insertions(+) diff --git a/js/AttachmentGrid.js b/js/AttachmentGrid.js index 7e630de..8943f09 100644 --- a/js/AttachmentGrid.js +++ b/js/AttachmentGrid.js @@ -1,6 +1,9 @@ Ext.define('PMG.grid.AttachmentGrid', { extend: 'Ext.grid.GridPanel', xtype: 'pmgAttachmentGrid', + mixins: ['Proxmox.Mixin.CBind'], + + showDownloads: true, store: { autoDestroy: true, @@ -48,6 +51,9 @@ Ext.define('PMG.grid.AttachmentGrid', { }, { header: gettext('Download'), + cbind: { + hidden: '{!showDownloads}', + }, renderer: function(value, mD, rec) { var me = this; let url = `/api2/json/quarantine/download?mailid=${me.mailid}&attachmentid=${rec.data.id}`; diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js index c86ce79..d3afcc5 100644 --- a/js/SpamQuarantine.js +++ b/js/SpamQuarantine.js @@ -219,6 +219,14 @@ Ext.define('PMG.SpamQuarantine', { enableToggle: true, iconCls: 'fa fa-bullhorn', }, + { + xtype: 'button', + reference: 'attachments', + text: gettext('Toggle Attachments'), + enableToggle: true, + pressed: true, + iconCls: 'fa fa-paperclip', + }, '->', { xtype: 'button', @@ -265,6 +273,15 @@ Ext.define('PMG.SpamQuarantine', { border: false, reference: 'spaminfo', }, + { + xtype: 'pmgAttachmentGrid', + minHeight: 50, + maxHeight: 250, + scrollable: true, + reference: 'attachmentlist', + showDownloads: false, + border: false, + }, { xtype: 'pmgMailInfo', hidden: true, diff --git a/js/VirusQuarantine.js b/js/VirusQuarantine.js index 47e055c..8580e7a 100644 --- a/js/VirusQuarantine.js +++ b/js/VirusQuarantine.js @@ -114,6 +114,14 @@ Ext.define('PMG.VirusQuarantine', { enableToggle: true, iconCls: 'fa fa-file-code-o', }, + { + xtype: 'button', + reference: 'attachments', + text: gettext('Toggle Attachments'), + enableToggle: true, + pressed: true, + iconCls: 'fa fa-paperclip', + }, '->', { xtype: 'button', @@ -142,6 +150,15 @@ Ext.define('PMG.VirusQuarantine', { }, ], }, + { + xtype: 'pmgAttachmentGrid', + minHeight: 50, + maxHeight: 250, + scrollable: true, + reference: 'attachmentlist', + showDownloads: false, + border: false, + }, { xtype: 'pmgMailInfo', hidden: true, diff --git a/js/controller/QuarantineController.js b/js/controller/QuarantineController.js index d47af6a..afc04be 100644 --- a/js/controller/QuarantineController.js +++ b/js/controller/QuarantineController.js @@ -41,6 +41,11 @@ Ext.define('PMG.controller.QuarantineController', { me.updatePreview(me.raw, rec); }, + toggleAttachments: function(button) { + var grid = this.lookup('attachmentlist'); + grid?.setVisible(!grid?.isVisible()); + }, + btnHandler: function(button, e) { let me = this; let action = button.reference; @@ -162,6 +167,9 @@ Ext.define('PMG.controller.QuarantineController', { 'button[reference=raw]': { click: 'toggleRaw', }, + 'button[reference=attachments]': { + click: 'toggleAttachments', + }, 'pmgQuarantineList': { selectionChange: 'onSelectMail', itemkeypress: 'keyPress', -- 2.30.2