]> git.proxmox.com Git - pmg-gui.git/blob - js/FetchmailEdit.js
object editors: rework so that default label width fits everywhere
[pmg-gui.git] / js / FetchmailEdit.js
1 Ext.define('PMG.FetchmailEdit', {
2 extend: 'Proxmox.window.Edit',
3 xtype: 'pmgFetchmailEdit',
4 onlineHelp: 'pmgconfig_fetchmail',
5
6 userid: undefined,
7
8 isAdd: true,
9
10 subject: 'Fetchmail',
11
12 fieldDefaults: { labelWidth: 120 },
13
14 controller: {
15
16 xclass: 'Ext.app.ViewController',
17
18 onProtocolChange: function() {
19 var protocol = this.lookupReference('protocol').getValue();
20 var ssl = this.lookupReference('ssl').getValue();
21
22 var port_field = this.lookupReference('port');
23 if (protocol === 'pop3') {
24 port_field.setValue(ssl ? 995 : 110);
25 } else if (protocol === 'imap') {
26 port_field.setValue(ssl ? 993 : 143);
27 }
28 },
29 },
30
31 items: {
32 xtype: 'inputpanel',
33 column1: [
34 {
35 xtype: 'textfield',
36 name: 'server',
37 fieldLabel: gettext('Server'),
38 allowBlank: false,
39 },
40 {
41 xtype: 'proxmoxKVComboBox',
42 fieldLabel: gettext('Protocol'),
43 name: 'protocol',
44 reference: 'protocol',
45 value: 'pop3',
46 listeners: { change: 'onProtocolChange' },
47 comboItems: [['pop3', 'pop3'], ['imap', 'imap']],
48 },
49 {
50 xtype: 'proxmoxintegerfield',
51 name: 'port',
52 reference: 'port',
53 fieldLabel: gettext('Port'),
54 value: 110,
55 minValue: 1,
56 maxValue: 65535,
57 allowBlank: false,
58 },
59 {
60 xtype: 'textfield',
61 name: 'user',
62 fieldLabel: gettext('Username'),
63 allowBlank: false,
64 },
65 {
66 xtype: 'textfield',
67 name: 'pass',
68 inputType: 'password',
69 fieldLabel: gettext('Password'),
70 allowBlank: false,
71 },
72 {
73 xtype: 'textfield',
74 name: 'target',
75 fieldLabel: gettext('Deliver to'),
76 allowBlank: false,
77 },
78
79 ],
80 column2: [
81 {
82 xtype: 'proxmoxcheckbox',
83 fieldLabel: gettext('Enabled'),
84 name: 'enable',
85 uncheckedValue: 0,
86 checked: true,
87 },
88 {
89 xtype: 'proxmoxintegerfield',
90 name: 'interval',
91 fieldLabel: gettext('Interval'),
92 value: 1,
93 minValue: 1,
94 maxValue: 24*12*7,
95 allowBlank: false,
96 },
97 {
98 xtype: 'proxmoxcheckbox',
99 fieldLabel: gettext('Use SSL'),
100 listeners: { change: 'onProtocolChange' },
101 name: 'ssl',
102 reference: 'ssl',
103 uncheckedValue: 0,
104 checked: false,
105 },
106 {
107 xtype: 'proxmoxcheckbox',
108 fieldLabel: gettext('Keep old mails'),
109 name: 'keep',
110 uncheckedValue: 0,
111 checked: false,
112 },
113 ],
114 },
115 });