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