3 console
.log("Starting PMG Manager");
6 Ext
.define('PMG.Utils', {
9 // this singleton contains miscellaneous utilities
11 senderText
: gettext('Sender'),
12 receiverText
: gettext('Receiver'),
13 scoreText
: gettext('Score'),
16 who
: gettext('Who Objects'),
17 what
: gettext('What Objects'),
18 when
: gettext('When Objects'),
19 action
: gettext('Action Objects'),
20 from: gettext('From'),
25 who
: '<span class="fa fa-fw fa-user-circle"></span> ',
26 what
: '<span class="fa fa-fw fa-cube"></span> ',
27 when
: '<span class="fa fa-fw fa-clock-o"></span> ',
28 action
: '<span class="fa fa-fw fa-flag"></span> ',
29 from: '<span class="fa fa-fw fa-user-circle"></span> ',
30 to
: '<span class="fa fa-fw fa-user-circle"></span> ',
33 format_oclass: function(oclass
) {
34 var icon
= PMG
.Utils
.oclass_icon
[oclass
] || '';
35 var text
= PMG
.Utils
.oclass_text
[oclass
] || oclass
;
39 rule_direction_text
: {
42 2: gettext('In & Out')
45 rule_direction_icon
: {
46 0: '<span class="fa fa-fw fa-long-arrow-left"></span> ',
47 1: '<span class="fa fa-fw fa-long-arrow-right"></span> ',
48 2: '<span class="fa fa-fw fa-exchange"></span> '
51 format_rule_direction: function(dir
) {
52 var icon
= PMG
.Utils
.rule_direction_icon
[dir
] || '';
53 var text
= PMG
.Utils
.rule_direction_text
[dir
] || dir
;
57 format_otype: function(otype
) {
58 var editor
= PMG
.Utils
.object_editors
[otype
];
60 return editor
.subject
;
65 format_ldap_protocol: function(p
) {
66 if (p
=== undefined) return 'LDAP';
67 if (p
=== 'ldap') return 'LDAP';
68 if (p
=== 'ldaps') return 'LDAPS';
74 xtype
: 'proxmoxWindowEdit',
76 subject
: gettext("Regular Expression"),
83 fieldLabel
: gettext("Regular Expression")
88 xtype
: 'pmgLDAPGroupEditor',
90 subject
: gettext("LDAP Group")
93 xtype
: 'pmgLDAPUserEditor',
95 subject
: gettext("LDAP User")
98 xtype
: 'proxmoxWindowEdit',
99 subdir
: 'receiver_regex',
100 subject
: gettext("Regular Expression"),
108 fieldLabel
: gettext("Regular Expression")
113 xtype
: 'proxmoxWindowEdit',
115 subject
: gettext("Email"),
121 fieldLabel
: gettext("Email")
126 xtype
: 'proxmoxWindowEdit',
128 subject
: gettext("Email"),
135 fieldLabel
: gettext("Email")
140 xtype
: 'proxmoxWindowEdit',
142 subject
: gettext("Domain"),
148 fieldLabel
: gettext("Domain")
153 xtype
: 'proxmoxWindowEdit',
154 subdir
: 'receiver_domain',
155 subject
: gettext("Domain"),
162 fieldLabel
: gettext("Domain")
167 xtype
: 'proxmoxWindowEdit',
169 subject
: gettext("IP Address"),
175 fieldLabel
: gettext("IP Address")
180 xtype
: 'proxmoxWindowEdit',
182 subject
: gettext("IP Network"),
188 fieldLabel
: gettext("IP Network")
193 xtype
: 'proxmoxWindowEdit',
195 subject
: gettext("TimeFrame"),
201 fieldLabel
: gettext("Start Time")
207 fieldLabel
: gettext("End Time")
212 xtype
: 'proxmoxWindowEdit',
213 subdir
: 'matchfield',
214 subject
: gettext('Match Field'),
222 fieldLabel
: gettext('Field')
230 fieldLabel
: gettext('Value')
234 fieldLabel
: gettext('Test String'),
235 xtype
: 'pmgRegexTester',
236 regexFieldReference
: 'value',
241 xtype
: 'proxmoxWindowEdit',
242 subdir
: 'contenttype',
244 subject
: gettext('Content Type'),
248 displayField
: 'text',
250 valueField
: 'mimetype',
258 url
: '/api2/json/config/mimetypes'
261 fieldLabel
: gettext('Content Type'),
263 matchFieldWidth
: false,
265 change: function(cb
, value
) {
267 me
.up().down('displayfield').setValue(value
);
272 xtype
: 'displayfield',
273 fieldLabel
: gettext('Value'),
280 xtype
: 'proxmoxWindowEdit',
282 subject
: gettext('BCC'),
289 fieldLabel
: gettext('Name')
292 xtype
: 'textareafield',
294 fieldLabel
: gettext("Description")
300 fieldLabel
: gettext("Target")
303 xtype
: 'proxmoxcheckbox',
306 fieldLabel
: gettext("send orig. Mail")
313 openVNCViewer: function(consoletype
, nodename
) {
314 var url
= Ext
.urlEncode({
315 console
: consoletype
, // upgrade or shell
319 var nw
= window
.open("?" + url
, '_blank',
320 "innerWidth=745,innerheight=427");
324 updateLoginData: function(data
) {
325 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
326 Proxmox
.UserName
= data
.username
;
327 Ext
.util
.Cookies
.set('PMGAuthCookie', data
.ticket
, null, '/', null, true );
330 quarantineActionExtracted
: false,
332 extractQuarantineAction: function() {
334 if (PMG
.Utils
.quarantineActionExtracted
) return;
336 PMG
.Utils
.quarantineActionExtracted
= true;
338 var qs
= Ext
.Object
.fromQueryString(location
.search
);
340 var cselect
= qs
.cselect
;
341 var action
= qs
.action
;
342 var ticket
= qs
.ticket
;
348 var newsearch
= Ext
.Object
.toQueryString(qs
);
350 var newurl
= location
.protocol
+ "//" + location
.host
+ location
.pathname
;
351 if (newsearch
) newurl
+= '?' + newsearch
;
352 newurl
+= location
.hash
;
354 if (window
.history
) {
355 window
.history
.pushState({ path
:newurl
}, '', newurl
);
358 if (action
&& cselect
) {
359 return { action
: action
, cselect
: cselect
};
363 constructor: function() {
366 // do whatever you want here