]>
git.proxmox.com Git - pmg-gui.git/blob - js/UserBlackWhiteList.js
7255b6b0ca5355a05d7231d4a34036156d58769d
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];
70 var params
= me
.getStore().getProxy().getExtraParams() || {};
71 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
73 Proxmox
.Utils
.API2Request({
74 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
77 callback: function(options
, success
, response
) {
80 failure: function (response
, opts
) {
81 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
86 changeEmail: function(combobox
, value
) {
87 var view
= this.getView();
88 if (value
&& combobox
.isValid()) {
89 view
.getStore().getProxy().setExtraParams({
92 view
.getStore().load();
96 init: function(view
) {
97 if (PMG
.view
=== 'quarantineview') {
98 this.lookupReference('email').setVisible(false);
99 view
.getStore().load();
101 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
117 displayField
: 'mail',
124 url
: '/api2/json/quarantine/quarusers'
129 renderer
: Ext
.htmlEncode
141 text
: gettext('Add'),
142 handler
: 'onAddAddress'
145 xtype
: 'proxmoxButton',
146 text
: gettext('Remove'),
148 handler
: 'onRemoveAddress',
149 confirmMsg: function(rec
) {
152 var name
= rec
.getId();
153 return Ext
.String
.format(
154 gettext('Are you sure you want to remove entry {0}'),
155 "'" + Ext
.String
.htmlEncode(name
) + "'");
162 header
: gettext('Address'),
163 dataIndex
: 'address',
164 renderer
: Ext
.String
.htmlEncode
,
170 Ext
.define('PMG.UserBlacklist', {
171 extend
: 'PMG.UserBlackWhiteList',
172 xtype
: 'pmgUserBlacklist',
174 title
: gettext('Blacklist'),
176 listname
: 'blacklist',
179 model
: 'pmg-address-list',
183 url
: "/api2/json/quarantine/blacklist"
192 'border-left': '0px',
193 'border-right': '0px'
195 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
196 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
197 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
198 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
204 Ext
.define('PMG.UserWhitelist', {
205 extend
: 'PMG.UserBlackWhiteList',
206 xtype
: 'pmgUserWhitelist',
208 title
: gettext('Whitelist'),
210 listname
: 'whitelist',
213 model
: 'pmg-address-list',
217 url
: "/api2/json/quarantine/whitelist"
226 'border-left': '0px',
227 'border-right': '0px'
229 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
230 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
231 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
232 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'