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