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