]>
git.proxmox.com Git - pmg-gui.git/blob - js/UserBlackWhiteList.js
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',
16 xclass
: 'Ext.app.ViewController',
18 onAddAddress: function() {
19 var me
= this.getView();
20 var params
= me
.getStore().getProxy().getExtraParams() || {};
22 var url
= '/quarantine/' + me
.listname
;
25 xtype
: 'proxmoxtextfield',
27 fieldLabel
: gettext("Address")
30 Ext
.Object
.each(params
, function(key
, value
) {
46 if (me
.listname
=== 'blacklist') {
47 config
.subject
= gettext("Blacklist");
48 } else if (me
.listname
== 'whitelist') {
49 config
.subject
= gettext("Whitelist");
51 throw "unknown list - internal error";
54 var win
= Ext
.createWidget('proxmoxWindowEdit', config
);
55 win
.on('destroy', function() { me
.store
.load() });
59 onRemoveAddress: function() {
60 var me
= this.getView();
61 var rec
= me
.selModel
.getSelection()[0];
64 var params
= me
.getStore().getProxy().getExtraParams() || {};
65 var url
= '/quarantine/' + me
.listname
+ '/' + rec
.getId();
67 Proxmox
.Utils
.API2Request({
68 url
: url
+ '?' + Ext
.Object
.toQueryString(params
),
71 callback: function(options
, success
, response
) {
74 failure: function (response
, opts
) {
75 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
80 changeEmail: function(combobox
, value
) {
81 var view
= this.getView();
82 view
.getStore().getProxy().setExtraParams({
85 view
.getStore().load();
88 init: function(view
) {
89 if (PMG
.view
=== 'quarantineview') {
90 this.lookupReference('email').setVisible(false);
92 Proxmox
.Utils
.monStoreErrors(view
.getView(), view
.getStore(), true);
108 displayField
: 'mail',
113 url
: '/api2/json/quarantine/quarusers'
121 fieldLabel
: 'E-Mail',
124 text
: gettext('Add'),
125 handler
: 'onAddAddress'
128 xtype
: 'proxmoxButton',
129 text
: gettext('Remove'),
131 handler
: 'onRemoveAddress',
132 confirmMsg: function(rec
) {
135 var name
= rec
.getId();
136 return Ext
.String
.format(
137 gettext('Are you sure you want to remove entry {0}'),
138 "'" + Ext
.String
.htmlEncode(name
) + "'");
145 header
: gettext('Address'),
146 dataIndex
: 'address',
147 renderer
: Ext
.String
.htmlEncode
,
153 Ext
.define('PMG.UserBlacklist', {
154 extend
: 'PMG.UserBlackWhiteList',
155 xtype
: 'pmgUserBlacklist',
157 title
: gettext('Blacklist'),
159 listname
: 'blacklist',
162 model
: 'pmg-address-list',
166 url
: "/api2/json/quarantine/blacklist"
175 'border-left': '0px',
176 'border-right': '0px',
178 html
: gettext('With this feature, you can manually mark E-mails from certain domains or addresses as spam.') + '<br><br>' +
179 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
180 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
181 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'
187 Ext
.define('PMG.UserWhitelist', {
188 extend
: 'PMG.UserBlackWhiteList',
189 xtype
: 'pmgUserWhitelist',
191 title
: gettext('Whitelist'),
193 listname
: 'whitelist',
196 model
: 'pmg-address-list',
200 url
: "/api2/json/quarantine/whitelist"
209 'border-left': '0px',
210 'border-right': '0px',
212 html
: gettext('With this feature, you can manually bypass spam checking for certain domains or E-mail addresses.') + '<br><br>' +
213 '<b>*.com</b> (all mails from <b>.com</b> domains)' + '<br>' +
214 '<b>*@example.com</b> (all mails from domain <b>example.com</b>)' + '<br>' +
215 '<b>john@example.com</b> (all mails from <b>john@example.com</b>)'