w_plugins_edit.srw 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. $PBExportHeader$w_plugins_edit.srw
  2. forward
  3. global type w_plugins_edit from w_publ_edit_choice
  4. end type
  5. end forward
  6. global type w_plugins_edit from w_publ_edit_choice
  7. integer width = 3611
  8. integer height = 2180
  9. string title = "外挂程序编辑"
  10. boolean minbox = true
  11. windowtype windowtype = popup!
  12. event ue_addmx ( )
  13. event ue_add_file ( )
  14. event ue_run_file ( )
  15. end type
  16. global w_plugins_edit w_plugins_edit
  17. type variables
  18. int dw_uc_h
  19. int dw_uc_w
  20. end variables
  21. event ue_addmx();Long li_row, li_cur_row
  22. li_row = dw_uc.InsertRow (0)
  23. dw_uc.SelectRow(0,FALSE)
  24. dw_uc.ScrollToRow (li_row)
  25. dw_uc.SelectRow(li_row,TRUE)
  26. end event
  27. event ue_add_file();Int cur_row
  28. Integer i,j
  29. String Pathname
  30. String Filename[]
  31. Integer li_row
  32. cur_row = dw_uc.GetRow()
  33. IF cur_row <= 0 THEN
  34. MessageBox(publ_operator,'请先选择行!')
  35. RETURN
  36. END IF
  37. i = GetFileOpenName("Select File",Pathname,Filename[],"EXE","EXE Files (*.EXE),*.EXE,")
  38. IF i = 0 THEN RETURN
  39. dw_uc.AcceptText()
  40. dw_uc.SetRedraw(FALSE)
  41. IF i = 1 AND Trim(Pathname) <> "" THEN
  42. IF UpperBound(Filename) = 1 THEN
  43. dw_uc.Object.Filename[cur_row] = Filename[i]
  44. dw_uc.Object.filepath[cur_row] = Filename[i]
  45. ELSEIF UpperBound(Filename) > 1 THEN
  46. dw_uc.Object.Filename[cur_row] = Filename[i]
  47. dw_uc.Object.filepath[cur_row] = Filename[i]
  48. FOR j = 2 TO UpperBound(Filename)
  49. li_row = dw_uc.InsertRow (0)
  50. dw_uc.Object.Filename[li_row] = Filename[j]
  51. dw_uc.Object.filepath[li_row] = Filename[j]
  52. NEXT
  53. END IF
  54. END IF
  55. dw_uc.SetRedraw(TRUE)
  56. RETURN
  57. end event
  58. event ue_run_file();Int cur_row, ll_dftWinState
  59. cur_row = dw_uc.GetRow()
  60. IF cur_row <= 0 THEN
  61. MessageBox(publ_operator,'请先选择行!')
  62. RETURN
  63. END IF
  64. ll_dftWinState = dw_uc.Object.dftWinState[cur_row]
  65. WindowState lwstmp
  66. IF ll_dftWinState = -1 THEN
  67. lwstmp = Minimized!
  68. ELSEIF ll_dftWinState = 0 THEN
  69. lwstmp = Normal!
  70. ELSE
  71. lwstmp = Maximized!
  72. END IF
  73. String ls_run
  74. ls_run = dw_uc.Object.psw[cur_row] + '&'
  75. ls_run += publ_userid + '&'
  76. ls_run += sqlca.Database + '&'
  77. ls_run += sqlca.UserID + '&'
  78. ls_run += f_psw_bczh(sqlca.DBPass,0,sys_power_key) + '&'
  79. ls_run += sqlca.LogID + '&'
  80. ls_run += sqlca.LogPass + '&'
  81. ls_run += sqlca.ServerName + '&'
  82. IF Run(sys_cur_path + dw_uc.Object.filepath[cur_row] + ' - ' +ls_run) = -1 THEN
  83. MessageBox('错误','运行程序失败!',stopsign!,ok!)
  84. RETURN
  85. END IF
  86. RETURN
  87. end event
  88. on w_plugins_edit.create
  89. call super::create
  90. end on
  91. on w_plugins_edit.destroy
  92. call super::destroy
  93. end on
  94. event resize;call super::resize;long w_width,w_height
  95. w_width = 3630
  96. w_height = 2200
  97. if newwidth < w_width then this.width = w_width
  98. if newheight < w_height then this.height = w_height
  99. dw_uc.width=this.width - (w_width - dw_uc_w)
  100. dw_uc.height=this.height - (w_height - dw_uc_h)
  101. end event
  102. type cb_func from w_publ_edit_choice`cb_func within w_plugins_edit
  103. end type
  104. type cb_exit from w_publ_edit_choice`cb_exit within w_plugins_edit
  105. integer x = 837
  106. end type
  107. type cb_add from w_publ_edit_choice`cb_add within w_plugins_edit
  108. end type
  109. event cb_add::clicked;call super::clicked;Long ll_newid,i
  110. String errmsg
  111. IF dw_edit_mode THEN
  112. dw_uc.AcceptText()
  113. dw_uc.Object.Filename[dw_uc.GetRow()] = Trim(dw_uc.Object.Filename[dw_uc.GetRow()])
  114. IF dw_uc.Object.Filename[dw_uc.GetRow()] = '' THEN
  115. MessageBox(publ_operator,'请输入程序名称!')
  116. RETURN
  117. END IF
  118. IF dw_uc.Object.fileid[dw_uc.GetRow()] = 0 THEN
  119. ll_newid = f_sys_scidentity(0,"u_plugins","fileid",errmsg,FALSE,sqlca)
  120. IF ll_newid <= 0 THEN
  121. MessageBox(publ_operator,errmsg)
  122. RETURN
  123. ELSE
  124. dw_uc.Object.fileid[dw_uc.GetRow()] = ll_newid
  125. END IF
  126. END IF
  127. END IF
  128. IF dw_edit_mode THEN
  129. String ls_errmsg
  130. IF dw_uc.Update() = -1 THEN
  131. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  132. ls_errmsg = "关键内容重复"
  133. ELSE
  134. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  135. END IF
  136. ROLLBACK;
  137. MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!)
  138. LS_UPDATE_FLAG = FALSE
  139. RETURN
  140. ELSE
  141. COMMIT;
  142. FOR i = 1 TO 7
  143. dw_uc.SetTabOrder ( i, 0 )
  144. NEXT
  145. LS_UPDATE_FLAG = TRUE
  146. END IF
  147. ins_sqlerrtext = ""
  148. ELSE
  149. Long li_row, li_cur_row
  150. li_cur_row = dw_uc.GetRow()
  151. li_row = dw_uc.InsertRow (0)
  152. FOR i = 1 TO 7
  153. dw_uc.SetTabOrder ( i, i*10 )
  154. NEXT
  155. dw_uc.SelectRow(0,FALSE)
  156. dw_uc.ScrollToRow (li_row)
  157. dw_uc.SelectRow(li_row,TRUE)
  158. dw_uc.SetFocus()
  159. modifyrow_no = li_row
  160. END IF
  161. dw_edit_mode = NOT dw_edit_mode
  162. WF_FACE_CHANGE()
  163. end event
  164. type cb_edit from w_publ_edit_choice`cb_edit within w_plugins_edit
  165. end type
  166. event cb_edit::clicked;call super::clicked;Long i
  167. IF dw_edit_mode THEN
  168. IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! OR dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN
  169. dw_uc.DeleteRow(dw_uc.GetRow())
  170. ELSE
  171. dw_uc.ReselectRow(dw_uc.GetRow())
  172. END IF
  173. FOR i = 1 TO 7
  174. dw_uc.SetTabOrder ( i, 0 )
  175. NEXT
  176. modifyrow_no = 0
  177. ELSE
  178. modifyrow_no = dw_uc.GetRow()
  179. FOR i = 1 TO 7
  180. dw_uc.SetTabOrder ( i, i*10 )
  181. NEXT
  182. dw_uc.SetFocus()
  183. dw_uc.SelectRow(0,FALSE)
  184. dw_uc.ScrollToRow (modifyrow_no)
  185. dw_uc.SelectRow(modifyrow_no,TRUE)
  186. END IF
  187. dw_edit_mode = NOT dw_edit_mode
  188. WF_FACE_CHANGE()
  189. end event
  190. type cb_delet from w_publ_edit_choice`cb_delet within w_plugins_edit
  191. end type
  192. event cb_delet::clicked;call super::clicked;IF MessageBox (publ_operator,"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  193. RETURN
  194. END IF
  195. Long LS_id
  196. Long LS_LONG = 0
  197. Long cur_fileid = 0
  198. String ls_code,arg_msg
  199. IF DW_UC.GetRow() <= 0 THEN
  200. MessageBox('','没有操作目标记录!')
  201. RETURN
  202. END IF
  203. DW_UC.SetRedraw (FALSE)
  204. DW_UC.DeleteRow (0)
  205. DW_UC.TriggerEvent (RowFocusChanged!)
  206. IF DW_UC.Update() = -1 THEN
  207. ROLLBACK;
  208. MessageBox (publ_operator,"删除记录操作失败!",Exclamation!,OK!)
  209. ELSE
  210. COMMIT;
  211. END IF
  212. DW_UC.SetRedraw (TRUE)
  213. end event
  214. type cb_choice from w_publ_edit_choice`cb_choice within w_plugins_edit
  215. boolean visible = false
  216. end type
  217. type dw_uc from w_publ_edit_choice`dw_uc within w_plugins_edit
  218. integer width = 3561
  219. integer height = 1892
  220. string dataobject = "u_plugins_edit"
  221. boolean hscrollbar = true
  222. end type
  223. event dw_uc::clicked;call super::clicked;IF row > 0 THEN
  224. THIS.AcceptText()
  225. IF dw_edit_mode THEN
  226. THIS.SetRow(row)
  227. THIS.SelectRow(0,FALSE)
  228. THIS.SelectRow(row,TRUE)
  229. IF dwo.Name = 'b_file' THEN
  230. PARENT.TriggerEvent('ue_add_file')
  231. ELSEIF dwo.Name = 'b_user' THEN
  232. PARENT.TriggerEvent('ue_add_user')
  233. END IF
  234. END IF
  235. IF dwo.Name = 'b_run' THEN
  236. PARENT.TriggerEvent('ue_run_file')
  237. END IF
  238. END IF
  239. end event
  240. event dw_uc::rowfocuschanging;//
  241. end event
  242. event dw_uc::rbuttondown;call super::rbuttondown;IF dw_edit_mode THEN
  243. Long ll_row,ll_column
  244. ll_row = THIS.GetRow()
  245. ll_column = THIS.GetColumn()
  246. IF ll_row <= 0 THEN RETURN
  247. IF ll_column <= 0 THEN RETURN
  248. IF Left(dwo.TYPE,4) = 'text' THEN RETURN
  249. m_dwchild_rbotton m_print
  250. m_print = CREATE m_dwchild_rbotton
  251. m_print.m_0.PopMenu(THIS.X + THIS.PointerX() + 50,THIS.Y + THIS.PointerY() + 50)
  252. END IF
  253. end event
  254. event dw_uc::constructor;call super::constructor;dw_uc_h = this.height
  255. dw_uc_w = this.width
  256. end event
  257. type cb_rtr from w_publ_edit_choice`cb_rtr within w_plugins_edit
  258. end type
  259. type cb_help from w_publ_edit_choice`cb_help within w_plugins_edit
  260. end type
  261. type ln_bar from w_publ_edit_choice`ln_bar within w_plugins_edit
  262. end type
  263. type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_plugins_edit
  264. end type
  265. type r_bar from w_publ_edit_choice`r_bar within w_plugins_edit
  266. end type