]>
git.proxmox.com Git - pmg-gui.git/blob - js/UserBlackWhiteList.js
477e1881f66a7b01202247f5191fb030eaa40bfc
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];
67 var params
= me
.getStore().getProxy().getExtraParams() || {};
68 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
70 Proxmox
.Utils
.API2Request({
71 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
74 callback: function(options
, success
, response
) {
77 failure: function (response
, opts
) {
78 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
83 changeEmail: function(combobox
, value
) {
84 var view
= this.getView();
85 if (value
&& combobox
.isValid()) {
86 view
.getStore().getProxy().setExtraParams({
89 view
.getStore().load();
93 init: function(view
) {
94 if (PMG
.view
=== 'quarantineview') {
95 this.lookupReference('email').setVisible(false);
96 view
.getStore().load();
98 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
114 displayField
: 'mail',
121 url
: '/api2/json/quarantine/quarusers'
126 renderer
: Ext
.htmlEncode
138 text
: gettext('Add'),
139 handler
: 'onAddAddress'
142 xtype
: 'proxmoxButton',
143 text
: gettext('Remove'),
145 handler
: 'onRemoveAddress',
146 confirmMsg: function(rec
) {
149 var name
= rec
.getId();
150 return Ext
.String
.format(
151 gettext('Are you sure you want to remove entry {0}'),
152 "'" + Ext
.String
.htmlEncode(name
) + "'");
159 header
: gettext('Address'),
160 dataIndex
: 'address',
161 renderer
: Ext
.String
.htmlEncode
,
167 Ext
.define('PMG.UserBlacklist', {
168 extend
: 'PMG.UserBlackWhiteList',
169 xtype
: 'pmgUserBlacklist',
171 title
: gettext('Blacklist'),
173 listname
: 'blacklist',
176 model
: 'pmg-address-list',
180 url
: "/api2/json/quarantine/blacklist"
189 'border-left': '0px',
190 'border-right': '0px'
192 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
193 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
194 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
195 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
201 Ext
.define('PMG.UserWhitelist', {
202 extend
: 'PMG.UserBlackWhiteList',
203 xtype
: 'pmgUserWhitelist',
205 title
: gettext('Whitelist'),
207 listname
: 'whitelist',
210 model
: 'pmg-address-list',
214 url
: "/api2/json/quarantine/whitelist"
223 'border-left': '0px',
224 'border-right': '0px'
226 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
227 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
228 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
229 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'