]>
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
) {
41 /*jslint confusion: true*/
42 /* create is an function */
50 /*jslint confusion: false*/
52 if (me
.listname
=== 'blacklist') {
53 config
.subject
= gettext("Blacklist");
54 } else if (me
.listname
== 'whitelist') {
55 config
.subject
= gettext("Whitelist");
57 throw "unknown list - internal error";
60 var win
= Ext
.createWidget('proxmoxWindowEdit', config
);
61 win
.on('destroy', function() { me
.store
.load(); });
65 onRemoveAddress: function() {
66 var me
= this.getView();
67 var rec
= me
.selModel
.getSelection()[0];
72 var params
= me
.getStore().getProxy().getExtraParams() || {};
73 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
75 Proxmox
.Utils
.API2Request({
76 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
79 callback: function(options
, success
, response
) {
82 failure: function (response
, opts
) {
83 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
88 changeEmail: function(combobox
, value
) {
89 var view
= this.getView();
90 if (value
&& combobox
.isValid()) {
91 view
.getStore().getProxy().setExtraParams({
94 view
.getStore().load();
98 init: function(view
) {
99 if (PMG
.view
=== 'quarantineview') {
100 this.lookupReference('email').setVisible(false);
101 view
.getStore().load();
103 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
119 displayField
: 'mail',
126 url
: '/api2/json/quarantine/quarusers'
131 renderer
: Ext
.htmlEncode
143 text
: gettext('Add'),
144 handler
: 'onAddAddress'
147 xtype
: 'proxmoxButton',
148 text
: gettext('Remove'),
150 handler
: 'onRemoveAddress',
151 confirmMsg: function(rec
) {
154 var name
= rec
.getId();
155 return Ext
.String
.format(
156 gettext('Are you sure you want to remove entry {0}'),
157 "'" + Ext
.String
.htmlEncode(name
) + "'");
164 header
: gettext('Address'),
165 dataIndex
: 'address',
166 renderer
: Ext
.String
.htmlEncode
,
172 Ext
.define('PMG.UserBlacklist', {
173 extend
: 'PMG.UserBlackWhiteList',
174 xtype
: 'pmgUserBlacklist',
176 title
: gettext('Blacklist'),
178 listname
: 'blacklist',
181 model
: 'pmg-address-list',
185 url
: "/api2/json/quarantine/blacklist"
194 'border-left': '0px',
195 'border-right': '0px'
197 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
198 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
199 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
200 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
206 Ext
.define('PMG.UserWhitelist', {
207 extend
: 'PMG.UserBlackWhiteList',
208 xtype
: 'pmgUserWhitelist',
210 title
: gettext('Whitelist'),
212 listname
: 'whitelist',
215 model
: 'pmg-address-list',
219 url
: "/api2/json/quarantine/whitelist"
228 'border-left': '0px',
229 'border-right': '0px'
231 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
232 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
233 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
234 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'