w_newexeupload.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. $PBExportHeader$w_newexeupload.srw
  2. forward
  3. global type w_newexeupload from w_publ_base
  4. end type
  5. type cb_ch from commandbutton within w_newexeupload
  6. end type
  7. type st_sc from statictext within w_newexeupload
  8. end type
  9. type ddlb_filesit from dropdownlistbox within w_newexeupload
  10. end type
  11. type gb_4 from groupbox within w_newexeupload
  12. end type
  13. type dw_filelist from datawindow within w_newexeupload
  14. end type
  15. type cb_retrieve from uo_imflatbutton within w_newexeupload
  16. end type
  17. type dw_upload_file from datawindow within w_newexeupload
  18. end type
  19. type cb_3 from uo_imflatbutton within w_newexeupload
  20. end type
  21. type cb_1 from uo_imflatbutton within w_newexeupload
  22. end type
  23. type cbx_1 from checkbox within w_newexeupload
  24. end type
  25. type cb_4 from uo_imflatbutton within w_newexeupload
  26. end type
  27. type cb_2 from uo_imflatbutton within w_newexeupload
  28. end type
  29. type st_update_msg from statictext within w_newexeupload
  30. end type
  31. end forward
  32. global type w_newexeupload from w_publ_base
  33. integer x = 23
  34. integer y = 36
  35. integer width = 4110
  36. integer height = 2212
  37. string title = "新程序上传"
  38. boolean maxbox = true
  39. boolean resizable = true
  40. windowtype windowtype = main!
  41. windowstate windowstate = maximized!
  42. long backcolor = 79216776
  43. cb_ch cb_ch
  44. st_sc st_sc
  45. ddlb_filesit ddlb_filesit
  46. gb_4 gb_4
  47. dw_filelist dw_filelist
  48. cb_retrieve cb_retrieve
  49. dw_upload_file dw_upload_file
  50. cb_3 cb_3
  51. cb_1 cb_1
  52. cbx_1 cbx_1
  53. cb_4 cb_4
  54. cb_2 cb_2
  55. st_update_msg st_update_msg
  56. end type
  57. global w_newexeupload w_newexeupload
  58. type prototypes
  59. end prototypes
  60. type variables
  61. uo_atudexe uo_autoupdateexe
  62. end variables
  63. forward prototypes
  64. public function integer wf_check_filetype (string arg_filename)
  65. end prototypes
  66. public function integer wf_check_filetype (string arg_filename);Int rslt = 0
  67. IF Trim(Lower(arg_filename)) = 'longjoe_rev.exe' OR Trim(Lower(arg_filename)) = 'longjoe_update.exe' THEN RETURN 0
  68. IF Trim(Right(Lower(arg_filename),4)) = '.exe' OR Trim(Right(Lower(arg_filename),4)) = '.bat' THEN
  69. rslt = 1
  70. //elseif trim(right(lower(arg_filename),4)) = '.dll' then
  71. // rslt = 2
  72. END IF
  73. RETURN rslt
  74. end function
  75. on w_newexeupload.create
  76. int iCurrent
  77. call super::create
  78. this.cb_ch=create cb_ch
  79. this.st_sc=create st_sc
  80. this.ddlb_filesit=create ddlb_filesit
  81. this.gb_4=create gb_4
  82. this.dw_filelist=create dw_filelist
  83. this.cb_retrieve=create cb_retrieve
  84. this.dw_upload_file=create dw_upload_file
  85. this.cb_3=create cb_3
  86. this.cb_1=create cb_1
  87. this.cbx_1=create cbx_1
  88. this.cb_4=create cb_4
  89. this.cb_2=create cb_2
  90. this.st_update_msg=create st_update_msg
  91. iCurrent=UpperBound(this.Control)
  92. this.Control[iCurrent+1]=this.cb_ch
  93. this.Control[iCurrent+2]=this.st_sc
  94. this.Control[iCurrent+3]=this.ddlb_filesit
  95. this.Control[iCurrent+4]=this.gb_4
  96. this.Control[iCurrent+5]=this.dw_filelist
  97. this.Control[iCurrent+6]=this.cb_retrieve
  98. this.Control[iCurrent+7]=this.dw_upload_file
  99. this.Control[iCurrent+8]=this.cb_3
  100. this.Control[iCurrent+9]=this.cb_1
  101. this.Control[iCurrent+10]=this.cbx_1
  102. this.Control[iCurrent+11]=this.cb_4
  103. this.Control[iCurrent+12]=this.cb_2
  104. this.Control[iCurrent+13]=this.st_update_msg
  105. end on
  106. on w_newexeupload.destroy
  107. call super::destroy
  108. destroy(this.cb_ch)
  109. destroy(this.st_sc)
  110. destroy(this.ddlb_filesit)
  111. destroy(this.gb_4)
  112. destroy(this.dw_filelist)
  113. destroy(this.cb_retrieve)
  114. destroy(this.dw_upload_file)
  115. destroy(this.cb_3)
  116. destroy(this.cb_1)
  117. destroy(this.cbx_1)
  118. destroy(this.cb_4)
  119. destroy(this.cb_2)
  120. destroy(this.st_update_msg)
  121. end on
  122. event open;call super::open;string arg_msg
  123. uo_autoupdateexe=create uo_atudexe
  124. uo_autoupdateexe.f_trycreate_sys_autoudexe(sqlca,arg_msg)
  125. dw_filelist.SetTransObject (sqlca)
  126. cb_retrieve.triggerevent(clicked!)
  127. end event
  128. event resize;dw_filelist.width=this.width - dw_filelist.x - 40
  129. dw_filelist.height=this.height - dw_filelist.y - 110
  130. end event
  131. type cb_func from w_publ_base`cb_func within w_newexeupload
  132. boolean visible = false
  133. integer x = 2299
  134. integer y = 52
  135. boolean enabled = false
  136. end type
  137. type cb_exit from w_publ_base`cb_exit within w_newexeupload
  138. integer x = 3433
  139. integer y = 56
  140. integer width = 288
  141. end type
  142. type cb_ch from commandbutton within w_newexeupload
  143. integer x = 955
  144. integer y = 52
  145. integer width = 114
  146. integer height = 96
  147. integer taborder = 120
  148. integer textsize = -9
  149. integer weight = 400
  150. fontcharset fontcharset = gb2312charset!
  151. fontpitch fontpitch = variable!
  152. string facename = "宋体"
  153. string text = "..."
  154. end type
  155. event clicked;Integer i
  156. String Pathname
  157. Long ll_i
  158. String Filename[],ls_filename
  159. Long ll_row
  160. i = GetFileSaveName("选择程序文件",Pathname,Filename[],"*","程序文件,*.*")
  161. IF i = 1 AND Trim(Pathname) <> '' THEN //AND Trim(Filename) <> "" THEN
  162. dw_upload_file.Reset()
  163. IF UpperBound(Filename) = 1 THEN
  164. ls_filename = Pathname
  165. ll_row = dw_upload_file.InsertRow(0)
  166. dw_upload_file.Object.Filename[ll_row] = ls_filename
  167. IF wf_check_filetype(ls_filename) = 1 THEN
  168. dw_upload_file.Object.ifrun[ll_row] = 1
  169. ELSEIF wf_check_filetype(ls_filename) = 2 THEN
  170. dw_upload_file.Object.ifreg[ll_row] = 1
  171. END IF
  172. ELSEIF UpperBound(Filename) > 1 THEN
  173. FOR ll_i = 1 TO UpperBound(Filename)
  174. ls_filename = Pathname + '\'+Filename[ll_i]
  175. ll_row = dw_upload_file.InsertRow(0)
  176. dw_upload_file.Object.Filename[ll_row] = ls_filename
  177. IF wf_check_filetype(Filename[ll_i]) = 1 THEN
  178. dw_upload_file.Object.ifrun[ll_row] = 1
  179. ELSEIF wf_check_filetype(Filename[ll_i]) = 2 THEN
  180. dw_upload_file.Object.ifreg[ll_row] = 1
  181. END IF
  182. NEXT
  183. END IF
  184. END IF
  185. end event
  186. type st_sc from statictext within w_newexeupload
  187. integer x = 165
  188. integer y = 80
  189. integer width = 261
  190. integer height = 64
  191. integer textsize = -9
  192. integer weight = 400
  193. fontcharset fontcharset = gb2312charset!
  194. fontpitch fontpitch = variable!
  195. string facename = "宋体"
  196. long textcolor = 33554432
  197. long backcolor = 67108864
  198. boolean enabled = false
  199. string text = "存放位置:"
  200. alignment alignment = right!
  201. boolean focusrectangle = false
  202. end type
  203. type ddlb_filesit from dropdownlistbox within w_newexeupload
  204. integer x = 434
  205. integer y = 68
  206. integer width = 498
  207. integer height = 332
  208. integer taborder = 40
  209. boolean bringtotop = true
  210. integer textsize = -9
  211. integer weight = 400
  212. fontcharset fontcharset = gb2312charset!
  213. fontpitch fontpitch = variable!
  214. string facename = "宋体"
  215. long textcolor = 33554432
  216. string text = "[默认]"
  217. boolean vscrollbar = true
  218. string item[] = {"[默认]","[windows]","[windows\system]"}
  219. borderstyle borderstyle = stylelowered!
  220. end type
  221. type gb_4 from groupbox within w_newexeupload
  222. integer y = 12
  223. integer width = 3799
  224. integer height = 828
  225. integer taborder = 20
  226. integer textsize = -9
  227. integer weight = 400
  228. fontcharset fontcharset = gb2312charset!
  229. fontpitch fontpitch = variable!
  230. string facename = "宋体"
  231. long textcolor = 33554432
  232. long backcolor = 67108864
  233. string text = "更新程序文件上传"
  234. end type
  235. type dw_filelist from datawindow within w_newexeupload
  236. integer y = 844
  237. integer width = 3799
  238. integer height = 1252
  239. integer taborder = 30
  240. boolean bringtotop = true
  241. string dataobject = "dw_newexe_list"
  242. boolean hscrollbar = true
  243. boolean vscrollbar = true
  244. boolean hsplitscroll = true
  245. boolean livescroll = true
  246. borderstyle borderstyle = stylelowered!
  247. end type
  248. event clicked;IF not( dw_edit_mode or row <=0 ) THEN this.setrow(row)
  249. end event
  250. event rowfocuschanged;IF dw_edit_mode THEN RETURN
  251. IF currentrow <=0 THEN RETURN
  252. this.selectrow(0,false)
  253. this.selectrow(currentrow,true)
  254. end event
  255. type cb_retrieve from uo_imflatbutton within w_newexeupload
  256. integer x = 1403
  257. integer y = 52
  258. integer width = 288
  259. integer height = 96
  260. integer taborder = 90
  261. boolean bringtotop = true
  262. string text = "刷新"
  263. end type
  264. event clicked;call super::clicked;dw_filelist.retrieve()
  265. end event
  266. type dw_upload_file from datawindow within w_newexeupload
  267. integer x = 23
  268. integer y = 164
  269. integer width = 2999
  270. integer height = 660
  271. integer taborder = 130
  272. boolean bringtotop = true
  273. string title = "none"
  274. string dataobject = "dw_upload_file"
  275. boolean hscrollbar = true
  276. boolean vscrollbar = true
  277. boolean livescroll = true
  278. borderstyle borderstyle = stylelowered!
  279. end type
  280. type cb_3 from uo_imflatbutton within w_newexeupload
  281. integer x = 1083
  282. integer y = 52
  283. integer width = 288
  284. integer height = 96
  285. integer taborder = 90
  286. boolean bringtotop = true
  287. string text = "上传"
  288. end type
  289. event clicked;call super::clicked;IF MessageBox("询问",'是否确定要上传文件到数据库? ', Exclamation!, OKCancel!, 2) = 2 THEN RETURN
  290. UPDATE sys_msg
  291. Set allow_update = 0 ;
  292. IF sqlca.SQLCode <> 0 THEN
  293. ROLLBACK;
  294. ELSE
  295. COMMIT;
  296. st_update_msg.Text = '允许用户更新:关'
  297. END IF
  298. String arg_msg,dtt_filename,ls_msg
  299. Long rslt,ls_i,li_FileNum
  300. Int needreg,needrun
  301. String Filename,dscrp
  302. dw_upload_file.AcceptText()
  303. open(w_sys_wait_jdt) //初始化进度条
  304. w_sys_wait_jdt.show()
  305. w_sys_wait_jdt.wf_accepttol(dw_upload_file.RowCount())
  306. w_sys_wait_jdt.wf_inc(0)
  307. w_sys_wait_jdt.st_msg.text="正在上传更新程序文件列表..."
  308. FOR ls_i = 1 TO dw_upload_file.RowCount()
  309. Filename = Lower(Trim(dw_upload_file.Object.Filename[ls_i]))
  310. w_sys_wait_jdt.st_msg.text="正在上传:"+Filename+"..."
  311. w_sys_wait_jdt.wf_inc(ls_i)
  312. needreg = dw_upload_file.Object.ifreg[ls_i]
  313. needrun = dw_upload_file.Object.ifrun[ls_i]
  314. dscrp = Trim(dw_upload_file.Object.dscrp[ls_i])
  315. rslt = uo_autoupdateexe.f_uploadexe(sqlca,Filename,&
  316. Trim(ddlb_filesit.Text),needreg,needrun,dscrp,arg_msg)
  317. IF rslt = 0 THEN
  318. ls_msg = ls_msg + '上传操作失败> '+ dw_upload_file.Object.Filename[ls_i] + '~r~n原因:' + arg_msg + '~r~n'
  319. ELSE
  320. ls_msg = ls_msg + '上传操作成功! '+ dw_upload_file.Object.Filename[ls_i] + '~r~n'
  321. END IF
  322. NEXT
  323. close(w_sys_wait_jdt)
  324. OpenWithParm(w_message_err,ls_msg)
  325. dw_upload_file.Reset()
  326. cb_retrieve.TriggerEvent(Clicked!)
  327. messagebox('系统提示','为保证系统升级的严谨性,避免新旧程序共存而导致数据错误,允许用户更新标记已关掉,请执行强制断开用户连接来重新开启标记')
  328. RETURN
  329. end event
  330. type cb_1 from uo_imflatbutton within w_newexeupload
  331. integer x = 2043
  332. integer y = 52
  333. integer width = 288
  334. integer height = 96
  335. integer taborder = 90
  336. boolean bringtotop = true
  337. string text = "删除"
  338. end type
  339. event clicked;call super::clicked;IF MessageBox("询问",'是否确定要删除选择的文件? ', Exclamation!, OKCancel!, 2) = 2 THEN RETURN
  340. String arg_msg,ls_msg
  341. Long rslt
  342. String Filename
  343. Long i,del_cnt
  344. FOR i = 1 TO dw_filelist.RowCount()
  345. IF dw_filelist.Object.ifdel[i] = 1 THEN
  346. del_cnt++
  347. END IF
  348. NEXT
  349. IF del_cnt = 0 THEN
  350. MessageBox('提示','没有删除的目标记录!', Information!, OK! )
  351. RETURN
  352. END IF
  353. FOR i = 1 TO dw_filelist.RowCount()
  354. IF dw_filelist.Object.ifdel[i] = 1 THEN
  355. Filename = dw_filelist.Object.Filename[i]
  356. rslt = uo_autoupdateexe.f_del_uploadexe(sqlca,Filename,arg_msg)
  357. IF rslt = 0 THEN
  358. ls_msg = ls_msg + '删除文件失败> '+ Filename + '~r~n'
  359. ELSE
  360. ls_msg = ls_msg + '删除文件成功! '+ Filename + '~r~n'
  361. END IF
  362. END IF
  363. NEXT
  364. cb_retrieve.TriggerEvent(Clicked!)
  365. OpenWithParm(w_message_err,ls_msg)
  366. end event
  367. type cbx_1 from checkbox within w_newexeupload
  368. integer x = 2373
  369. integer y = 48
  370. integer width = 325
  371. integer height = 92
  372. boolean bringtotop = true
  373. integer textsize = -9
  374. integer weight = 400
  375. fontcharset fontcharset = gb2312charset!
  376. fontpitch fontpitch = variable!
  377. string facename = "宋体"
  378. long textcolor = 33554432
  379. long backcolor = 67108864
  380. string text = "全选"
  381. boolean checked = true
  382. end type
  383. event clicked;int li_checked
  384. long ll_i
  385. if this.checked then
  386. li_checked = 1
  387. else
  388. li_checked = 0
  389. end if
  390. for ll_i = 1 to dw_filelist.rowcount()
  391. dw_filelist.object.ifdel[ll_i] = li_checked
  392. next
  393. end event
  394. type cb_4 from uo_imflatbutton within w_newexeupload
  395. integer x = 1723
  396. integer y = 52
  397. integer width = 288
  398. integer height = 96
  399. integer taborder = 60
  400. boolean bringtotop = true
  401. boolean enabled = false
  402. string text = "恢复"
  403. end type
  404. event clicked;call super::clicked;IF NOT IsValid(w_updown) THEN open(w_updown)
  405. end event
  406. type cb_2 from uo_imflatbutton within w_newexeupload
  407. integer x = 2583
  408. integer y = 52
  409. integer width = 800
  410. integer height = 96
  411. integer taborder = 100
  412. boolean bringtotop = true
  413. string text = "强制断开用户连接"
  414. end type
  415. event clicked;call super::clicked;open(w_kickout_input)
  416. end event
  417. type st_update_msg from statictext within w_newexeupload
  418. integer x = 3049
  419. integer y = 176
  420. integer width = 681
  421. integer height = 108
  422. boolean bringtotop = true
  423. integer textsize = -10
  424. integer weight = 700
  425. fontcharset fontcharset = gb2312charset!
  426. fontpitch fontpitch = variable!
  427. string facename = "宋体"
  428. long textcolor = 134217857
  429. long backcolor = 67108864
  430. string text = "允许用户更新:关"
  431. boolean focusrectangle = false
  432. end type
  433. event constructor;Int li_allow_update
  434. SELECT allow_update
  435. INTO :li_allow_update
  436. From sys_msg;
  437. IF sqlca.SQLCode <> 0 THEN
  438. li_allow_update = 0
  439. END IF
  440. IF li_allow_update = 0 THEN
  441. This.Text = '允许用户更新:关'
  442. ELSE
  443. This.Text = '允许用户更新:开'
  444. END IF
  445. end event