]>
Commit | Line | Data |
---|---|---|
cd3d4213 DM |
1 | Ext.define('PMG.ViewMailHeaders', { |
2 | extend: 'Ext.window.Window', | |
3 | alias: 'widget.pmgViewMailHeaders', | |
4 | ||
5 | url: undefined, | |
6 | ||
7 | width: 600, | |
8 | ||
9 | height: 400, | |
10 | ||
11 | bodyPadding: 10, | |
12 | ||
13 | modal: true, | |
14 | ||
15 | layout: { | |
16 | type: 'vbox', | |
c87d46fb | 17 | align: 'stretch', |
cd3d4213 DM |
18 | }, |
19 | ||
20 | controller: { | |
21 | ||
22 | xclass: 'Ext.app.ViewController', | |
23 | ||
24 | init: function(view) { | |
cd3d4213 | 25 | var panel = view.lookupReference('contentPanel'); |
cd3d4213 DM |
26 | Proxmox.Utils.API2Request({ |
27 | url: view.url, | |
28 | waitMsgTarget: view, | |
29 | method: 'GET', | |
cd3d4213 DM |
30 | success: function(response, opts) { |
31 | var data = response.result.data; | |
32 | var from = data.match(/^FROM:\s*(.*\S)\s*$/mi); | |
c17f9fe4 DC |
33 | if (from) { |
34 | view.lookupReference('fromField').setValue(from[1]); | |
35 | } | |
cd3d4213 | 36 | var to = data.match(/^TO:\s*(.*\S)\s*$/mi); |
c17f9fe4 DC |
37 | if (to) { |
38 | view.lookupReference('toField').setValue(to[1]); | |
39 | } | |
cd3d4213 | 40 | var subject = data.match(/^SUBJECT:\s*(.*\S)\s*$/mi); |
c17f9fe4 DC |
41 | if (subject) { |
42 | view.lookupReference('subjectField').setValue(subject[1]); | |
43 | } | |
cd3d4213 DM |
44 | panel.update(Ext.String.htmlEncode(data)); |
45 | }, | |
c87d46fb | 46 | failure: function(response, opts) { |
cd3d4213 DM |
47 | view.destroy(); |
48 | Ext.Msg.alert(gettext('Error'), response.htmlStatus); | |
c87d46fb | 49 | }, |
cd3d4213 | 50 | }); |
c87d46fb | 51 | }, |
cd3d4213 DM |
52 | }, |
53 | ||
54 | items: [ | |
55 | { | |
56 | xtype: 'textfield', | |
57 | fieldLabel: gettext('From'), | |
58 | reference: 'fromField', | |
59 | focusable: false, | |
c87d46fb | 60 | exitable: false, |
cd3d4213 DM |
61 | }, |
62 | { | |
63 | xtype: 'textfield', | |
64 | fieldLabel: gettext('To'), | |
65 | reference: 'toField', | |
66 | focusable: false, | |
c87d46fb | 67 | exitable: false, |
cd3d4213 DM |
68 | }, |
69 | { | |
70 | xtype: 'textfield', | |
71 | fieldLabel: gettext('Subject'), | |
72 | reference: 'subjectField', | |
73 | focusable: false, | |
c87d46fb | 74 | exitable: false, |
cd3d4213 DM |
75 | }, |
76 | { | |
77 | xtype: 'displayfield', | |
c87d46fb | 78 | fieldLabel: gettext('Header'), |
cd3d4213 DM |
79 | }, |
80 | { | |
81 | xtype: 'panel', | |
82 | bodyPadding: 5, | |
83 | reference: 'contentPanel', | |
84 | flex: 1, | |
85 | autoScroll: true, | |
c87d46fb TL |
86 | bodyStyle: 'white-space:pre', |
87 | }, | |
88 | ], | |
cd3d4213 | 89 | }); |