]>
git.proxmox.com Git - pmg-gui.git/blob - js/Utils.js
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'),
15 who
: gettext('Who Objects'),
16 what
: gettext('What Objects'),
17 when
: gettext('When Objects'),
18 action
: gettext('Action Objects'),
19 from: gettext('From'),
24 who
: '<span class="fa fa-fw fa-user-circle"></span> ',
25 what
: '<span class="fa fa-fw fa-cube"></span> ',
26 when
: '<span class="fa fa-fw fa-clock-o"></span> ',
27 action
: '<span class="fa fa-fw fa-flag"></span> ',
28 from: '<span class="fa fa-fw fa-user-circle"></span> ',
29 to
: '<span class="fa fa-fw fa-user-circle"></span> ',
32 format_oclass: function(oclass
) {
33 var icon
= PMG
.Utils
.oclass_icon
[oclass
] || '';
34 var text
= PMG
.Utils
.oclass_text
[oclass
] || oclass
;
38 rule_direction_text
: {
41 2: gettext('In & Out')
44 rule_direction_icon
: {
45 0: '<span class="x-fa fa-fw fa-long-arrow-left"></span> ',
46 1: '<span class="x-fa fa-fw fa-long-arrow-right"></span> ',
47 2: '<span class="x-fa fa-fw fa-exchange"></span> '
50 format_rule_direction: function(dir
) {
51 var icon
= PMG
.Utils
.rule_direction_icon
[dir
] || '';
52 var text
= PMG
.Utils
.rule_direction_text
[dir
] || dir
;
56 format_otype: function(otype
) {
57 var editor
= PMG
.Utils
.object_editors
[otype
];
59 return editor
.subject
;
64 format_ldap_protocol: function(p
) {
65 if (p
=== undefined) return 'LDAP';
66 if (p
=== 'ldap') return 'LDAP';
67 if (p
=== 'ldaps') return 'LDAPS';
73 xtype
: 'proxmoxWindowEdit',
75 subject
: gettext("Regular Expression"),
82 fieldLabel
: gettext("Regular Expression")
87 xtype
: 'pmgLDAPGroupEditor',
89 subject
: gettext("LDAP Group")
92 xtype
: 'pmgLDAPUserEditor',
94 subject
: gettext("LDAP User")
97 xtype
: 'proxmoxWindowEdit',
98 subdir
: 'receiver_regex',
99 subject
: gettext("Regular Expression"),
107 fieldLabel
: gettext("Regular Expression")
112 xtype
: 'proxmoxWindowEdit',
114 subject
: gettext("Email"),
120 fieldLabel
: gettext("Email")
125 xtype
: 'proxmoxWindowEdit',
127 subject
: gettext("Email"),
134 fieldLabel
: gettext("Email")
139 xtype
: 'proxmoxWindowEdit',
141 subject
: gettext("Domain"),
147 fieldLabel
: gettext("Domain")
152 xtype
: 'proxmoxWindowEdit',
153 subdir
: 'receiver_domain',
154 subject
: gettext("Domain"),
161 fieldLabel
: gettext("Domain")
166 xtype
: 'proxmoxWindowEdit',
168 subject
: gettext("IP Address"),
174 fieldLabel
: gettext("IP Address")
179 xtype
: 'proxmoxWindowEdit',
181 subject
: gettext("IP Network"),
187 fieldLabel
: gettext("IP Network")
192 xtype
: 'proxmoxWindowEdit',
194 subject
: gettext("TimeFrame"),
200 fieldLabel
: gettext("Start Time")
206 fieldLabel
: gettext("End Time")
211 xtype
: 'proxmoxWindowEdit',
213 subject
: gettext('BCC'),
220 fieldLabel
: gettext('Name')
223 xtype
: 'textareafield',
225 fieldLabel
: gettext("Description")
231 fieldLabel
: gettext("Target")
234 xtype
: 'proxmoxcheckbox',
237 fieldLabel
: gettext("send orig. Mail")
244 openVNCViewer: function(consoletype
, nodename
) {
245 var url
= Ext
.urlEncode({
246 console
: consoletype
, // upgrade or shell
250 var nw
= window
.open("?" + url
, '_blank',
251 "innerWidth=745,innerheight=427");
255 updateLoginData: function(data
) {
256 Proxmox
.CSRFPreventionToken
= data
.CSRFPreventionToken
;
257 Proxmox
.UserName
= data
.username
;
258 Ext
.util
.Cookies
.set('PMGAuthCookie', data
.ticket
, null, '/', null, true );
261 constructor: function() {
264 // do whatever you want here