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