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