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