]> git.proxmox.com Git - pmg-gui.git/blob - js/Utils.js
implement LDAP group 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 1009: {
68 xtype: 'proxmoxWindowEdit',
69 subdir: 'receiver_regex',
70 subject: gettext("Regular Expression"),
71 receivertest: true,
72 width: 400,
73 items: [
74 {
75 xtype: 'textfield',
76 name: 'regex',
77 labelWidth: 150,
78 fieldLabel: gettext("Regular Expression")
79 }
80 ]
81 },
82 1001: {
83 xtype: 'proxmoxWindowEdit',
84 subdir: 'email',
85 subject: gettext("Email"),
86 width: 400,
87 items: [
88 {
89 xtype: 'textfield',
90 name: 'email',
91 fieldLabel: gettext("Email")
92 }
93 ]
94 },
95 1007: {
96 xtype: 'proxmoxWindowEdit',
97 subdir: 'receiver',
98 subject: gettext("Email"),
99 receivertest: true,
100 width: 400,
101 items: [
102 {
103 xtype: 'textfield',
104 name: 'email',
105 fieldLabel: gettext("Email")
106 }
107 ]
108 },
109 1002: {
110 xtype: 'proxmoxWindowEdit',
111 subdir: 'domain',
112 subject: gettext("Domain"),
113 width: 400,
114 items: [
115 {
116 xtype: 'textfield',
117 name: 'domain',
118 fieldLabel: gettext("Domain")
119 }
120 ]
121 },
122 1008: {
123 xtype: 'proxmoxWindowEdit',
124 subdir: 'receiver_domain',
125 subject: gettext("Domain"),
126 receivertest: true,
127 width: 400,
128 items: [
129 {
130 xtype: 'textfield',
131 name: 'domain',
132 fieldLabel: gettext("Domain")
133 }
134 ]
135 },
136 1003: {
137 xtype: 'proxmoxWindowEdit',
138 subdir: 'ip',
139 subject: gettext("IP Address"),
140 width: 400,
141 items: [
142 {
143 xtype: 'textfield',
144 name: 'ip',
145 fieldLabel: gettext("IP Address")
146 }
147 ]
148 },
149 1004: {
150 xtype: 'proxmoxWindowEdit',
151 subdir: 'network',
152 subject: gettext("IP Network"),
153 width: 400,
154 items: [
155 {
156 xtype: 'textfield',
157 name: 'cidr',
158 fieldLabel: gettext("IP Network")
159 }
160 ]
161 },
162 2000: {
163 xtype: 'proxmoxWindowEdit',
164 subdir: 'timeframe',
165 subject: gettext("TimeFrame"),
166 items: [
167 {
168 xtype: 'timefield',
169 name: 'start',
170 format: 'H:i',
171 fieldLabel: gettext("Start Time")
172 },
173 {
174 xtype: 'timefield',
175 name: 'end',
176 format: 'H:i',
177 fieldLabel: gettext("End Time")
178 }
179 ]
180 },
181 4005: {
182 xtype: 'proxmoxWindowEdit',
183 subdir: 'bcc',
184 subject: gettext('BCC'),
185 width: 400,
186 items: [
187 {
188 xtype: 'textfield',
189 name: 'name',
190 allowBlank: false,
191 fieldLabel: gettext('Name')
192 },
193 {
194 xtype: 'textareafield',
195 name: 'info',
196 fieldLabel: gettext("Description")
197 },
198 {
199 xtype: 'textfield',
200 name: 'target',
201 allowBlank: false,
202 fieldLabel: gettext("Target")
203 },
204 {
205 xtype: 'proxmoxcheckbox',
206 checked: true,
207 name: 'original',
208 fieldLabel: gettext("send orig. Mail")
209 }
210 ]
211
212 }
213 },
214
215 openVNCViewer: function(consoletype, nodename) {
216 var url = Ext.urlEncode({
217 console: consoletype, // upgrade or shell
218 novnc: 1,
219 node: nodename
220 });
221 var nw = window.open("?" + url, '_blank',
222 "innerWidth=745,innerheight=427");
223 nw.focus();
224 },
225
226 constructor: function() {
227 var me = this;
228
229 // do whatever you want here
230 }
231 });