$PBExportHeader$w_newexeupload.srw forward global type w_newexeupload from w_publ_base end type type cb_ch from commandbutton within w_newexeupload end type type st_sc from statictext within w_newexeupload end type type ddlb_filesit from dropdownlistbox within w_newexeupload end type type gb_4 from groupbox within w_newexeupload end type type dw_filelist from datawindow within w_newexeupload end type type cb_retrieve from uo_imflatbutton within w_newexeupload end type type dw_upload_file from datawindow within w_newexeupload end type type cb_3 from uo_imflatbutton within w_newexeupload end type type cb_1 from uo_imflatbutton within w_newexeupload end type type cbx_1 from checkbox within w_newexeupload end type type cb_4 from uo_imflatbutton within w_newexeupload end type type cb_2 from uo_imflatbutton within w_newexeupload end type type st_update_msg from statictext within w_newexeupload end type end forward global type w_newexeupload from w_publ_base integer x = 23 integer y = 36 integer width = 4110 integer height = 2212 string title = "新程序上传" boolean maxbox = true boolean resizable = true windowtype windowtype = main! windowstate windowstate = maximized! long backcolor = 79216776 cb_ch cb_ch st_sc st_sc ddlb_filesit ddlb_filesit gb_4 gb_4 dw_filelist dw_filelist cb_retrieve cb_retrieve dw_upload_file dw_upload_file cb_3 cb_3 cb_1 cb_1 cbx_1 cbx_1 cb_4 cb_4 cb_2 cb_2 st_update_msg st_update_msg end type global w_newexeupload w_newexeupload type prototypes end prototypes type variables uo_atudexe uo_autoupdateexe end variables forward prototypes public function integer wf_check_filetype (string arg_filename) end prototypes public function integer wf_check_filetype (string arg_filename);Int rslt = 0 IF Trim(Lower(arg_filename)) = 'longjoe_rev.exe' OR Trim(Lower(arg_filename)) = 'longjoe_update.exe' THEN RETURN 0 IF Trim(Right(Lower(arg_filename),4)) = '.exe' OR Trim(Right(Lower(arg_filename),4)) = '.bat' THEN rslt = 1 //elseif trim(right(lower(arg_filename),4)) = '.dll' then // rslt = 2 END IF RETURN rslt end function on w_newexeupload.create int iCurrent call super::create this.cb_ch=create cb_ch this.st_sc=create st_sc this.ddlb_filesit=create ddlb_filesit this.gb_4=create gb_4 this.dw_filelist=create dw_filelist this.cb_retrieve=create cb_retrieve this.dw_upload_file=create dw_upload_file this.cb_3=create cb_3 this.cb_1=create cb_1 this.cbx_1=create cbx_1 this.cb_4=create cb_4 this.cb_2=create cb_2 this.st_update_msg=create st_update_msg iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_ch this.Control[iCurrent+2]=this.st_sc this.Control[iCurrent+3]=this.ddlb_filesit this.Control[iCurrent+4]=this.gb_4 this.Control[iCurrent+5]=this.dw_filelist this.Control[iCurrent+6]=this.cb_retrieve this.Control[iCurrent+7]=this.dw_upload_file this.Control[iCurrent+8]=this.cb_3 this.Control[iCurrent+9]=this.cb_1 this.Control[iCurrent+10]=this.cbx_1 this.Control[iCurrent+11]=this.cb_4 this.Control[iCurrent+12]=this.cb_2 this.Control[iCurrent+13]=this.st_update_msg end on on w_newexeupload.destroy call super::destroy destroy(this.cb_ch) destroy(this.st_sc) destroy(this.ddlb_filesit) destroy(this.gb_4) destroy(this.dw_filelist) destroy(this.cb_retrieve) destroy(this.dw_upload_file) destroy(this.cb_3) destroy(this.cb_1) destroy(this.cbx_1) destroy(this.cb_4) destroy(this.cb_2) destroy(this.st_update_msg) end on event open;call super::open;string arg_msg uo_autoupdateexe=create uo_atudexe uo_autoupdateexe.f_trycreate_sys_autoudexe(sqlca,arg_msg) dw_filelist.SetTransObject (sqlca) cb_retrieve.triggerevent(clicked!) end event event resize;dw_filelist.width=this.width - dw_filelist.x - 40 dw_filelist.height=this.height - dw_filelist.y - 110 end event type cb_func from w_publ_base`cb_func within w_newexeupload boolean visible = false integer x = 2299 integer y = 52 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_newexeupload integer x = 3433 integer y = 56 integer width = 288 end type type cb_ch from commandbutton within w_newexeupload integer x = 955 integer y = 52 integer width = 114 integer height = 96 integer taborder = 120 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "..." end type event clicked;Integer i String Pathname Long ll_i String Filename[],ls_filename Long ll_row i = GetFileSaveName("选择程序文件",Pathname,Filename[],"*","程序文件,*.*") IF i = 1 AND Trim(Pathname) <> '' THEN //AND Trim(Filename) <> "" THEN dw_upload_file.Reset() IF UpperBound(Filename) = 1 THEN ls_filename = Pathname ll_row = dw_upload_file.InsertRow(0) dw_upload_file.Object.Filename[ll_row] = ls_filename IF wf_check_filetype(ls_filename) = 1 THEN dw_upload_file.Object.ifrun[ll_row] = 1 ELSEIF wf_check_filetype(ls_filename) = 2 THEN dw_upload_file.Object.ifreg[ll_row] = 1 END IF ELSEIF UpperBound(Filename) > 1 THEN FOR ll_i = 1 TO UpperBound(Filename) ls_filename = Pathname + '\'+Filename[ll_i] ll_row = dw_upload_file.InsertRow(0) dw_upload_file.Object.Filename[ll_row] = ls_filename IF wf_check_filetype(Filename[ll_i]) = 1 THEN dw_upload_file.Object.ifrun[ll_row] = 1 ELSEIF wf_check_filetype(Filename[ll_i]) = 2 THEN dw_upload_file.Object.ifreg[ll_row] = 1 END IF NEXT END IF END IF end event type st_sc from statictext within w_newexeupload integer x = 165 integer y = 80 integer width = 261 integer height = 64 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "存放位置:" alignment alignment = right! boolean focusrectangle = false end type type ddlb_filesit from dropdownlistbox within w_newexeupload integer x = 434 integer y = 68 integer width = 498 integer height = 332 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "[默认]" boolean vscrollbar = true string item[] = {"[默认]","[windows]","[windows\system]"} borderstyle borderstyle = stylelowered! end type type gb_4 from groupbox within w_newexeupload integer y = 12 integer width = 3799 integer height = 828 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "更新程序文件上传" end type type dw_filelist from datawindow within w_newexeupload integer y = 844 integer width = 3799 integer height = 1252 integer taborder = 30 boolean bringtotop = true string dataobject = "dw_newexe_list" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;IF not( dw_edit_mode or row <=0 ) THEN this.setrow(row) end event event rowfocuschanged;IF dw_edit_mode THEN RETURN IF currentrow <=0 THEN RETURN this.selectrow(0,false) this.selectrow(currentrow,true) end event type cb_retrieve from uo_imflatbutton within w_newexeupload integer x = 1403 integer y = 52 integer width = 288 integer height = 96 integer taborder = 90 boolean bringtotop = true string text = "刷新" end type event clicked;call super::clicked;dw_filelist.retrieve() end event type dw_upload_file from datawindow within w_newexeupload integer x = 23 integer y = 164 integer width = 2999 integer height = 660 integer taborder = 130 boolean bringtotop = true string title = "none" string dataobject = "dw_upload_file" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type cb_3 from uo_imflatbutton within w_newexeupload integer x = 1083 integer y = 52 integer width = 288 integer height = 96 integer taborder = 90 boolean bringtotop = true string text = "上传" end type event clicked;call super::clicked;IF MessageBox("询问",'是否确定要上传文件到数据库? ', Exclamation!, OKCancel!, 2) = 2 THEN RETURN UPDATE sys_msg Set allow_update = 0 ; IF sqlca.SQLCode <> 0 THEN ROLLBACK; ELSE COMMIT; st_update_msg.Text = '允许用户更新:关' END IF String arg_msg,dtt_filename,ls_msg Long rslt,ls_i,li_FileNum Int needreg,needrun String Filename,dscrp dw_upload_file.AcceptText() open(w_sys_wait_jdt) //初始化进度条 w_sys_wait_jdt.show() w_sys_wait_jdt.wf_accepttol(dw_upload_file.RowCount()) w_sys_wait_jdt.wf_inc(0) w_sys_wait_jdt.st_msg.text="正在上传更新程序文件列表..." FOR ls_i = 1 TO dw_upload_file.RowCount() Filename = Lower(Trim(dw_upload_file.Object.Filename[ls_i])) w_sys_wait_jdt.st_msg.text="正在上传:"+Filename+"..." w_sys_wait_jdt.wf_inc(ls_i) needreg = dw_upload_file.Object.ifreg[ls_i] needrun = dw_upload_file.Object.ifrun[ls_i] dscrp = Trim(dw_upload_file.Object.dscrp[ls_i]) rslt = uo_autoupdateexe.f_uploadexe(sqlca,Filename,& Trim(ddlb_filesit.Text),needreg,needrun,dscrp,arg_msg) IF rslt = 0 THEN ls_msg = ls_msg + '上传操作失败> '+ dw_upload_file.Object.Filename[ls_i] + '~r~n原因:' + arg_msg + '~r~n' ELSE ls_msg = ls_msg + '上传操作成功! '+ dw_upload_file.Object.Filename[ls_i] + '~r~n' END IF NEXT close(w_sys_wait_jdt) OpenWithParm(w_message_err,ls_msg) dw_upload_file.Reset() cb_retrieve.TriggerEvent(Clicked!) messagebox('系统提示','为保证系统升级的严谨性,避免新旧程序共存而导致数据错误,允许用户更新标记已关掉,请执行强制断开用户连接来重新开启标记') RETURN end event type cb_1 from uo_imflatbutton within w_newexeupload integer x = 2043 integer y = 52 integer width = 288 integer height = 96 integer taborder = 90 boolean bringtotop = true string text = "删除" end type event clicked;call super::clicked;IF MessageBox("询问",'是否确定要删除选择的文件? ', Exclamation!, OKCancel!, 2) = 2 THEN RETURN String arg_msg,ls_msg Long rslt String Filename Long i,del_cnt FOR i = 1 TO dw_filelist.RowCount() IF dw_filelist.Object.ifdel[i] = 1 THEN del_cnt++ END IF NEXT IF del_cnt = 0 THEN MessageBox('提示','没有删除的目标记录!', Information!, OK! ) RETURN END IF FOR i = 1 TO dw_filelist.RowCount() IF dw_filelist.Object.ifdel[i] = 1 THEN Filename = dw_filelist.Object.Filename[i] rslt = uo_autoupdateexe.f_del_uploadexe(sqlca,Filename,arg_msg) IF rslt = 0 THEN ls_msg = ls_msg + '删除文件失败> '+ Filename + '~r~n' ELSE ls_msg = ls_msg + '删除文件成功! '+ Filename + '~r~n' END IF END IF NEXT cb_retrieve.TriggerEvent(Clicked!) OpenWithParm(w_message_err,ls_msg) end event type cbx_1 from checkbox within w_newexeupload integer x = 2373 integer y = 48 integer width = 325 integer height = 92 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "全选" boolean checked = true end type event clicked;int li_checked long ll_i if this.checked then li_checked = 1 else li_checked = 0 end if for ll_i = 1 to dw_filelist.rowcount() dw_filelist.object.ifdel[ll_i] = li_checked next end event type cb_4 from uo_imflatbutton within w_newexeupload integer x = 1723 integer y = 52 integer width = 288 integer height = 96 integer taborder = 60 boolean bringtotop = true boolean enabled = false string text = "恢复" end type event clicked;call super::clicked;IF NOT IsValid(w_updown) THEN open(w_updown) end event type cb_2 from uo_imflatbutton within w_newexeupload integer x = 2583 integer y = 52 integer width = 800 integer height = 96 integer taborder = 100 boolean bringtotop = true string text = "强制断开用户连接" end type event clicked;call super::clicked;open(w_kickout_input) end event type st_update_msg from statictext within w_newexeupload integer x = 3049 integer y = 176 integer width = 681 integer height = 108 boolean bringtotop = true integer textsize = -10 integer weight = 700 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217857 long backcolor = 67108864 string text = "允许用户更新:关" boolean focusrectangle = false end type event constructor;Int li_allow_update SELECT allow_update INTO :li_allow_update From sys_msg; IF sqlca.SQLCode <> 0 THEN li_allow_update = 0 END IF IF li_allow_update = 0 THEN This.Text = '允许用户更新:关' ELSE This.Text = '允许用户更新:开' END IF end event