]> git.proxmox.com Git - pmg-gui.git/blob - js/Utils.js
add simple LDAP configuration panel
[pmg-gui.git] / js / Utils.js
1 Ext.ns('PMG');
2
3 console.log("Starting PMG Manager");
4
5
6 Ext.define('PMG.Utils', {
7 singleton: true,
8
9 // this singleton contains miscellaneous utilities
10
11 senderText: gettext('Sender'),
12 receiverText: gettext('Receiver'),
13
14 oclass_text: {
15 who: gettext('Who Objects'),
16 what: gettext('What Objects'),
17 when: gettext('When Objects'),
18 action: gettext('Action Objects')
19 },
20
21 rule_direction_text: {
22 0: gettext('In'),
23 1: gettext('Out'),
24 2: gettext('In & Out')
25 },
26
27 format_rule_direction: function(dir) {
28 return PMG.Utils.rule_direction_text[dir] || dir;
29 },
30
31 format_otype: function(otype) {
32 var editor = PMG.Utils.object_editors[otype];
33 if (editor) {
34 return editor.subject;
35 }
36 return 'unknown';
37 },
38
39 format_ldap_protocol: function(p) {
40 if (p === undefined) return 'LDAP';
41 if (p === 'ldap') return 'LDAP';
42 if (p === 'ldaps') return 'LDAPS';
43 return 'unknown';
44 },
45
46 object_editors: {
47 1000: {
48 subdir: 'regex',
49 subject: gettext("Regular Expression"),
50 width: 400,
51 items: [
52 {
53 xtype: 'textfield',
54 name: 'regex',
55 labelWidth: 150,
56 fieldLabel: gettext("Regular Expression")
57 }
58 ]
59 },
60 1009: {
61 subdir: 'receiver_regex',
62 subject: gettext("Regular Expression"),
63 receivertest: true,
64 width: 400,
65 items: [
66 {
67 xtype: 'textfield',
68 name: 'regex',
69 labelWidth: 150,
70 fieldLabel: gettext("Regular Expression")
71 }
72 ]
73 },
74 1001: {
75 subdir: 'email',
76 subject: gettext("Email"),
77 width: 400,
78 items: [
79 {
80 xtype: 'textfield',
81 name: 'email',
82 fieldLabel: gettext("Email")
83 }
84 ]
85 },
86 1007: {
87 subdir: 'receiver',
88 subject: gettext("Email"),
89 receivertest: true,
90 width: 400,
91 items: [
92 {
93 xtype: 'textfield',
94 name: 'email',
95 fieldLabel: gettext("Email")
96 }
97 ]
98 },
99 1002: {
100 subdir: 'domain',
101 subject: gettext("Domain"),
102 width: 400,
103 items: [
104 {
105 xtype: 'textfield',
106 name: 'domain',
107 fieldLabel: gettext("Domain")
108 }
109 ]
110 },
111 1008: {
112 subdir: 'receiver_domain',
113 subject: gettext("Domain"),
114 receivertest: true,
115 width: 400,
116 items: [
117 {
118 xtype: 'textfield',
119 name: 'domain',
120 fieldLabel: gettext("Domain")
121 }
122 ]
123 },
124 1003: {
125 subdir: 'ip',
126 subject: gettext("IP Address"),
127 width: 400,
128 items: [
129 {
130 xtype: 'textfield',
131 name: 'ip',
132 fieldLabel: gettext("IP Address")
133 }
134 ]
135 },
136 1004: {
137 subdir: 'network',
138 subject: gettext("IP Network"),
139 width: 400,
140 items: [
141 {
142 xtype: 'textfield',
143 name: 'cidr',
144 fieldLabel: gettext("IP Network")
145 }
146 ]
147 },
148 2000: {
149 subdir: 'timeframe',
150 subject: gettext("TimeFrame"),
151 items: [
152 {
153 xtype: 'timefield',
154 name: 'start',
155 format: 'H:i',
156 fieldLabel: gettext("Start Time")
157 },
158 {
159 xtype: 'timefield',
160 name: 'end',
161 format: 'H:i',
162 fieldLabel: gettext("End Time")
163 }
164 ]
165 },
166 4005: {
167 subdir: 'bcc',
168 subject: gettext('BCC'),
169 width: 400,
170 items: [
171 {
172 xtype: 'textfield',
173 name: 'name',
174 allowBlank: false,
175 fieldLabel: gettext('Name')
176 },
177 {
178 xtype: 'textareafield',
179 name: 'info',
180 fieldLabel: gettext("Description")
181 },
182 {
183 xtype: 'textfield',
184 name: 'target',
185 allowBlank: false,
186 fieldLabel: gettext("Target")
187 },
188 {
189 xtype: 'proxmoxcheckbox',
190 checked: true,
191 name: 'original',
192 fieldLabel: gettext("send orig. Mail")
193 }
194 ]
195
196 }
197 },
198
199 openVNCViewer: function(consoletype, nodename) {
200 var url = Ext.urlEncode({
201 console: consoletype, // upgrade or shell
202 novnc: 1,
203 node: nodename
204 });
205 var nw = window.open("?" + url, '_blank',
206 "innerWidth=745,innerheight=427");
207 nw.focus();
208 },
209
210 constructor: function() {
211 var me = this;
212
213 // do whatever you want here
214 }
215 });