日期:2014-05-16 浏览次数:20488 次
HM={}; HM.themis={}; HM.themis.FileUploadMgr={} HM.themis.FileUploadMgr = { fileUploadFormWin : undefined, // linkInfoFormWin : undefined, // reportFormWins : undefined, // fsa : undefined, showAttachmentsUrl: 'sysFile_getFileList.action', uploadUrl:'sysFile_uploadFile.action', downloadUrl:'sysFile_downFile.action', deleteUrl: 'sysFile_deleteByLogic.action', relationId:'id', fileNum:0, invalidTypeMsg : '不能下载还未上传的文件!', zipFileName :'打包下载文件', title:'title', warnMsgTitle : '警告', sort:'document', width : 520, height : 340, viewFlag:false, show : function(id) { Ext.ux.UploadDialog.EnableFileCount=this.fileNum; if(!this.permitted_extensions) { this.permitted_extensions = Ext.harmony.util.SystemConfig.allowFileTypes; } this.fileUploadFormWin = new Ext.ux.UploadDialog.Dialog({ autoCreate : true, closable : true, modal : true, collapsible : false, draggable : true, minWidth : 380, minHeight : 220, width : this.width, height : this.height, proxyDrag : true, permitted_extensions:this.permitted_extensions, viewFlag : this.viewFlag, zipFileName : this.zipFileName, resizable : true, post_var_name : 'file', constraintoviewport : true, title : this.title, deleteUrl : this.deleteUrl, url : this.uploadUrl, base_params: {relationId:this.relationId,sort:this.sort}, reset_on_hide : true, allow_close_on_upload : true }); this.fileUploadFormWin.show(); this.initData(this.relationId); }, // hide : function() { // this.fileUploadFormWin.hide(); // }, initData : function(infoId) { this.fileUploadFormWin.grid_panel .on("rowdblclick", this.download, this); Ext.Ajax.request({ url : this.showAttachmentsUrl, params : {relationId: infoId,sort:this.sort}, method : "POST", // form : this.form, // isUpload : true, success : this.onAjaxSuccess, failure : this.onAjaxFailure, scope : this }); }, onAjaxSuccess : function(response, options) { var json_response; try { var rt = response.responseText; var filter = rt.match(/^<[^>]+>((?:.|\n)*)<\/[^>]+>$/); if (filter) { rt = filter[1]; } json_response = Ext.util.JSON.decode(rt); } catch (e) { return; } var store = this.fileUploadFormWin.grid_panel.getStore(); var button_container = this.fileUploadFormWin.el.child(".x-btn-center"); button_container.position("relative"); var myinput_file = Ext.DomHelper.append(button_container, { tag : "input", type : "file", size : 1, name : 'files', style : "position: absolute; display: none; border: none; cursor: pointer" }, true); for (var i = 0; i < json_response.datas.length; i++) { store.add(new Ext.ux.UploadDialog.FileRecord({ state : Ext.ux.UploadDialog.FileRecord.STATE_FINISHED, filename : json_response.datas[i].fileName, note : "已上传", input_element : myinput_file, id : json_response.datas[i].id })); } this.fileUploadFormWin.changeAddStat(); this.fileUploadFormWin.changeDownZipStat(); }, download : function(gridObj, rowIndex, e ) { var selRecord = gridObj.getStore().getAt(rowIndex); var id = selRecord.get("id"); if (selRecord.get("state") == Ext.ux.U