]>
Commit | Line | Data |
---|---|---|
fe81f069 DM |
1 | Ext.ns('PMG'); |
2 | ||
fe81f069 DM |
3 | console.log("Starting PMG Manager"); |
4 | ||
fe81f069 | 5 | |
2c7b542d DM |
6 | Ext.define('PMG.Utils', { |
7 | singleton: true, | |
ad834b6f | 8 | |
fe81f069 DM |
9 | // this singleton contains miscellaneous utilities |
10 | ||
f9b851e8 DM |
11 | senderText: gettext('Sender'), |
12 | receiverText: gettext('Receiver'), | |
012f0f49 | 13 | |
c790d2ab DM |
14 | oclass_text: { |
15 | who: gettext('Who Objects'), | |
16 | what: gettext('What Objects'), | |
17 | when: gettext('When Objects'), | |
18 | action: gettext('Action Objects') | |
19 | }, | |
ad834b6f DM |
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 | ||
012f0f49 DM |
31 | format_otype: function(otype) { |
32 | var editor = PMG.Utils.object_editors[otype]; | |
33 | if (editor) { | |
34 | return editor.subject; | |
35 | } | |
36 | return 'unknown'; | |
f6b1b3bf DM |
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'; | |
012f0f49 DM |
44 | }, |
45 | ||
46 | object_editors: { | |
47 | 1000: { | |
48 | subdir: 'regex', | |
49 | subject: gettext("Regular Expression"), | |
f7be608f | 50 | width: 400, |
012f0f49 DM |
51 | items: [ |
52 | { | |
53 | xtype: 'textfield', | |
54 | name: 'regex', | |
f7be608f | 55 | labelWidth: 150, |
012f0f49 DM |
56 | fieldLabel: gettext("Regular Expression") |
57 | } | |
58 | ] | |
59 | }, | |
60 | 1009: { | |
61 | subdir: 'receiver_regex', | |
62 | subject: gettext("Regular Expression"), | |
f7be608f DM |
63 | receivertest: true, |
64 | width: 400, | |
012f0f49 DM |
65 | items: [ |
66 | { | |
67 | xtype: 'textfield', | |
68 | name: 'regex', | |
f7be608f | 69 | labelWidth: 150, |
012f0f49 DM |
70 | fieldLabel: gettext("Regular Expression") |
71 | } | |
72 | ] | |
73 | }, | |
74 | 1001: { | |
75 | subdir: 'email', | |
76 | subject: gettext("Email"), | |
f7be608f | 77 | width: 400, |
012f0f49 DM |
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"), | |
f7be608f DM |
89 | receivertest: true, |
90 | width: 400, | |
012f0f49 DM |
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"), | |
f7be608f | 102 | width: 400, |
012f0f49 DM |
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"), | |
f7be608f DM |
114 | receivertest: true, |
115 | width: 400, | |
012f0f49 DM |
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"), | |
f7be608f | 127 | width: 400, |
012f0f49 DM |
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"), | |
f7be608f | 139 | width: 400, |
012f0f49 DM |
140 | items: [ |
141 | { | |
142 | xtype: 'textfield', | |
143 | name: 'cidr', | |
144 | fieldLabel: gettext("IP Network") | |
145 | } | |
146 | ] | |
b4eee4f7 DM |
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 | ] | |
f5de8682 DM |
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 | ||
012f0f49 DM |
196 | } |
197 | }, | |
ad834b6f | 198 | |
e653eb82 DM |
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 | ||
fe81f069 DM |
210 | constructor: function() { |
211 | var me = this; | |
fe81f069 | 212 | |
2c7b542d | 213 | // do whatever you want here |
fe81f069 DM |
214 | } |
215 | }); |