From 7acc9a1e6bd83085203e176325d43f50bcff1af6 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 11 Sep 2018 11:25:45 +0200 Subject: [PATCH] fix #1701: add port option for smarthost allows editing/showing the smarthost and -port Signed-off-by: Dominik Csapak --- js/MailProxyRelaying.js | 54 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/js/MailProxyRelaying.js b/js/MailProxyRelaying.js index 1fca392..041b8a3 100644 --- a/js/MailProxyRelaying.js +++ b/js/MailProxyRelaying.js @@ -17,8 +17,58 @@ Ext.define('PMG.MailProxyRelaying', { me.add_boolean_row('relaynomx', gettext('Disable MX lookup')); - me.add_text_row('smarthost', gettext('Smarthost'), - { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText }); + me.rows.smarthost = { + required: true, + multiKey: ['smarthost', 'smarthostport'], + header: gettext('Smarthost'), + renderer: function() { + var host = me.getObjectValue('smarthost', undefined); + var port = me.getObjectValue('smarthostport', undefined); + var result = ''; + if (host) { + if (port) { + if (host.match(Proxmox.Utils.IP6_match)) { + result = "[" + host + "]:" + port; + } else { + result = host + ':' + port; + } + } else { + result = host; + } + } + if (result === '') { + result = Proxmox.Utils.noneText; + } + return result; + }, + editor: { + xtype: 'proxmoxWindowEdit', + subject: gettext('Smarthost'), + fieldDefaults: { + labelWidth: 100 + }, + items: [ + { + xtype: 'proxmoxtextfield', + name: 'smarthost', + deleteEmpty: true, + emptyText: Proxmox.Utils.noneText, + fieldLabel: gettext('Smarthost') + }, + { + xtype: 'proxmoxintegerfield', + name: 'smarthostport', + deleteEmpty: true, + minValue: 1, + maxValue: 65535, + emptyText: Proxmox.Utils.defaultText, + fieldLabel: gettext('Port') + } + ] + } + }; + + me.rows.smarthostport = { visible: false }; var baseurl = '/config/mail'; -- 2.39.2