]>
git.proxmox.com Git - pmg-gui.git/blob - js/UserBlackWhiteList.js
7276d166d77c6e2f86f458c729278c6931c8a368
1 Ext
.define('pmg-address-list', {
2 extend
: 'Ext.data.Model',
7 // base class - do not use directly
8 Ext
.define('PMG.UserBlackWhiteList', {
9 extend
: 'Ext.grid.GridPanel',
12 listname
: undefined, // 'blacklist' or 'whitelist',
14 emptyText
: gettext('No data in database.'),
18 xclass
: 'Ext.app.ViewController',
20 onAddAddress: function() {
21 var me
= this.getView();
22 var params
= me
.getStore().getProxy().getExtraParams() || {};
24 var url
= '/quarantine/' + me
.listname
;
27 xtype
: 'proxmoxtextfield',
29 fieldLabel
: gettext("Address")
32 Ext
.Object
.each(params
, function(key
, value
) {
48 if (me
.listname
=== 'blacklist') {
49 config
.subject
= gettext("Blacklist");
50 } else if (me
.listname
== 'whitelist') {
51 config
.subject
= gettext("Whitelist");
53 throw "unknown list - internal error";
56 var win
= Ext
.createWidget('proxmoxWindowEdit', config
);
57 win
.on('destroy', function() { me
.store
.load() });
61 onRemoveAddress: function() {
62 var me
= this.getView();
63 var rec
= me
.selModel
.getSelection()[0];
66 var params
= me
.getStore().getProxy().getExtraParams() || {};
67 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
69 Proxmox
.Utils
.API2Request({
70 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
73 callback: function(options
, success
, response
) {
76 failure: function (response
, opts
) {
77 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
82 changeEmail: function(combobox
, value
) {
83 var view
= this.getView();
84 if (value
&& combobox
.isValid()) {
85 view
.getStore().getProxy().setExtraParams({
88 view
.getStore().load();
92 init: function(view
) {
93 if (PMG
.view
=== 'quarantineview') {
94 this.lookupReference('email').setVisible(false);
95 view
.getStore().load();
97 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
113 displayField
: 'mail',
120 url
: '/api2/json/quarantine/quarusers'
125 renderer
: Ext
.htmlEncode
134 fieldLabel
: 'E-Mail',
137 text
: gettext('Add'),
138 handler
: 'onAddAddress'
141 xtype
: 'proxmoxButton',
142 text
: gettext('Remove'),
144 handler
: 'onRemoveAddress',
145 confirmMsg: function(rec
) {
148 var name
= rec
.getId();
149 return Ext
.String
.format(
150 gettext('Are you sure you want to remove entry {0}'),
151 "'" + Ext
.String
.htmlEncode(name
) + "'");
158 header
: gettext('Address'),
159 dataIndex
: 'address',
160 renderer
: Ext
.String
.htmlEncode
,
166 Ext
.define('PMG.UserBlacklist', {
167 extend
: 'PMG.UserBlackWhiteList',
168 xtype
: 'pmgUserBlacklist',
170 title
: gettext('Blacklist'),
172 listname
: 'blacklist',
175 model
: 'pmg-address-list',
179 url
: "/api2/json/quarantine/blacklist"
188 'border-left': '0px',
189 'border-right': '0px',
191 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
192 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
193 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
194 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
200 Ext
.define('PMG.UserWhitelist', {
201 extend
: 'PMG.UserBlackWhiteList',
202 xtype
: 'pmgUserWhitelist',
204 title
: gettext('Whitelist'),
206 listname
: 'whitelist',
209 model
: 'pmg-address-list',
213 url
: "/api2/json/quarantine/whitelist"
222 'border-left': '0px',
223 'border-right': '0px',
225 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
226 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
227 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
228 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'