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
: 'spamfilter',
214 subject
: gettext('Spam Filter'),
217 xtype
: 'proxmoxintegerfield',
221 fieldLabel
: gettext('Level')
226 xtype
: 'proxmoxWindowEdit',
227 subdir
: 'matchfield',
228 subject
: gettext('Match Field'),
236 fieldLabel
: gettext('Field')
244 fieldLabel
: gettext('Value')
248 fieldLabel
: gettext('Test String'),
249 xtype
: 'pmgRegexTester',
250 regexFieldReference
: 'value'
255 xtype
: 'proxmoxWindowEdit',
256 subdir
: 'contenttype',
258 subject
: gettext('Content Type Filter'),
262 displayField
: 'text',
264 valueField
: 'mimetype',
272 url
: '/api2/json/config/mimetypes'
275 fieldLabel
: gettext('Content Type'),
277 matchFieldWidth
: false,
279 change: function(cb
, value
) {
281 me
.up().down('displayfield').setValue(value
);
286 xtype
: 'displayfield',
287 fieldLabel
: gettext('Value'),
295 xtype
: 'proxmoxWindowEdit',
296 subdir
: 'filenamefilter',
298 subject
: gettext('Match Filename'),
303 reference
: 'filename',
304 fieldLabel
: gettext('Filename'),
310 fieldLabel
: gettext('Test String'),
312 xtype
: 'pmgRegexTester',
313 regexFieldReference
: 'filename'
318 xtype
: 'proxmoxWindowEdit',
319 subdir
: 'archivefilter',
321 subject
: gettext('Archive Filter'),
325 displayField
: 'text',
327 valueField
: 'mimetype',
335 url
: '/api2/json/config/mimetypes'
338 fieldLabel
: gettext('Content Type'),
340 matchFieldWidth
: false,
342 change: function(cb
, value
) {
344 me
.up().down('displayfield').setValue(value
);
349 xtype
: 'displayfield',
350 fieldLabel
: gettext('Value'),
358 xtype
: 'proxmoxWindowEdit',
360 subject
: gettext('BCC'),
367 fieldLabel
: gettext('Name')
370 xtype
: 'textareafield',
372 fieldLabel
: gettext("Description")
378 fieldLabel
: gettext("Target")
381 xtype
: 'proxmoxcheckbox',
384 fieldLabel
: gettext("send orig. Mail")
391 openVNCViewer: function(consoletype
, nodename
) {
392 var url
= Ext
.urlEncode({
393 console
: consoletype
, // upgrade or shell
397 var nw
= window
.open("?" + url
, '_blank',
398 "innerWidth=745,innerheight=427");
402 updateLoginData: function(data
) {
403 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
404 Proxmox
.UserName
= data
.username
;
405 Ext
.util
.Cookies
.set('PMGAuthCookie', data
.ticket
, null, '/', null, true );
408 quarantineActionExtracted
: false,
410 extractQuarantineAction: function() {
412 if (PMG
.Utils
.quarantineActionExtracted
) { return; }
414 PMG
.Utils
.quarantineActionExtracted
= true;
416 var qs
= Ext
.Object
.fromQueryString(location
.search
);
418 var cselect
= qs
.cselect
;
419 var action
= qs
.action
;
420 var ticket
= qs
.ticket
;
426 var newsearch
= Ext
.Object
.toQueryString(qs
);
428 var newurl
= location
.protocol
+ "//" + location
.host
+ location
.pathname
;
429 if (newsearch
) { newurl
+= '?' + newsearch
; }
430 newurl
+= location
.hash
;
432 if (window
.history
) {
433 window
.history
.pushState({ path
:newurl
}, '', newurl
);
436 if (action
&& cselect
) {
437 return { action
: action
, cselect
: cselect
};
441 constructor: function() {
444 // do whatever you want here