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 Filter'),
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'),
281 xtype
: 'proxmoxWindowEdit',
283 subject
: gettext('BCC'),
290 fieldLabel
: gettext('Name')
293 xtype
: 'textareafield',
295 fieldLabel
: gettext("Description")
301 fieldLabel
: gettext("Target")
304 xtype
: 'proxmoxcheckbox',
307 fieldLabel
: gettext("send orig. Mail")
314 openVNCViewer: function(consoletype
, nodename
) {
315 var url
= Ext
.urlEncode({
316 console
: consoletype
, // upgrade or shell
320 var nw
= window
.open("?" + url
, '_blank',
321 "innerWidth=745,innerheight=427");
325 updateLoginData: function(data
) {
326 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
327 Proxmox
.UserName
= data
.username
;
328 Ext
.util
.Cookies
.set('PMGAuthCookie', data
.ticket
, null, '/', null, true );
331 quarantineActionExtracted
: false,
333 extractQuarantineAction: function() {
335 if (PMG
.Utils
.quarantineActionExtracted
) return;
337 PMG
.Utils
.quarantineActionExtracted
= true;
339 var qs
= Ext
.Object
.fromQueryString(location
.search
);
341 var cselect
= qs
.cselect
;
342 var action
= qs
.action
;
343 var ticket
= qs
.ticket
;
349 var newsearch
= Ext
.Object
.toQueryString(qs
);
351 var newurl
= location
.protocol
+ "//" + location
.host
+ location
.pathname
;
352 if (newsearch
) newurl
+= '?' + newsearch
;
353 newurl
+= location
.hash
;
355 if (window
.history
) {
356 window
.history
.pushState({ path
:newurl
}, '', newurl
);
359 if (action
&& cselect
) {
360 return { action
: action
, cselect
: cselect
};
364 constructor: function() {
367 // do whatever you want here