w_msg_fj_view_newstyle.srw 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. $PBExportHeader$w_msg_fj_view_newstyle.srw
  2. forward
  3. global type w_msg_fj_view_newstyle from w_publ_base
  4. end type
  5. type dw_fj from datawindow within w_msg_fj_view_newstyle
  6. end type
  7. end forward
  8. global type w_msg_fj_view_newstyle from w_publ_base
  9. integer width = 1403
  10. integer height = 1544
  11. string title = "消息附件查看"
  12. boolean minbox = false
  13. windowtype windowtype = response!
  14. long backcolor = 67108864
  15. event ue_open_fj ( )
  16. event ue_download_fj ( )
  17. dw_fj dw_fj
  18. end type
  19. global w_msg_fj_view_newstyle w_msg_fj_view_newstyle
  20. type variables
  21. s_edit_index_tran s_open
  22. string ins_openfile_log[] //用于退出后删除
  23. long ins_openfile_log_p=0 //用于退出后删除
  24. string ori_select_fj
  25. end variables
  26. forward prototypes
  27. public subroutine wf_addlog_tempfilepathname (string arg_filepathname)
  28. public subroutine wf_del_tempfilepathname ()
  29. end prototypes
  30. event ue_open_fj();int rslt = 1
  31. string ls_pathname
  32. string errmsg
  33. string lsNull
  34. setnull(lsNull)
  35. string arg_filename
  36. blob arg_blob
  37. long arg_fjid
  38. long ll_row
  39. string arg_msg
  40. ll_row = dw_fj.getrow()
  41. if ll_row <= 0 then return
  42. arg_fjid = dw_fj.object.sys_admsg_fj_fjid[ll_row]
  43. arg_filename = dw_fj.object.sys_admsg_fj_filename[ll_row]
  44. SELECTBLOB fileblob INTO :arg_blob FROM Sys_admsg_fj
  45. WHERE fjid = :arg_fjid;
  46. if sqlca.sqlcode <> 0 then
  47. rslt = 0
  48. arg_msg = '获取内部消息附件失败,' + sqlca.sqlerrtext
  49. goto ext
  50. end if
  51. ls_pathname = sys_cur_path+ins_fjtemppath+'\'+String(Today(),'yymmdd')+String(Now(),'hhmmss')+'_'+arg_filename
  52. IF FileExists(ls_pathname) THEN FileDelete(ls_pathname)
  53. IF f_blobtofile(ls_pathname,arg_blob,errmsg) = 0 THEN
  54. rslt = 0
  55. GOTO ext
  56. END IF
  57. wf_addlog_tempfilepathname(ls_pathname)
  58. //打开附件
  59. ShellExecute32( Handle(THIS), lsNull, ls_pathname, lsNull, lsNull, 1 )
  60. ext:
  61. IF rslt = 0 THEN
  62. MessageBox('系统提示',errmsg)
  63. END IF
  64. end event
  65. event ue_download_fj();Int rslt = 1
  66. String ls_pathname
  67. String errmsg
  68. String lsNull
  69. SetNull(lsNull)
  70. String arg_filename
  71. Blob arg_blob
  72. Long arg_fjid,i
  73. Long ll_row
  74. String arg_msg
  75. ll_row = dw_fj.GetRow()
  76. If ll_row <= 0 Then Return
  77. arg_fjid = dw_fj.Object.sys_admsg_fj_fjid[ll_row]
  78. arg_filename = dw_fj.Object.sys_admsg_fj_filename[ll_row]
  79. ls_pathname = arg_filename
  80. long pos1
  81. string ls_filetypename
  82. pos1 = pos(arg_filename,'.',1)
  83. IF pos1 > 0 THEN
  84. ls_filetypename = mid(arg_filename,pos1 + 1, len(arg_filename))
  85. i = GetFileSaveName("另存为",ls_pathname,arg_filename,"*","*."+ls_filetypename+",*."+ls_filetypename)
  86. ELSE
  87. ls_filetypename = ''
  88. i = GetFileSaveName("另存为",ls_pathname,arg_filename,"*","*.*,*.*")
  89. END IF
  90. If i = 1 And Trim(ls_pathname) <> '' Then
  91. SelectBlob fileblob Into :arg_blob From Sys_admsg_fj
  92. Where fjid = :arg_fjid;
  93. If sqlca.SQLCode <> 0 Then
  94. rslt = 0
  95. arg_msg = '获取内部消息附件失败,' + sqlca.SQLErrText
  96. Goto ext
  97. End If
  98. If f_blobtofile(ls_pathname,arg_blob,errmsg) = 0 Then
  99. rslt = 0
  100. Goto ext
  101. End If
  102. messagebox('系统提示','附件保存成功')
  103. End If
  104. ext:
  105. If rslt = 0 Then
  106. MessageBox('系统提示',errmsg)
  107. End If
  108. end event
  109. public subroutine wf_addlog_tempfilepathname (string arg_filepathname);//wf_addlog_tempfilepathname
  110. if isnull(arg_filepathname) or len(trim(arg_filepathname))<3 then return
  111. ins_openfile_log_p++
  112. ins_openfile_log[ins_openfile_log_p]=arg_filepathname
  113. end subroutine
  114. public subroutine wf_del_tempfilepathname ();long li
  115. for li=1 to ins_openfile_log_p
  116. if len(trim(ins_openfile_log[li]))<=0 then
  117. else
  118. FileDelete(ins_openfile_log[li])
  119. end if
  120. next
  121. end subroutine
  122. on w_msg_fj_view_newstyle.create
  123. int iCurrent
  124. call super::create
  125. this.dw_fj=create dw_fj
  126. iCurrent=UpperBound(this.Control)
  127. this.Control[iCurrent+1]=this.dw_fj
  128. end on
  129. on w_msg_fj_view_newstyle.destroy
  130. call super::destroy
  131. destroy(this.dw_fj)
  132. end on
  133. event open;call super::open;s_open = message.powerobjectparm
  134. ori_select_fj = dw_fj.Describe("DataWindow.Table.Select")
  135. dw_fj.settransobject(sqlca)
  136. string ls_wherestr,ls_newselect
  137. ls_wherestr = ' where Sys_admsg_fj.msgid = '+string(s_open.b_long)
  138. ls_newselect = ori_select_fj + ls_wherestr
  139. dw_fj.Modify("datawindow.table.select = ~"" + ls_newselect+ "~"")
  140. dw_fj.Retrieve()
  141. end event
  142. event close;call super::close;// 删除临时文件
  143. wf_del_tempfilepathname()
  144. end event
  145. type cb_func from w_publ_base`cb_func within w_msg_fj_view_newstyle
  146. boolean visible = false
  147. end type
  148. type cb_exit from w_publ_base`cb_exit within w_msg_fj_view_newstyle
  149. boolean visible = false
  150. end type
  151. type dw_fj from datawindow within w_msg_fj_view_newstyle
  152. integer x = 18
  153. integer y = 16
  154. integer width = 1358
  155. integer height = 1428
  156. integer taborder = 30
  157. boolean bringtotop = true
  158. string title = "none"
  159. string dataobject = "dw_msg_fj_newstyle_demo"
  160. boolean vscrollbar = true
  161. boolean livescroll = true
  162. end type
  163. event doubleclicked;parent.triggerevent('ue_open_fj')
  164. end event
  165. event clicked;if row > 0 then
  166. this.setrow(row)
  167. if dwo.name = 't_download' then
  168. parent.triggerevent('ue_download_fj')
  169. end if
  170. end if
  171. end event