winUpLoad.js
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Ext.define('App.view.winUpLoad', {
extend: 'Ext.window.Window',
alias: 'widget.winupload',
width: 450,
height: 185,
title: 'Загрузка на сервер',
modal : true,
closeAction: 'hide',
listeners:{
'beforehide':function(win){
// Ext.getCmp(win.animateTarget).hide();
}
},
items: [
Ext.create('Ext.form.Panel', {
width: 440,
bodyPadding: 20,
frame: true,
renderTo: Ext.getBody(),
items: [
{
xtype: 'fieldcontainer',
layout: 'hbox',
fieldDefaults: {
labelAlign: 'top'
},
items: [
{
flex: 4,
name: 'wintitle',
itemId: 'wintitle',
id: 'wintitle',
margins: '0 0 0 0',
html: ""
},
{
flex: 1,
xtype: 'hidden',
name: 'winid',
itemId: 'winid',
id:'winid',
html: "",
"visible": false,
},
]
},
{
xtype: 'filefield',
name: 'file',
fieldLabel: 'XML',
labelWidth: 30,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Выберите файл...'
}],
buttons: [{
text: 'Загрузить',
bodyPadding: 10,
handler: function () {
var form = this.up('form').getForm();
if(form.isValid()){
form.submit({
url: 'http://94.127.138.40/importer/upload.php',
method: 'POST',
params: { region: Ext.getCmp("winid").html },
enctype: 'multipart/form-data',
waitMsg: 'Загрузка файла...',
success: function (formPanel, action) {
// alert("Ok!");
},
failure: function (formPanel, action) {
// alert("Error!");
}
});
}
}
}]
})
]
});