]> git.proxmox.com Git - pmg-gui.git/blame - js/Utils.js
make who regex tests anchored
[pmg-gui.git] / js / Utils.js
CommitLineData
2c1d504e 1/*global Proxmox */
fe81f069
DM
2Ext.ns('PMG');
3
fe81f069
DM
4console.log("Starting PMG Manager");
5
fe81f069 6
2c7b542d
DM
7Ext.define('PMG.Utils', {
8 singleton: true,
ad834b6f 9
fe81f069
DM
10 // this singleton contains miscellaneous utilities
11
f9b851e8
DM
12 senderText: gettext('Sender'),
13 receiverText: gettext('Receiver'),
ad88af09 14 scoreText: gettext('Score'),
012f0f49 15
7818f0a3
DM
16 user_role_text: {
17 root: gettext('Superuser'),
18 admin: gettext('Administrator'),
751d131c 19 helpdesk: gettext('Help Desk'),
7818f0a3 20 qmanager: gettext('Quarantine Manager'),
771bd0b9 21 audit: gettext('Auditor')
7818f0a3
DM
22 },
23
24 format_user_role: function(role) {
25 return PMG.Utils.user_role_text[role] || role;
26 },
27
c790d2ab
DM
28 oclass_text: {
29 who: gettext('Who Objects'),
30 what: gettext('What Objects'),
31 when: gettext('When Objects'),
076d6a72
DC
32 action: gettext('Action Objects'),
33 from: gettext('From'),
34 to: gettext('To')
35 },
36
37 oclass_icon: {
38 who: '<span class="fa fa-fw fa-user-circle"></span> ',
39 what: '<span class="fa fa-fw fa-cube"></span> ',
40 when: '<span class="fa fa-fw fa-clock-o"></span> ',
41 action: '<span class="fa fa-fw fa-flag"></span> ',
42 from: '<span class="fa fa-fw fa-user-circle"></span> ',
cc6b80b6 43 to: '<span class="fa fa-fw fa-user-circle"></span> '
076d6a72
DC
44 },
45
cf248533
DM
46 mail_status_map: {
47 2: 'delivered',
48 4: 'deferred',
49 5: 'bounced',
50 N: 'rejected',
51 G: 'greylisted',
52 A: 'accepted',
53 B: 'blocked',
54 Q: 'quarantine'
55 },
56
20d8d037
DC
57 icon_status_map_class: {
58 2: 'check-circle',
59 4: 'clock-o',
60 5: 'mail-reply',
61 N: 'times-circle',
62 G: 'list',
63 A: 'check',
64 B: 'ban',
65 Q: 'cube'
66 },
67
68 icon_status_map_color: {
69 2: 'green',
70 5: 'gray',
71 A: 'green',
72 B: 'red'
c4ff49f7
DC
73 },
74
75 format_status_icon: function(status) {
20d8d037
DC
76 var icon = PMG.Utils.icon_status_map_class[status] || 'question-circle';
77 var color = PMG.Utils.icon_status_map_color[status] || '';
78 return '<i class="fa fa-' + icon + ' ' + color + '"></i> ';
c4ff49f7
DC
79 },
80
076d6a72
DC
81 format_oclass: function(oclass) {
82 var icon = PMG.Utils.oclass_icon[oclass] || '';
83 var text = PMG.Utils.oclass_text[oclass] || oclass;
84 return icon + text;
c790d2ab 85 },
ad834b6f
DM
86
87 rule_direction_text: {
88 0: gettext('In'),
89 1: gettext('Out'),
90 2: gettext('In & Out')
91 },
92
4b7e5c48 93 rule_direction_icon: {
2b97521b
DC
94 0: '<span class="fa fa-fw fa-long-arrow-left"></span> ',
95 1: '<span class="fa fa-fw fa-long-arrow-right"></span> ',
96 2: '<span class="fa fa-fw fa-exchange"></span> '
4b7e5c48
DC
97 },
98
ad834b6f 99 format_rule_direction: function(dir) {
4b7e5c48
DC
100 var icon = PMG.Utils.rule_direction_icon[dir] || '';
101 var text = PMG.Utils.rule_direction_text[dir] || dir;
102 return icon + text;
ad834b6f
DM
103 },
104
012f0f49
DM
105 format_otype: function(otype) {
106 var editor = PMG.Utils.object_editors[otype];
ea4f2a79 107 var iconCls = 'fa fa-question-circle';
012f0f49 108 if (editor) {
ea4f2a79
DC
109 var icon = '<span class="fa-fw ' + (editor.iconCls || iconCls) + '"></span> ';
110 return icon + editor.subject;
012f0f49 111 }
ea4f2a79
DC
112
113 return '<span class="fa-fw ' + iconCls + '"></span> unknown';
f6b1b3bf
DM
114 },
115
116 format_ldap_protocol: function(p) {
cc6b80b6
DM
117 if (p === undefined) { return 'LDAP'; }
118 if (p === 'ldap') { return 'LDAP'; }
119 if (p === 'ldaps') { return 'LDAPS'; }
f6b1b3bf 120 return 'unknown';
012f0f49
DM
121 },
122
b79fbba8
DC
123 convert_field_to_per_min: function(value, record) {
124 return (value/(record.data.timespan/60));
125 },
126
012f0f49
DM
127 object_editors: {
128 1000: {
573a6e8b 129 onlineHelp: 'pmg_mailfilter_regex',
ea4f2a79 130 iconCls: 'fa fa-filter',
5f3ec152 131 xtype: 'proxmoxWindowEdit',
012f0f49
DM
132 subdir: 'regex',
133 subject: gettext("Regular Expression"),
f7be608f 134 width: 400,
012f0f49
DM
135 items: [
136 {
137 xtype: 'textfield',
138 name: 'regex',
f7be608f 139 labelWidth: 150,
6994550a 140 reference: 'regex',
012f0f49 141 fieldLabel: gettext("Regular Expression")
6994550a
DC
142 },
143 {
144 labelWidth: 150,
145 fieldLabel: gettext('Test String'),
146 xtype: 'pmgRegexTester',
4eab05c2 147 wholeMatch: true,
6994550a 148 regexFieldReference: 'regex'
012f0f49
DM
149 }
150 ]
151 },
5f3ec152 152 1005: {
573a6e8b 153 onlineHelp: 'pmgconfig_ldap',
ea4f2a79 154 iconCls: 'fa fa-users',
5f3ec152
DM
155 xtype: 'pmgLDAPGroupEditor',
156 subdir: 'ldap',
157 subject: gettext("LDAP Group")
158 },
6c137003 159 1006: {
573a6e8b 160 onlineHelp: 'pmgconfig_ldap',
ea4f2a79 161 iconCls: 'fa fa-user',
6c137003
DM
162 xtype: 'pmgLDAPUserEditor',
163 subdir: 'ldapuser',
164 subject: gettext("LDAP User")
165 },
012f0f49 166 1009: {
573a6e8b 167 onlineHelp: 'pmg_mailfilter_regex',
ea4f2a79 168 iconCls: 'fa fa-filter',
5f3ec152 169 xtype: 'proxmoxWindowEdit',
012f0f49
DM
170 subdir: 'receiver_regex',
171 subject: gettext("Regular Expression"),
f7be608f
DM
172 receivertest: true,
173 width: 400,
012f0f49
DM
174 items: [
175 {
176 xtype: 'textfield',
177 name: 'regex',
f7be608f 178 labelWidth: 150,
012f0f49
DM
179 fieldLabel: gettext("Regular Expression")
180 }
181 ]
182 },
183 1001: {
573a6e8b 184 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 185 iconCls: 'fa fa-envelope-o',
5f3ec152 186 xtype: 'proxmoxWindowEdit',
012f0f49 187 subdir: 'email',
64fb657f 188 subject: gettext("E-Mail"),
f7be608f 189 width: 400,
012f0f49
DM
190 items: [
191 {
192 xtype: 'textfield',
193 name: 'email',
64fb657f 194 fieldLabel: gettext("E-Mail")
012f0f49
DM
195 }
196 ]
197 },
198 1007: {
573a6e8b 199 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 200 iconCls: 'fa fa-envelope-o',
5f3ec152 201 xtype: 'proxmoxWindowEdit',
012f0f49 202 subdir: 'receiver',
64fb657f 203 subject: gettext("E-Mail"),
f7be608f
DM
204 receivertest: true,
205 width: 400,
012f0f49
DM
206 items: [
207 {
208 xtype: 'textfield',
209 name: 'email',
64fb657f 210 fieldLabel: gettext("E-Mail")
012f0f49
DM
211 }
212 ]
213 },
214 1002: {
573a6e8b 215 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 216 iconCls: 'fa fa-globe',
5f3ec152 217 xtype: 'proxmoxWindowEdit',
012f0f49
DM
218 subdir: 'domain',
219 subject: gettext("Domain"),
f7be608f 220 width: 400,
012f0f49
DM
221 items: [
222 {
223 xtype: 'textfield',
224 name: 'domain',
225 fieldLabel: gettext("Domain")
226 }
227 ]
228 },
229 1008: {
573a6e8b 230 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 231 iconCls: 'fa fa-globe',
5f3ec152 232 xtype: 'proxmoxWindowEdit',
012f0f49
DM
233 subdir: 'receiver_domain',
234 subject: gettext("Domain"),
f7be608f
DM
235 receivertest: true,
236 width: 400,
012f0f49
DM
237 items: [
238 {
239 xtype: 'textfield',
240 name: 'domain',
241 fieldLabel: gettext("Domain")
242 }
243 ]
244 },
245 1003: {
573a6e8b 246 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 247 iconCls: 'fa fa-globe',
5f3ec152 248 xtype: 'proxmoxWindowEdit',
012f0f49
DM
249 subdir: 'ip',
250 subject: gettext("IP Address"),
f7be608f 251 width: 400,
012f0f49
DM
252 items: [
253 {
254 xtype: 'textfield',
255 name: 'ip',
256 fieldLabel: gettext("IP Address")
257 }
258 ]
259 },
260 1004: {
573a6e8b 261 onlineHelp: 'pmg_mailfilter_who',
ea4f2a79 262 iconCls: 'fa fa-globe',
5f3ec152 263 xtype: 'proxmoxWindowEdit',
012f0f49
DM
264 subdir: 'network',
265 subject: gettext("IP Network"),
f7be608f 266 width: 400,
012f0f49
DM
267 items: [
268 {
269 xtype: 'textfield',
270 name: 'cidr',
271 fieldLabel: gettext("IP Network")
272 }
273 ]
b4eee4f7
DM
274 },
275 2000: {
573a6e8b 276 onlineHelp: 'pmg_mailfilter_when',
ea4f2a79 277 iconCls: 'fa fa-clock-o',
5f3ec152 278 xtype: 'proxmoxWindowEdit',
b4eee4f7
DM
279 subdir: 'timeframe',
280 subject: gettext("TimeFrame"),
281 items: [
282 {
283 xtype: 'timefield',
284 name: 'start',
285 format: 'H:i',
286 fieldLabel: gettext("Start Time")
287 },
288 {
289 xtype: 'timefield',
290 name: 'end',
291 format: 'H:i',
292 fieldLabel: gettext("End Time")
293 }
294 ]
f5de8682 295 },
bed64e74 296 3000: {
573a6e8b 297 onlineHelp: 'pmg_mailfilter_what',
ea4f2a79 298 iconCls: 'fa fa-bullhorn',
bed64e74
DC
299 xtype: 'proxmoxWindowEdit',
300 subdir: 'spamfilter',
301 subject: gettext('Spam Filter'),
302 items: [
303 {
304 xtype: 'proxmoxintegerfield',
305 name: 'spamlevel',
306 allowBlank: false,
307 minValue: 0,
308 fieldLabel: gettext('Level')
cc6b80b6 309 }
bed64e74
DC
310 ]
311 },
8ddd9c44 312 3001: {
573a6e8b 313 onlineHelp: 'pmg_mailfilter_what',
ea4f2a79 314 iconCls: 'fa fa-bug',
8ddd9c44
DC
315 xtype: 'proxmoxWindowEdit',
316 subdir: 'virusfilter',
317 subject: gettext('Virus Filter'),
318 uneditable: true,
319 // there are no parameters to give, so we simply submit it
320 listeners: {
321 show: function(win) {
322 win.submit();
323 }
324 }
325 },
3a9b95a7 326 3002: {
573a6e8b 327 onlineHelp: 'pmg_mailfilter_regex',
ea4f2a79 328 iconCls: 'fa fa-code',
3a9b95a7
DC
329 xtype: 'proxmoxWindowEdit',
330 subdir: 'matchfield',
331 subject: gettext('Match Field'),
50fa6520 332 width: 400,
3a9b95a7
DC
333 items: [
334 {
335 xtype: 'textfield',
336 name: 'field',
50fa6520 337 labelWidth: 150,
3a9b95a7
DC
338 allowBlank: false,
339 fieldLabel: gettext('Field')
340 },
341 {
342 xtype: 'textfield',
50fa6520 343 reference: 'value',
3a9b95a7 344 name: 'value',
50fa6520 345 labelWidth: 150,
3a9b95a7
DC
346 allowBlank: false,
347 fieldLabel: gettext('Value')
348 },
50fa6520
DC
349 {
350 labelWidth: 150,
351 fieldLabel: gettext('Test String'),
352 xtype: 'pmgRegexTester',
cc6b80b6 353 regexFieldReference: 'value'
50fa6520 354 }
3a9b95a7
DC
355 ]
356 },
357 3003: {
573a6e8b 358 onlineHelp: 'pmg_mailfilter_what',
ea4f2a79 359 iconCls: 'fa fa-file-image-o',
3a9b95a7
DC
360 xtype: 'proxmoxWindowEdit',
361 subdir: 'contenttype',
362 width: 400,
3fb5067f 363 subject: gettext('Content Type Filter'),
3a9b95a7
DC
364 items: [
365 {
366 xtype: 'combobox',
367 displayField: 'text',
368 labelWidth: 150,
369 valueField: 'mimetype',
370 name: 'contenttype',
371 editable: true,
372 queryMode: 'local',
373 store: {
374 autoLoad: true,
375 proxy: {
376 type: 'proxmox',
377 url: '/api2/json/config/mimetypes'
cc6b80b6 378 }
3a9b95a7
DC
379 },
380 fieldLabel: gettext('Content Type'),
381 anyMatch: true,
382 matchFieldWidth: false,
383 listeners: {
384 change: function(cb, value) {
385 var me = this;
386 me.up().down('displayfield').setValue(value);
387 }
388 }
389 },
390 {
391 xtype: 'displayfield',
392 fieldLabel: gettext('Value'),
393 labelWidth: 150,
394 allowBlank: false,
3fb5067f 395 reset: Ext.emptyFn
cc6b80b6 396 }
3a9b95a7
DC
397 ]
398 },
6af39772 399 3004: {
573a6e8b 400 onlineHelp: 'pmg_mailfilter_regex',
ea4f2a79 401 iconCls: 'fa fa-file-o',
6af39772
DC
402 xtype: 'proxmoxWindowEdit',
403 subdir: 'filenamefilter',
404 width: 400,
405 subject: gettext('Match Filename'),
406 items: [
407 {
408 xtype: 'textfield',
409 name: 'filename',
410 reference: 'filename',
411 fieldLabel: gettext('Filename'),
412 labelWidth: 150,
413 allowBlank: false
414 },
415 {
416 labelWidth: 150,
417 fieldLabel: gettext('Test String'),
418 wholeMatch: true,
419 xtype: 'pmgRegexTester',
420 regexFieldReference: 'filename'
421 }
422 ]
423 },
e234e99d 424 3005: {
573a6e8b 425 onlineHelp: 'pmg_mailfilter_what',
ea4f2a79 426 iconCls: 'fa fa-file-archive-o',
e234e99d
DC
427 xtype: 'proxmoxWindowEdit',
428 subdir: 'archivefilter',
429 width: 400,
430 subject: gettext('Archive Filter'),
431 items: [
432 {
433 xtype: 'combobox',
434 displayField: 'text',
435 labelWidth: 150,
436 valueField: 'mimetype',
437 name: 'contenttype',
438 editable: true,
439 queryMode: 'local',
440 store: {
441 autoLoad: true,
442 proxy: {
443 type: 'proxmox',
444 url: '/api2/json/config/mimetypes'
cc6b80b6 445 }
e234e99d
DC
446 },
447 fieldLabel: gettext('Content Type'),
448 anyMatch: true,
449 matchFieldWidth: false,
450 listeners: {
451 change: function(cb, value) {
452 var me = this;
453 me.up().down('displayfield').setValue(value);
454 }
455 }
456 },
457 {
458 xtype: 'displayfield',
459 fieldLabel: gettext('Value'),
460 labelWidth: 150,
461 allowBlank: false,
462 reset: Ext.emptyFn
463 }
464 ]
465 },
628eccdb 466 4002: {
573a6e8b 467 onlineHelp: 'pmg_mailfilter_action',
628eccdb
DC
468 xtype: 'proxmoxWindowEdit',
469 subdir: 'notification',
470 subject: gettext('Notification'),
471 width: 400,
472 items: [
473 {
474 xtype: 'textfield',
475 name: 'name',
476 allowBlank: false,
477 fieldLabel: gettext('Name')
478 },
479 {
480 xtype: 'textareafield',
481 name: 'info',
482 fieldLabel: gettext("Description")
483 },
484 {
485 xtype: 'textfield',
486 name: 'to',
487 allowBlank: false,
488 value: '__ADMIN__',
489 fieldLabel: gettext('Receiver')
490 },
491 {
492 xtype: 'textfield',
493 name: 'subject',
494 allowBlank: false,
495 value: 'Notification: __SUBJECT__',
496 fieldLabel: gettext('Subject')
497 },
498 {
499 xtype: 'textarea',
500 name: 'body',
501 allowBlank: false,
502 grow: true,
503 growMax: 250,
504 value:
505 "Proxmox Notifcation:\n\n" +
506 "Sender: __SENDER__\n" +
507 "Receiver: __RECEIVERS__\n" +
508 "Targets: __TARGETS__\n\n" +
509 "Subject: __SUBJECT__\n\n" +
510 "Matching Rule: __RULE__\n\n" +
511 "__RULE_INFO__\n\n" +
512 "__VIRUS_INFO__\n" +
513 "__SPAM_INFO__\n",
514 fieldLabel: gettext('Body')
515 },
516 {
517 xtype: 'proxmoxcheckbox',
518 name: 'attach',
519 fieldLabel: gettext("Attach orig. Mail")
520 }
521 ]
522 },
523 4003: {
573a6e8b 524 onlineHelp: 'pmg_mailfilter_action',
628eccdb
DC
525 xtype: 'proxmoxWindowEdit',
526 subdir: 'field',
527 subject: gettext('Header Attribute'),
528 width: 400,
529 items: [
530 {
531 xtype: 'textfield',
532 name: 'name',
533 allowBlank: false,
534 fieldLabel: gettext('Name')
535 },
536 {
537 xtype: 'textareafield',
538 name: 'info',
539 fieldLabel: gettext("Description")
540 },
541 {
542 xtype: 'textfield',
543 name: 'field',
544 allowBlank: false,
545 fieldLabel: gettext('Field')
546 },
547 {
548 xtype: 'textfield',
549 reference: 'value',
550 name: 'value',
551 allowBlank: false,
552 fieldLabel: gettext('Value')
553 }
554 ]
555 },
f5de8682 556 4005: {
573a6e8b 557 onlineHelp: 'pmg_mailfilter_action',
5f3ec152 558 xtype: 'proxmoxWindowEdit',
f5de8682
DM
559 subdir: 'bcc',
560 subject: gettext('BCC'),
561 width: 400,
562 items: [
563 {
564 xtype: 'textfield',
565 name: 'name',
566 allowBlank: false,
567 fieldLabel: gettext('Name')
568 },
569 {
570 xtype: 'textareafield',
571 name: 'info',
572 fieldLabel: gettext("Description")
573 },
574 {
575 xtype: 'textfield',
576 name: 'target',
577 allowBlank: false,
578 fieldLabel: gettext("Target")
579 },
580 {
581 xtype: 'proxmoxcheckbox',
582 checked: true,
583 name: 'original',
584 fieldLabel: gettext("send orig. Mail")
585 }
586 ]
587
628eccdb
DC
588 },
589 4007: {
573a6e8b 590 onlineHelp: 'pmg_mailfilter_action',
628eccdb
DC
591 xtype: 'proxmoxWindowEdit',
592 subdir: 'removeattachments',
593 subject: gettext('Remove Attachments'),
594 width: 500,
595 fieldDefaults: {
596 labelWidth: 150
597 },
598 items: [
599 {
600 xtype: 'textfield',
601 name: 'name',
602 allowBlank: false,
603 fieldLabel: gettext('Name')
604 },
605 {
606 xtype: 'textareafield',
607 name: 'info',
608 fieldLabel: gettext("Description")
609 },
610 {
611 xtype: 'textareafield',
612 name: 'text',
613 grow: true,
614 growMax: 250,
615 fieldLabel: gettext("Text Replacement")
616 },
617 {
618 xtype: 'proxmoxcheckbox',
619 checked: true,
620 name: 'all',
621 fieldLabel: gettext("Remove all attachments")
622 }
623 ]
624 },
625 4009: {
573a6e8b 626 onlineHelp: 'pmg_mailfilter_action',
628eccdb
DC
627 xtype: 'proxmoxWindowEdit',
628 subdir: 'disclaimer',
629 subject: gettext('Disclaimer'),
630 width: 400,
631 items: [
632 {
633 xtype: 'textfield',
634 name: 'name',
635 allowBlank: false,
636 fieldLabel: gettext('Name')
637 },
638 {
639 xtype: 'textareafield',
640 name: 'info',
641 fieldLabel: gettext("Description")
642 },
643 {
644 xtype: 'textareafield',
645 name: 'disclaimer',
646 grow: true,
647 growMax: 250,
648 fieldLabel: gettext("Disclaimer")
649 }
650 ]
012f0f49
DM
651 }
652 },
ad834b6f 653
f1ab2a14
DC
654 updateLoginData: function(data) {
655 Proxmox.CSRFPreventionToken = data.CSRFPreventionToken;
656 Proxmox.UserName = data.username;
657 Ext.util.Cookies.set('PMGAuthCookie', data.ticket, null, '/', null, true );
658 },
659
258d48b5
DM
660 quarantineActionExtracted: false,
661
662 extractQuarantineAction: function() {
663
cc6b80b6 664 if (PMG.Utils.quarantineActionExtracted) { return; }
258d48b5
DM
665
666 PMG.Utils.quarantineActionExtracted = true;
667
668 var qs = Ext.Object.fromQueryString(location.search);
669
670 var cselect = qs.cselect;
671 var action = qs.action;
672 var ticket = qs.ticket;
a0a98b8d
DC
673 var dateString = qs.date;
674
675 if (dateString) {
676 var date = new Date(dateString).getTime()/1000;
677
678 // set from date for QuarantineList
679 /*jslint confusion: true*/
680 /*from is a string above and number here */
681 PMG.QuarantineList.from = date;
682 /*jslint confusion: false*/
683 }
258d48b5
DM
684
685 delete qs.cselect;
686 delete qs.action;
687 delete qs.ticket;
a0a98b8d 688 delete qs.date;
258d48b5
DM
689
690 var newsearch = Ext.Object.toQueryString(qs);
691
692 var newurl = location.protocol + "//" + location.host + location.pathname;
cc6b80b6 693 if (newsearch) { newurl += '?' + newsearch; }
258d48b5
DM
694 newurl += location.hash;
695
696 if (window.history) {
697 window.history.pushState({ path:newurl }, '', newurl);
698 }
699
207471c0 700 if (action || cselect) {
258d48b5
DM
701 return { action: action, cselect: cselect };
702 }
703 },
704
aac17b9b 705 doQuarantineAction: function(action, id, callback) {
74901b37
DC
706 var count = id.split(';').length;
707 var successMessage = "Action '{0}'";
708 if (count > 1) {
709 successMessage += " for '{1}' items";
710 }
711 successMessage += " successful";
712
713 /*jslint confusion: true*/
714 /*format is string and function*/
cf5268ca
DC
715 Proxmox.Utils.API2Request({
716 url: '/quarantine/content/',
aac17b9b
DM
717 params: {
718 action: action,
719 id: id
720 },
cf5268ca
DC
721 method: 'POST',
722 failure: function(response, opts) {
723 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
724 },
725 success: function(response, opts) {
2fa0b505
DC
726 var win = Ext.create('Ext.window.MessageBox',{
727 closeAction: 'destroy'
728 }).show({
cf5268ca 729 title: gettext('Info'),
74901b37 730 message: Ext.String.format(successMessage, action, count),
cf5268ca
DC
731 buttons: Ext.Msg.OK,
732 icon: Ext.MessageBox.INFO
733 });
734
735 if (Ext.isFunction(callback)) {
736 callback();
737 }
738 }
739 });
74901b37 740 /*jslint confusion: false*/
cf5268ca
DC
741 },
742
743 sender_renderer: function(value, metaData, rec) {
744 var subject = Ext.htmlEncode(value);
745 var from = Ext.htmlEncode(rec.data.from);
746 var sender = Ext.htmlEncode(rec.data.sender);
747 if (sender) {
de0ebd99
DC
748 /*jslint confusion: true*/
749 /*format is a string above*/
cf5268ca
DC
750 from = Ext.String.format(gettext("{0} on behalf of {1}"),
751 sender, from);
de0ebd99 752 /*jslint confusion: false*/
cf5268ca
DC
753 }
754 return '<small>' + from + '</small><br>' + subject;
755 },
756
fe81f069
DM
757 constructor: function() {
758 var me = this;
fe81f069 759
2c7b542d 760 // do whatever you want here
fe81f069
DM
761 }
762});