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> '
44 format_oclass: function(oclass
) {
45 var icon
= PMG
.Utils
.oclass_icon
[oclass
] || '';
46 var text
= PMG
.Utils
.oclass_text
[oclass
] || oclass
;
50 rule_direction_text
: {
53 2: gettext('In & Out')
56 rule_direction_icon
: {
57 0: '<span class="fa fa-fw fa-long-arrow-left"></span> ',
58 1: '<span class="fa fa-fw fa-long-arrow-right"></span> ',
59 2: '<span class="fa fa-fw fa-exchange"></span> '
62 format_rule_direction: function(dir
) {
63 var icon
= PMG
.Utils
.rule_direction_icon
[dir
] || '';
64 var text
= PMG
.Utils
.rule_direction_text
[dir
] || dir
;
68 format_otype: function(otype
) {
69 var editor
= PMG
.Utils
.object_editors
[otype
];
71 return editor
.subject
;
76 format_ldap_protocol: function(p
) {
77 if (p
=== undefined) { return 'LDAP'; }
78 if (p
=== 'ldap') { return 'LDAP'; }
79 if (p
=== 'ldaps') { return 'LDAPS'; }
85 xtype
: 'proxmoxWindowEdit',
87 subject
: gettext("Regular Expression"),
94 fieldLabel
: gettext("Regular Expression")
99 xtype
: 'pmgLDAPGroupEditor',
101 subject
: gettext("LDAP Group")
104 xtype
: 'pmgLDAPUserEditor',
106 subject
: gettext("LDAP User")
109 xtype
: 'proxmoxWindowEdit',
110 subdir
: 'receiver_regex',
111 subject
: gettext("Regular Expression"),
119 fieldLabel
: gettext("Regular Expression")
124 xtype
: 'proxmoxWindowEdit',
126 subject
: gettext("Email"),
132 fieldLabel
: gettext("Email")
137 xtype
: 'proxmoxWindowEdit',
139 subject
: gettext("Email"),
146 fieldLabel
: gettext("Email")
151 xtype
: 'proxmoxWindowEdit',
153 subject
: gettext("Domain"),
159 fieldLabel
: gettext("Domain")
164 xtype
: 'proxmoxWindowEdit',
165 subdir
: 'receiver_domain',
166 subject
: gettext("Domain"),
173 fieldLabel
: gettext("Domain")
178 xtype
: 'proxmoxWindowEdit',
180 subject
: gettext("IP Address"),
186 fieldLabel
: gettext("IP Address")
191 xtype
: 'proxmoxWindowEdit',
193 subject
: gettext("IP Network"),
199 fieldLabel
: gettext("IP Network")
204 xtype
: 'proxmoxWindowEdit',
206 subject
: gettext("TimeFrame"),
212 fieldLabel
: gettext("Start Time")
218 fieldLabel
: gettext("End Time")
223 xtype
: 'proxmoxWindowEdit',
224 subdir
: 'spamfilter',
225 subject
: gettext('Spam Filter'),
228 xtype
: 'proxmoxintegerfield',
232 fieldLabel
: gettext('Level')
237 xtype
: 'proxmoxWindowEdit',
238 subdir
: 'matchfield',
239 subject
: gettext('Match Field'),
247 fieldLabel
: gettext('Field')
255 fieldLabel
: gettext('Value')
259 fieldLabel
: gettext('Test String'),
260 xtype
: 'pmgRegexTester',
261 regexFieldReference
: 'value'
266 xtype
: 'proxmoxWindowEdit',
267 subdir
: 'contenttype',
269 subject
: gettext('Content Type Filter'),
273 displayField
: 'text',
275 valueField
: 'mimetype',
283 url
: '/api2/json/config/mimetypes'
286 fieldLabel
: gettext('Content Type'),
288 matchFieldWidth
: false,
290 change: function(cb
, value
) {
292 me
.up().down('displayfield').setValue(value
);
297 xtype
: 'displayfield',
298 fieldLabel
: gettext('Value'),
306 xtype
: 'proxmoxWindowEdit',
307 subdir
: 'filenamefilter',
309 subject
: gettext('Match Filename'),
314 reference
: 'filename',
315 fieldLabel
: gettext('Filename'),
321 fieldLabel
: gettext('Test String'),
323 xtype
: 'pmgRegexTester',
324 regexFieldReference
: 'filename'
329 xtype
: 'proxmoxWindowEdit',
330 subdir
: 'archivefilter',
332 subject
: gettext('Archive Filter'),
336 displayField
: 'text',
338 valueField
: 'mimetype',
346 url
: '/api2/json/config/mimetypes'
349 fieldLabel
: gettext('Content Type'),
351 matchFieldWidth
: false,
353 change: function(cb
, value
) {
355 me
.up().down('displayfield').setValue(value
);
360 xtype
: 'displayfield',
361 fieldLabel
: gettext('Value'),
369 xtype
: 'proxmoxWindowEdit',
371 subject
: gettext('BCC'),
378 fieldLabel
: gettext('Name')
381 xtype
: 'textareafield',
383 fieldLabel
: gettext("Description")
389 fieldLabel
: gettext("Target")
392 xtype
: 'proxmoxcheckbox',
395 fieldLabel
: gettext("send orig. Mail")
402 openVNCViewer: function(consoletype
, nodename
) {
403 var url
= Ext
.urlEncode({
404 console
: consoletype
, // upgrade or shell
408 var nw
= window
.open("?" + url
, '_blank',
409 "innerWidth=745,innerheight=427");
413 updateLoginData: function(data
) {
414 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
415 Proxmox
.UserName
= data
.username
;
416 Ext
.util
.Cookies
.set('PMGAuthCookie', data
.ticket
, null, '/', null, true );
419 quarantineActionExtracted
: false,
421 extractQuarantineAction: function() {
423 if (PMG
.Utils
.quarantineActionExtracted
) { return; }
425 PMG
.Utils
.quarantineActionExtracted
= true;
427 var qs
= Ext
.Object
.fromQueryString(location
.search
);
429 var cselect
= qs
.cselect
;
430 var action
= qs
.action
;
431 var ticket
= qs
.ticket
;
437 var newsearch
= Ext
.Object
.toQueryString(qs
);
439 var newurl
= location
.protocol
+ "//" + location
.host
+ location
.pathname
;
440 if (newsearch
) { newurl
+= '?' + newsearch
; }
441 newurl
+= location
.hash
;
443 if (window
.history
) {
444 window
.history
.pushState({ path
:newurl
}, '', newurl
);
447 if (action
&& cselect
) {
448 return { action
: action
, cselect
: cselect
};
452 constructor: function() {
455 // do whatever you want here