]> git.proxmox.com Git - pmg-gui.git/commitdiff
SpamQuarantine: add context menu
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 28 Mar 2018 14:55:44 +0000 (16:55 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 29 Mar 2018 12:31:58 +0000 (14:31 +0200)
with the actions: deliver,delete,whitelist,blacklist

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/Makefile
js/SpamContextMenu.js [new file with mode: 0644]
js/SpamQuarantine.js

index dd35f748c704853f1cf41f792f3bb033eec58c44..069fc7b896107b240cf0e1189db4f0c414768664 100644 (file)
@@ -79,6 +79,7 @@ JSSRC=                                                        \
        ReceiverStatistics.js                           \
        ContactStatistics.js                            \
        HourlyMailDistribution.js                       \
+       SpamContextMenu.js                              \
        Application.js
 
 OnlineHelpInfo.js: /usr/bin/asciidoc-pmg
diff --git a/js/SpamContextMenu.js b/js/SpamContextMenu.js
new file mode 100644 (file)
index 0000000..819f1dc
--- /dev/null
@@ -0,0 +1,43 @@
+Ext.define('PMG.menu.SpamContextMenu', {
+    extend: 'Ext.menu.Menu',
+
+    showSeparator: false,
+
+    controller: {
+       xclass: 'Ext.app.ViewController',
+       callCallback: function(btn) {
+           var me = this.getView();
+           if (Ext.isFunction(me.callback)) {
+               me.callback(btn.action);
+           }
+       }
+    },
+
+    items: [
+       {
+           text: gettext('Deliver'),
+           iconCls: 'fa fa-fw fa-paper-plane-o',
+           action: 'deliver',
+           handler: 'callCallback'
+       },
+       {
+           text: gettext('Delete'),
+           iconCls: 'fa fa-fw fa-trash-o',
+           action: 'delete',
+           handler: 'callCallback'
+       },
+       { xtype: 'menuseparator' },
+       {
+           text: gettext('Whitelist'),
+           iconCls: 'fa fa-fw fa-check',
+           action: 'whitelist',
+           handler: 'action'
+       },
+       {
+           text: gettext('Blacklist'),
+           iconCls: 'fa fa-fw fa-times',
+           action: 'blacklist',
+           handler: 'action'
+       }
+    ]
+});
index 32faa6d2897c0236e608c977fa003dce5698a203..6ff74eb24f999c080937a8346b7d1af09afc533b 100644 (file)
@@ -153,6 +153,19 @@ Ext.define('PMG.SpamQuarantine', {
            grid.setVisible(!grid.isVisible());
        },
 
+       openContextMenu: function(table, record, tr, index, event) {
+           event.stopEvent();
+           var me = this;
+           var list = me.lookup('list');
+           var menu = Ext.create('PMG.menu.SpamContextMenu', {
+               callback: function(action) {
+                   me.doAction(action, list.getSelection());
+               }
+           });
+
+           menu.showAt(event.getXY());
+       },
+
        init: function(view) {
            this.lookup('list').cselect = view.cselect;
        },
@@ -165,7 +178,8 @@ Ext.define('PMG.SpamQuarantine', {
                click: 'toggleSpamInfo'
            },
            'pmgQuarantineList': {
-               selectionChange: 'onSelectMail'
+               selectionChange: 'onSelectMail',
+               rowcontextmenu: 'openContextMenu'
            }
        }
     },