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