[pmg-devel] [PATCH pmg-gui 2/2] fix #2676: add MailInfo box on Quarantine Views

Dominik Csapak d.csapak at proxmox.com
Tue Apr 14 14:51:36 CEST 2020


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/AttachmentQuarantine.js | 18 +++++++++++++-----
 js/SpamQuarantine.js       | 11 ++++++++++-
 js/VirusQuarantine.js      | 16 +++++++++++++++-
 3 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/js/AttachmentQuarantine.js b/js/AttachmentQuarantine.js
index c143d6a..d02f10e 100644
--- a/js/AttachmentQuarantine.js
+++ b/js/AttachmentQuarantine.js
@@ -71,12 +71,15 @@ Ext.define('PMG.AttachmentQuarantine', {
 	},
 
 	onSelectMail: function() {
-	    var me = this;
-	    var list = this.lookupReference('list');
-	    var rec = list.getSelection()[0] || {};
+	    let me = this;
+	    let list = me.lookup('list');
+	    let rec = list.getSelection()[0] || {};
+	    let mailinfo = me.lookup('mailinfo');
 
 	    me.updatePreview(me.raw || false, rec);
-	    this.lookupReference('attachmentlist').setID(rec);
+	    me.lookup('attachmentlist').setID(rec);
+	    mailinfo.setVisible(!!rec.data);
+	    mailinfo.update(rec.data);
 	},
 
 	control: {
@@ -178,7 +181,12 @@ Ext.define('PMG.AttachmentQuarantine', {
 		    maxHeight: 250,
 		    scrollable: true,
 		    reference: 'attachmentlist',
-		}
+		},
+		{
+		    xtype: 'pmgMailInfo',
+		    hidden: true,
+		    reference: 'mailinfo',
+		},
 	    ]
 	}
     ]
diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js
index a51a700..3b32108 100644
--- a/js/SpamQuarantine.js
+++ b/js/SpamQuarantine.js
@@ -83,6 +83,7 @@ Ext.define('PMG.SpamQuarantine', {
 	    var raw = this.lookupReference('raw');
 	    var spam = this.lookupReference('spam');
 	    var spaminfo = this.lookupReference('spaminfo');
+	    var mailinfo = this.lookupReference('mailinfo');
 	    var download = this.lookupReference('download');
 
 	    preview.setDisabled(false);
@@ -91,6 +92,7 @@ Ext.define('PMG.SpamQuarantine', {
 	    spam.setDisabled(true);
 	    spam.setPressed(false);
 	    spaminfo.setVisible(false);
+	    mailinfo.setVisible(false);
 	    download.setDisabled(true);
 	},
 
@@ -160,6 +162,8 @@ Ext.define('PMG.SpamQuarantine', {
 	    me.getViewModel().set('mailid', rec.data ? rec.data.id : '');
 	    me.updatePreview(me.raw || false, rec);
 	    me.lookupReference('spaminfo').setID(rec);
+	    me.lookupReference('mailinfo').setVisible(!!rec.data);
+	    me.lookupReference('mailinfo').update(rec.data);
 	},
 
 	toggleSpamInfo: function(btn) {
@@ -353,7 +357,12 @@ Ext.define('PMG.SpamQuarantine', {
 		    xtype: 'pmgSpamInfoGrid',
 		    border: false,
 		    reference: 'spaminfo'
-		}
+		},
+		{
+		    xtype: 'pmgMailInfo',
+		    hidden: true,
+		    reference: 'mailinfo',
+		},
 	    ]
 	}
     ]
diff --git a/js/VirusQuarantine.js b/js/VirusQuarantine.js
index 8a1d46f..328407a 100644
--- a/js/VirusQuarantine.js
+++ b/js/VirusQuarantine.js
@@ -74,6 +74,15 @@ Ext.define('PMG.VirusQuarantine', {
 	onSelectMail: function() {
 	    var me = this;
 	    me.updatePreview(me.raw || false);
+	    let mailinfo = me.lookup('mailinfo');
+	    let list = me.lookup('list');
+	    let selection = list.getSelection();
+	    if (selection.length < 1) {
+		mailinfo.setVisible(false);
+		return;
+	    }
+	    mailinfo.setVisible(true);
+	    mailinfo.update(selection[0].data);
 	},
 
 	control: {
@@ -174,7 +183,12 @@ Ext.define('PMG.VirusQuarantine', {
 			    handler: 'btnHandler'
 			}
 		    ]
-		}
+		},
+		{
+		    xtype: 'pmgMailInfo',
+		    hidden: true,
+		    reference: 'mailinfo',
+		},
 	    ]
 	}
     ]
-- 
2.20.1




More information about the pmg-devel mailing list