]>
Commit | Line | Data |
---|---|---|
34c3efce DM |
1 | Ext.define('PMG.MailProxyRelaying', { |
2 | extend: 'Proxmox.grid.ObjectGrid', | |
3 | alias: ['widget.pmgMailProxyRelaying'], | |
4 | ||
5 | initComponent : function() { | |
6 | var me = this; | |
7 | ||
8 | var rows = { | |
9 | relay: { | |
10 | required: true, | |
11 | defaultValue: Proxmox.Utils.noneText, | |
12 | header: gettext('Default Relay'), | |
13 | editor: { | |
14 | xtype: 'proxmoxWindowEdit', | |
15 | subject: gettext('Default Relay'), | |
16 | items: { | |
17 | xtype: 'proxmoxtextfield', | |
18 | name: 'relay', | |
19 | deleteEmpty: true, | |
20 | fieldLabel: gettext('Default Relay') | |
21 | } | |
22 | } | |
23 | }, | |
24 | relayport: { | |
25 | required: true, | |
26 | defaultValue: 25, | |
27 | header: gettext('SMTP port'), | |
28 | editor: { | |
29 | xtype: 'proxmoxWindowEdit', | |
30 | subject: gettext('SMTP port'), | |
31 | items: { | |
32 | xtype: 'proxmoxintegerfield', | |
33 | name: 'relayport', | |
34 | minValue: 1, | |
35 | maxValue: 65535, | |
36 | deleteEmpty: true, | |
37 | value: 25, | |
38 | fieldLabel: gettext('SMTP port') | |
39 | } | |
40 | } | |
41 | }, | |
42 | relaynomx: { | |
43 | required: true, | |
44 | defaultValue: 0, | |
45 | header: gettext('Disable MX lookup'), | |
46 | renderer: Proxmox.Utils.format_boolean, | |
47 | editor: { | |
48 | xtype: 'proxmoxWindowEdit', | |
49 | subject: gettext('Disable MX lookup'), | |
50 | items: { | |
51 | xtype: 'proxmoxcheckbox', | |
52 | name: 'relaynomx', | |
53 | uncheckedValue: 0, | |
54 | defaultValue: 0, | |
55 | deleteDefaultValue: true, | |
56 | fieldLabel: gettext('Disable MX lookup') | |
57 | } | |
58 | } | |
59 | }, | |
60 | smarthost: { | |
61 | required: true, | |
62 | defaultValue: Proxmox.Utils.noneText, | |
63 | header: gettext('Smarthost'), | |
64 | editor: { | |
65 | xtype: 'proxmoxWindowEdit', | |
66 | subject: gettext('Smarthost'), | |
67 | items: { | |
68 | xtype: 'proxmoxtextfield', | |
69 | name: 'smarthost', | |
70 | deleteEmpty: true, | |
71 | fieldLabel: gettext('Smarthost') | |
72 | } | |
73 | } | |
74 | }, | |
75 | ||
76 | }; | |
77 | ||
78 | var baseurl = '/config/mail'; | |
79 | ||
80 | var reload = function() { | |
81 | me.rstore.load(); | |
82 | }; | |
83 | ||
84 | var run_editor = function() { | |
85 | var sm = me.getSelectionModel(); | |
86 | var rec = sm.getSelection()[0]; | |
87 | if (!rec) { | |
88 | return; | |
89 | } | |
90 | ||
91 | var rowdef = rows[rec.data.key]; | |
92 | if (!rowdef.editor) { | |
93 | return; | |
94 | } | |
95 | ||
96 | var win; | |
97 | if (Ext.isString(rowdef.editor)) { | |
98 | win = Ext.create(rowdef.editor, { | |
99 | pveSelNode: me.pveSelNode, | |
100 | confid: rec.data.key, | |
101 | url: '/api2/extjs/' + baseurl | |
102 | }); | |
103 | } else { | |
104 | var config = Ext.apply({ | |
105 | pveSelNode: me.pveSelNode, | |
106 | confid: rec.data.key, | |
107 | url: '/api2/extjs/' + baseurl | |
108 | }, rowdef.editor); | |
109 | win = Ext.createWidget(rowdef.editor.xtype, config); | |
110 | win.load(); | |
111 | } | |
112 | ||
113 | win.show(); | |
114 | win.on('destroy', reload); | |
115 | }; | |
116 | ||
117 | Ext.apply(me, { | |
118 | url: '/api2/json/' + baseurl, | |
119 | interval: 5000, | |
120 | cwidth1: 250, | |
121 | //tbar: [ edit_btn, revert_btn ], | |
122 | rows: rows, | |
123 | listeners: { | |
124 | itemdblclick: run_editor | |
125 | //selectionchange: set_button_status | |
126 | } | |
127 | }); | |
128 | ||
129 | me.callParent(); | |
130 | ||
131 | me.on('activate', me.rstore.startUpdate); | |
132 | me.on('destroy', me.rstore.stopUpdate); | |
133 | ||
134 | //me.rstore.on('datachanged', function() { | |
135 | //set_button_status(); | |
136 | //}); | |
137 | } | |
138 | }); |