]>
Commit | Line | Data |
---|---|---|
1 | Ext.define('PMG.MailProxyRelaying', { | |
2 | extend: 'Proxmox.grid.ObjectGrid', | |
3 | alias: ['widget.pmgMailProxyRelaying'], | |
4 | ||
5 | monStoreErrors: true, | |
6 | ||
7 | initComponent: function() { | |
8 | var me = this; | |
9 | ||
10 | me.add_text_row('relay', gettext('Default Relay'), | |
11 | { deleteEmpty: true, defaultValue: Proxmox.Utils.noneText }); | |
12 | ||
13 | me.add_integer_row('relayport', gettext('Relay Port'), { | |
14 | defaultValue: 25, | |
15 | deleteEmpty: true, | |
16 | minValue: 1, | |
17 | maxValue: 65535, | |
18 | }); | |
19 | ||
20 | me.add_combobox_row('relayprotocol', gettext('Relay Protocol'), { | |
21 | defaultValue: 'smtp', | |
22 | comboItems: [ | |
23 | ['smtp', 'SMTP'], | |
24 | ['lmtp', 'LMTP']], | |
25 | }); | |
26 | ||
27 | ||
28 | me.add_boolean_row('relaynomx', gettext('Disable MX lookup (SMTP)')); | |
29 | ||
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', | |
56 | onlineHelp: 'pmgconfig_mailproxy_relaying', | |
57 | subject: gettext('Smarthost'), | |
58 | fieldDefaults: { | |
59 | labelWidth: 100, | |
60 | }, | |
61 | items: [ | |
62 | { | |
63 | xtype: 'proxmoxtextfield', | |
64 | name: 'smarthost', | |
65 | deleteEmpty: true, | |
66 | emptyText: Proxmox.Utils.noneText, | |
67 | fieldLabel: gettext('Smarthost'), | |
68 | }, | |
69 | { | |
70 | xtype: 'proxmoxintegerfield', | |
71 | name: 'smarthostport', | |
72 | deleteEmpty: true, | |
73 | minValue: 1, | |
74 | maxValue: 65535, | |
75 | emptyText: Proxmox.Utils.defaultText, | |
76 | fieldLabel: gettext('Port'), | |
77 | }, | |
78 | ], | |
79 | }, | |
80 | }; | |
81 | ||
82 | me.rows.smarthostport = { visible: false }; | |
83 | ||
84 | var baseurl = '/config/mail'; | |
85 | ||
86 | me.selModel = Ext.create('Ext.selection.RowModel', {}); | |
87 | ||
88 | Ext.apply(me, { | |
89 | tbar: [{ | |
90 | text: gettext('Edit'), | |
91 | xtype: 'proxmoxButton', | |
92 | disabled: true, | |
93 | handler: function() { me.run_editor(); }, | |
94 | selModel: me.selModel, | |
95 | }], | |
96 | url: '/api2/json' + baseurl, | |
97 | editorConfig: { | |
98 | url: '/api2/extjs' + baseurl, | |
99 | onlineHelp: 'pmgconfig_mailproxy_relaying', | |
100 | }, | |
101 | interval: 5000, | |
102 | cwidth1: 200, | |
103 | listeners: { | |
104 | itemdblclick: me.run_editor, | |
105 | }, | |
106 | }); | |
107 | ||
108 | me.callParent(); | |
109 | ||
110 | me.on('activate', me.rstore.startUpdate); | |
111 | me.on('destroy', me.rstore.stopUpdate); | |
112 | me.on('deactivate', me.rstore.stopUpdate); | |
113 | }, | |
114 | }); |