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