]>
git.proxmox.com Git - pmg-gui.git/blob - js/UserBlackWhiteList.js
2 Ext
.define('pmg-address-list', {
3 extend
: 'Ext.data.Model',
8 // base class - do not use directly
9 Ext
.define('PMG.UserBlackWhiteList', {
10 extend
: 'Ext.grid.GridPanel',
13 listname
: undefined, // 'blacklist' or 'whitelist',
15 emptyText
: gettext('No data in database'),
19 xclass
: 'Ext.app.ViewController',
21 onAddAddress: function() {
22 var me
= this.getView();
23 var params
= me
.getStore().getProxy().getExtraParams() || {};
25 var url
= '/quarantine/' + me
.listname
;
28 xtype
: 'proxmoxtextfield',
30 fieldLabel
: gettext("Address")
33 Ext
.Object
.each(params
, function(key
, value
) {
49 if (me
.listname
=== 'blacklist') {
50 config
.subject
= gettext("Blacklist");
51 } else if (me
.listname
== 'whitelist') {
52 config
.subject
= gettext("Whitelist");
54 throw "unknown list - internal error";
57 var win
= Ext
.createWidget('proxmoxWindowEdit', config
);
58 win
.on('destroy', function() { me
.store
.load(); });
62 onRemoveAddress: function() {
63 var me
= this.getView();
64 var rec
= me
.selModel
.getSelection()[0];
69 var params
= me
.getStore().getProxy().getExtraParams() || {};
70 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
72 Proxmox
.Utils
.API2Request({
73 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
76 callback: function(options
, success
, response
) {
79 failure: function (response
, opts
) {
80 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
85 changeEmail: function(combobox
, value
) {
86 var view
= this.getView();
87 if (value
&& combobox
.isValid()) {
88 view
.getStore().getProxy().setExtraParams({
91 view
.getStore().load();
95 init: function(view
) {
96 if (PMG
.view
=== 'quarantineview') {
97 this.lookupReference('email').setVisible(false);
98 view
.getStore().load();
100 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
116 displayField
: 'mail',
123 url
: '/api2/json/quarantine/quarusers'
128 renderer
: Ext
.htmlEncode
140 text
: gettext('Add'),
141 handler
: 'onAddAddress'
144 xtype
: 'proxmoxButton',
145 text
: gettext('Remove'),
147 handler
: 'onRemoveAddress',
148 confirmMsg: function(rec
) {
151 var name
= rec
.getId();
152 return Ext
.String
.format(
153 gettext('Are you sure you want to remove entry {0}'),
154 "'" + Ext
.String
.htmlEncode(name
) + "'");
161 header
: gettext('Address'),
162 dataIndex
: 'address',
163 renderer
: Ext
.String
.htmlEncode
,
169 Ext
.define('PMG.UserBlacklist', {
170 extend
: 'PMG.UserBlackWhiteList',
171 xtype
: 'pmgUserBlacklist',
173 title
: gettext('Blacklist'),
175 listname
: 'blacklist',
178 model
: 'pmg-address-list',
182 url
: "/api2/json/quarantine/blacklist"
191 'border-left': '0px',
192 'border-right': '0px'
194 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
195 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
196 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
197 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
203 Ext
.define('PMG.UserWhitelist', {
204 extend
: 'PMG.UserBlackWhiteList',
205 xtype
: 'pmgUserWhitelist',
207 title
: gettext('Whitelist'),
209 listname
: 'whitelist',
212 model
: 'pmg-address-list',
216 url
: "/api2/json/quarantine/whitelist"
225 'border-left': '0px',
226 'border-right': '0px'
228 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
229 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
230 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
231 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'