]>
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', | |
17 | align: 'stretch' | |
18 | }, | |
19 | ||
20 | controller: { | |
21 | ||
22 | xclass: 'Ext.app.ViewController', | |
23 | ||
24 | init: function(view) { | |
25 | ||
26 | var panel = view.lookupReference('contentPanel'); | |
27 | var fromField = | |
28 | Proxmox.Utils.API2Request({ | |
29 | url: view.url, | |
30 | waitMsgTarget: view, | |
31 | method: 'GET', | |
32 | waitMsgTarget: view, | |
33 | success: function(response, opts) { | |
34 | var data = response.result.data; | |
35 | var from = data.match(/^FROM:\s*(.*\S)\s*$/mi); | |
36 | if (from) view.lookupReference('fromField').setValue(from[1]); | |
37 | var to = data.match(/^TO:\s*(.*\S)\s*$/mi); | |
38 | if (to) view.lookupReference('toField').setValue(to[1]); | |
39 | var subject = data.match(/^SUBJECT:\s*(.*\S)\s*$/mi); | |
40 | if (subject) view.lookupReference('subjectField').setValue(subject[1]); | |
41 | panel.update(Ext.String.htmlEncode(data)); | |
42 | }, | |
43 | failure: function (response, opts) { | |
44 | view.destroy(); | |
45 | Ext.Msg.alert(gettext('Error'), response.htmlStatus); | |
46 | } | |
47 | }); | |
48 | ||
49 | } | |
50 | }, | |
51 | ||
52 | items: [ | |
53 | { | |
54 | xtype: 'textfield', | |
55 | fieldLabel: gettext('From'), | |
56 | reference: 'fromField', | |
57 | focusable: false, | |
58 | exitable: false | |
59 | }, | |
60 | { | |
61 | xtype: 'textfield', | |
62 | fieldLabel: gettext('To'), | |
63 | reference: 'toField', | |
64 | focusable: false, | |
65 | exitable: false | |
66 | }, | |
67 | { | |
68 | xtype: 'textfield', | |
69 | fieldLabel: gettext('Subject'), | |
70 | reference: 'subjectField', | |
71 | focusable: false, | |
72 | exitable: false | |
73 | }, | |
74 | { | |
75 | xtype: 'displayfield', | |
76 | fieldLabel: gettext('Header') | |
77 | }, | |
78 | { | |
79 | xtype: 'panel', | |
80 | bodyPadding: 5, | |
81 | reference: 'contentPanel', | |
82 | flex: 1, | |
83 | autoScroll: true, | |
84 | bodyStyle: 'white-space:pre' | |
85 | } | |
86 | ] | |
87 | }); |