日期:2014-05-20 浏览次数:20627 次
createUploadWindow: function(config) {
var form1 = new Ext.FormPanel({
// id:'addFileBase-form',
baseCls: 'x-plain',
defaultType: 'textfield',
labelWidth :80,
fileUpload : true,
autoDestroy :true
});
var winTitle = '图片上传';
this.winHeight = 170;
this.winWidth = 400;
var btns = [];
form1.add(this.createResourceFileAddButtonFieldset(config));
form1.doLayout();
//
btns.push({
text: '上传',
listeners : {
'click': function(){
var fm = form1.getForm();
if(fm.isValid()) {
if(Ext.getCmp('upload').getValue() == ''){
Ext.Msg.alert('提示','请上传图片');
return;
}
var fileName = Ext.getCmp('upload').getValue();
fileName = fileName.substring(fileName.lastIndexOf('\\')+1,fileName.length);
if(!this.isChinese(fileName)){
alert('图片中不能包含中文');
return;
}
fm.submit({
url : UrlController.getUrl("addFile"),
method : 'POST',
type:'ajax',
scope:this,
success : function(fp, o) {
alert('成功');
win.close();
},
failure : function(fp,o) {
Ext.Msg.alert('Error',
'失败');
win.close();
}
})
}
},
scope:this
}
});
btns.push({
text: '取消',
handler: function(){
win.close();
}
});
var win = new Ext.Window(
Ext.applyIf(config||{}, {
minimizable : false,
maximizable : true,