mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-06-03 21:54:52 +00:00

the Quarantine part is mostly copied from VirusQuarantine and adapted the AttachmentGrid is inspired by the SpamScore list this adds a new quarantine type 'Attachment' in the gui, where the admins can review and control the mails in the attachment quarantine it also shows a list of attachment/parts and a link where they can be downloaded (in case the admin want to only forward a single attachment or review the file in detail) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com> Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
Ext.define('PMG.grid.AttachmentGrid',{
|
|
extend: 'Ext.grid.GridPanel',
|
|
xtype: 'pmgAttachmentGrid',
|
|
|
|
store: {
|
|
autoDestroy: true,
|
|
fields: [ 'name', 'content-type', 'size' ],
|
|
proxy: {
|
|
type: 'proxmox',
|
|
}
|
|
},
|
|
|
|
setID: function(rec) {
|
|
var me = this;
|
|
if (!rec || !rec.data || !rec.data.id) {
|
|
me.getStore().removeAll();
|
|
return;
|
|
}
|
|
var url = '/api2/json/quarantine/listattachments?id=' + rec.data.id;
|
|
me.mailid = rec.data.id;
|
|
me.store.proxy.setUrl(url);
|
|
me.store.load();
|
|
},
|
|
|
|
emptyText: gettext('No Attachments'),
|
|
|
|
download: function() {
|
|
alert(arguments);
|
|
},
|
|
|
|
columns: [
|
|
{
|
|
text: gettext('Filename'),
|
|
dataIndex: 'name',
|
|
flex: 1,
|
|
},
|
|
{
|
|
text: gettext('Filetype'),
|
|
dataIndex: 'content-type',
|
|
renderer: PMG.Utils.render_filetype,
|
|
flex: 1,
|
|
},
|
|
{
|
|
text: gettext('Size'),
|
|
renderer: Proxmox.Utils.format_size,
|
|
dataIndex: 'size',
|
|
flex: 1,
|
|
},
|
|
{
|
|
header: gettext('Download'),
|
|
renderer: function(value, mD, rec) {
|
|
var me = this;
|
|
let url = '/api2/json/quarantine/download';
|
|
url += '?mailid=' + me.mailid;
|
|
url += '&attachmentid=' + rec.data.id;
|
|
return "<a target='_blank' class='download' download='"+ rec.data.name +"' href='" +
|
|
url + "'><i class='fa fa-fw fa-download'</i></a>";
|
|
},
|
|
}
|
|
]
|
|
});
|