Ext.define('pmg-object-list', {
extend: 'Ext.data.Model',
fields: [
- 'id', 'descr', 'otype_text',
+ 'id', 'descr',
{ name: 'otype', type: 'integer' },
{ name: 'receivertest', type: 'boolean' }
],
extend: 'Ext.grid.GridPanel',
alias: ['widget.pmgSMTPWhitelist'],
-
+
columns: [
{
header: gettext('Type'),
- dataIndex: 'otype_text'
+ dataIndex: 'otype',
+ renderer: PMG.Utils.format_otype,
+ width: 200
},
{
header: gettext('Direction'),
PMG.Utils.receiverText : PMG.Utils.senderText;
var config = Ext.apply({ method: 'PUT' }, editor);
- config.subject = editor.subject + ' (' + direction + ')';
-
+ config.subject = editor.subject + ' (' + direction + ')';
+
config.url = "/config/whitelist/" + editor.subdir +
'/' + rec.data.id;
win.on('destroy', reload);
win.show();
};
-
+
+ var menu_items = [];
+
+ Ext.Array.each([1000, 1009, 1001, 1007, 1002, 1008, 1003, 1004], function(otype) {
+
+ var editor = PMG.Utils.object_editors[otype];
+
+ var direction = editor.receivertest ?
+ PMG.Utils.receiverText : PMG.Utils.senderText;
+
+ var config = Ext.apply({ method: 'POST' }, editor);
+ config.subject = editor.subject + ' (' + direction + ')';
+
+ config.url = "/config/whitelist/" + editor.subdir;
+ menu_items.push({
+ text: config.subject,
+ handler: function() {
+ var win = Ext.createWidget('proxmoxWindowEdit', config);
+ win.on('destroy', reload);
+ win.show();
+ }
+ });
+ });
+
me.tbar = [
- {
+ {
+ text: gettext('Add'),
+ menu: new Ext.menu.Menu({
+ items: menu_items
+ })
+ },
+ {
xtype: 'proxmoxButton',
text: gettext('Edit'),
disabled: true,
},
remove_btn
];
-
+
Proxmox.Utils.monStoreErrors(me, me.store);
Ext.apply(me, {
1000: {
subdir: 'regex',
subject: gettext("Regular Expression"),
+ width: 400,
items: [
{
xtype: 'textfield',
name: 'regex',
+ labelWidth: 150,
fieldLabel: gettext("Regular Expression")
}
]
1009: {
subdir: 'receiver_regex',
subject: gettext("Regular Expression"),
+ receivertest: true,
+ width: 400,
items: [
{
xtype: 'textfield',
name: 'regex',
+ labelWidth: 150,
fieldLabel: gettext("Regular Expression")
}
]
1001: {
subdir: 'email',
subject: gettext("Email"),
+ width: 400,
items: [
{
xtype: 'textfield',
1007: {
subdir: 'receiver',
subject: gettext("Email"),
+ receivertest: true,
+ width: 400,
items: [
{
xtype: 'textfield',
1002: {
subdir: 'domain',
subject: gettext("Domain"),
+ width: 400,
items: [
{
xtype: 'textfield',
1008: {
subdir: 'receiver_domain',
subject: gettext("Domain"),
+ receivertest: true,
+ width: 400,
items: [
{
xtype: 'textfield',
1003: {
subdir: 'ip',
subject: gettext("IP Address"),
+ width: 400,
items: [
{
xtype: 'textfield',
1004: {
subdir: 'network',
subject: gettext("IP Network"),
+ width: 400,
items: [
{
xtype: 'textfield',