]> git.proxmox.com Git - pmg-gui.git/blame - js/MailProxyRelaying.js
Revert "fix tracking center with newer proxmox-widget-toolkit"
[pmg-gui.git] / js / MailProxyRelaying.js
CommitLineData
34c3efce
DM
1Ext.define('PMG.MailProxyRelaying', {
2 extend: 'Proxmox.grid.ObjectGrid',
3 alias: ['widget.pmgMailProxyRelaying'],
4
5e453db7 5 monStoreErrors: true,
1f6e503c 6
c87d46fb 7 initComponent: function() {
34c3efce
DM
8 var me = this;
9
5e72b93c 10 me.add_text_row('relay', gettext('Default Relay'),
6ccd0a47 11 { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText });
dae26b95 12
1f6e503c
TL
13 me.add_integer_row('relayport', gettext('Relay Port'), {
14 defaultValue: 25,
15 deleteEmpty: true,
16 minValue: 1,
c87d46fb 17 maxValue: 65535,
1f6e503c 18 });
34c3efce 19
d895a746 20 me.add_combobox_row('relayprotocol', gettext('Relay Protocol'), {
1f6e503c
TL
21 defaultValue: 'smtp',
22 comboItems: [
c87d46fb
TL
23 ['smtp', 'SMTP'],
24 ['lmtp', 'LMTP']],
d895a746
JZ
25 });
26
27
28 me.add_boolean_row('relaynomx', gettext('Disable MX lookup (SMTP)'));
dae26b95 29
7acc9a1e
DC
30 me.rows.smarthost = {
31 required: true,
32 multiKey: ['smarthost', 'smarthostport'],
33 header: gettext('Smarthost'),
34 renderer: function() {
35 var host = me.getObjectValue('smarthost', undefined);
36 var port = me.getObjectValue('smarthostport', undefined);
37 var result = '';
38 if (host) {
39 if (port) {
40 if (host.match(Proxmox.Utils.IP6_match)) {
41 result = "[" + host + "]:" + port;
42 } else {
43 result = host + ':' + port;
44 }
45 } else {
46 result = host;
47 }
48 }
49 if (result === '') {
50 result = Proxmox.Utils.noneText;
51 }
52 return result;
53 },
54 editor: {
55 xtype: 'proxmoxWindowEdit',
573a6e8b 56 onlineHelp: 'pmgconfig_mailproxy_relaying',
7acc9a1e
DC
57 subject: gettext('Smarthost'),
58 fieldDefaults: {
c87d46fb 59 labelWidth: 100,
7acc9a1e
DC
60 },
61 items: [
62 {
63 xtype: 'proxmoxtextfield',
64 name: 'smarthost',
65 deleteEmpty: true,
66 emptyText: Proxmox.Utils.noneText,
c87d46fb 67 fieldLabel: gettext('Smarthost'),
7acc9a1e
DC
68 },
69 {
70 xtype: 'proxmoxintegerfield',
71 name: 'smarthostport',
72 deleteEmpty: true,
73 minValue: 1,
74 maxValue: 65535,
75 emptyText: Proxmox.Utils.defaultText,
c87d46fb
TL
76 fieldLabel: gettext('Port'),
77 },
78 ],
79 },
7acc9a1e
DC
80 };
81
82 me.rows.smarthostport = { visible: false };
34c3efce
DM
83
84 var baseurl = '/config/mail';
85
d80ddaf7
DM
86 me.selModel = Ext.create('Ext.selection.RowModel', {});
87
34c3efce 88 Ext.apply(me, {
d80ddaf7
DM
89 tbar: [{
90 text: gettext('Edit'),
91 xtype: 'proxmoxButton',
92 disabled: true,
131ba4f6 93 handler: function() { me.run_editor(); },
c87d46fb 94 selModel: me.selModel,
d80ddaf7 95 }],
7bf889cb
DM
96 url: '/api2/json' + baseurl,
97 editorConfig: {
573a6e8b 98 url: '/api2/extjs' + baseurl,
c87d46fb 99 onlineHelp: 'pmgconfig_mailproxy_relaying',
7bf889cb 100 },
34c3efce 101 interval: 5000,
7c876e16 102 cwidth1: 200,
34c3efce 103 listeners: {
c87d46fb
TL
104 itemdblclick: me.run_editor,
105 },
34c3efce
DM
106 });
107
108 me.callParent();
109
110 me.on('activate', me.rstore.startUpdate);
111 me.on('destroy', me.rstore.stopUpdate);
00564597 112 me.on('deactivate', me.rstore.stopUpdate);
c87d46fb 113 },
34c3efce 114});