[pmg-devel] [PATCH] gui: add lmtp support
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Dec 10 11:33:46 CET 2019
one small nit, which might make the whole patch quite a bit shorter:
On Mon, 9 Dec 2019 21:42:33 +0100
Julian Zehnter <pmg-devel at j-z.it> wrote:
> Signed-off-by: Julian Zehnter <pmg-devel at j-z.it>
> ---
> js/MailProxyRelaying.js | 26 ++++++++++++++++++++++----
> js/Transport.js | 20 +++++++++++++++++++-
> 2 files changed, 41 insertions(+), 5 deletions(-)
>
> diff --git a/js/MailProxyRelaying.js b/js/MailProxyRelaying.js
> index 1856130..7d82443 100644
> --- a/js/MailProxyRelaying.js
> +++ b/js/MailProxyRelaying.js
> @@ -4,16 +4,34 @@ Ext.define('PMG.MailProxyRelaying', {
> alias: ['widget.pmgMailProxyRelaying'],
>
> monStoreErrors: true,
> -
> +
> + transportprotocolTextHash: {
> + 'smtp': gettext('SMTP'),
> + 'lmtp': gettext('LMTP')
> + },
> +
We usually don't translate protocols and technical abbreviations (it causes more confusion
than it helps) - just use 'SMTP' and 'LMTP' and you could drop 'transportprotocolTextHash'
> initComponent : function() {
> var me = this;
>
> me.add_text_row('relay', gettext('Default Relay'),
> { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText });
>
> - me.add_integer_row('relayport', gettext('SMTP Port'),
> - { defaultValue: 25, deleteEmpty: true,
> - minValue: 1, maxValue: 65535 });
> + me.add_integer_row('relayport', gettext('Relay Port'),
> + { defaultValue: 25, deleteEmpty: true,
> + minValue: 1, maxValue: 65535 });
> +
> + var render_transportprotocol = function(value) {
> + return me.transportprotocolTextHash[value] || value;
> + };
you could then drop render_transportprotocol here as well
> +
> + me.add_combobox_row('transportprotocol', gettext('Transport Protocol'), {
> + defaultValue: 'smtp',
> + renderer: render_transportprotocol,
> + comboItems: [
> + ['smtp', render_transportprotocol('smtp') ],
replace render_transportprotocol('smtp') by 'SMTP'
> + ['lmtp', render_transportprotocol('lmtp') ]]
replace render_transportprotocol('lmtp') by 'LMTP'
> + });
> +
>
> me.add_boolean_row('relaynomx', gettext('Disable MX lookup'));
>
> diff --git a/js/Transport.js b/js/Transport.js
> index c721da3..ceee64b 100644
> --- a/js/Transport.js
> +++ b/js/Transport.js
> @@ -1,7 +1,7 @@
> /*global Proxmox*/
> Ext.define('pmg-transport', {
> extend: 'Ext.data.Model',
> - fields: [ 'domain', 'host', { name: 'port', type: 'integer' },
> + fields: [ 'domain', 'host', 'protocol', { name: 'port', type: 'integer' },
> { name: 'use_mx', type: 'boolean' }, 'comment' ],
> proxy: {
> type: 'proxmox',
> @@ -44,6 +44,18 @@ Ext.define('PMG.Transport', {
> name: 'host',
> fieldLabel: gettext("Host")
> },
> + {
> + xtype: 'proxmoxKVComboBox',
> + name: 'protocol',
> + fieldLabel: gettext('Protocol'),
> + deleteEmpty: false,
> + comboItems: [
> + [ 'smtp', 'SMTP' ],
> + [ 'lmtp', 'LMTP' ]
> + ],
> + allowBlank: true,
> + value: 'smtp'
> + },
> {
> xtype: 'proxmoxintegerfield',
> name: 'port',
> @@ -152,6 +164,12 @@ Ext.define('PMG.Transport', {
> sortable: true,
> dataIndex: 'host'
> },
> + {
> + header: gettext('Protocol'),
> + width: 200,
> + sortable: true,
> + dataIndex: 'protocol'
> + },
> {
> header: gettext('Port'),
> width: 80,
More information about the pmg-devel
mailing list