123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- $PBExportHeader$w_msg_fj_view_newstyle.srw
- forward
- global type w_msg_fj_view_newstyle from w_publ_base
- end type
- type dw_fj from datawindow within w_msg_fj_view_newstyle
- end type
- end forward
- global type w_msg_fj_view_newstyle from w_publ_base
- integer width = 1403
- integer height = 1544
- string title = "消息附件查看"
- boolean minbox = false
- windowtype windowtype = response!
- long backcolor = 67108864
- event ue_open_fj ( )
- event ue_download_fj ( )
- dw_fj dw_fj
- end type
- global w_msg_fj_view_newstyle w_msg_fj_view_newstyle
- type variables
- s_edit_index_tran s_open
- string ins_openfile_log[] //用于退出后删除
- long ins_openfile_log_p=0 //用于退出后删除
- string ori_select_fj
- end variables
- forward prototypes
- public subroutine wf_addlog_tempfilepathname (string arg_filepathname)
- public subroutine wf_del_tempfilepathname ()
- end prototypes
- event ue_open_fj();int rslt = 1
- string ls_pathname
- string errmsg
- string lsNull
- setnull(lsNull)
- string arg_filename
- blob arg_blob
- long arg_fjid
- long ll_row
- string arg_msg
- ll_row = dw_fj.getrow()
- if ll_row <= 0 then return
- arg_fjid = dw_fj.object.sys_admsg_fj_fjid[ll_row]
- arg_filename = dw_fj.object.sys_admsg_fj_filename[ll_row]
- SELECTBLOB fileblob INTO :arg_blob FROM Sys_admsg_fj
- WHERE fjid = :arg_fjid;
- if sqlca.sqlcode <> 0 then
- rslt = 0
- arg_msg = '获取内部消息附件失败,' + sqlca.sqlerrtext
- goto ext
- end if
- ls_pathname = sys_cur_path+ins_fjtemppath+'\'+String(Today(),'yymmdd')+String(Now(),'hhmmss')+'_'+arg_filename
- IF FileExists(ls_pathname) THEN FileDelete(ls_pathname)
- IF f_blobtofile(ls_pathname,arg_blob,errmsg) = 0 THEN
- rslt = 0
- GOTO ext
- END IF
- wf_addlog_tempfilepathname(ls_pathname)
- //打开附件
- ShellExecute32( Handle(THIS), lsNull, ls_pathname, lsNull, lsNull, 1 )
- ext:
- IF rslt = 0 THEN
- MessageBox('系统提示',errmsg)
- END IF
- end event
- event ue_download_fj();Int rslt = 1
- String ls_pathname
- String errmsg
- String lsNull
- SetNull(lsNull)
- String arg_filename
- Blob arg_blob
- Long arg_fjid,i
- Long ll_row
- String arg_msg
- ll_row = dw_fj.GetRow()
- If ll_row <= 0 Then Return
- arg_fjid = dw_fj.Object.sys_admsg_fj_fjid[ll_row]
- arg_filename = dw_fj.Object.sys_admsg_fj_filename[ll_row]
- ls_pathname = arg_filename
- long pos1
- string ls_filetypename
- pos1 = pos(arg_filename,'.',1)
- IF pos1 > 0 THEN
- ls_filetypename = mid(arg_filename,pos1 + 1, len(arg_filename))
- i = GetFileSaveName("另存为",ls_pathname,arg_filename,"*","*."+ls_filetypename+",*."+ls_filetypename)
- ELSE
- ls_filetypename = ''
- i = GetFileSaveName("另存为",ls_pathname,arg_filename,"*","*.*,*.*")
- END IF
- If i = 1 And Trim(ls_pathname) <> '' Then
- SelectBlob fileblob Into :arg_blob From Sys_admsg_fj
- Where fjid = :arg_fjid;
- If sqlca.SQLCode <> 0 Then
- rslt = 0
- arg_msg = '获取内部消息附件失败,' + sqlca.SQLErrText
- Goto ext
- End If
-
- If f_blobtofile(ls_pathname,arg_blob,errmsg) = 0 Then
- rslt = 0
- Goto ext
- End If
- messagebox('系统提示','附件保存成功')
- End If
- ext:
- If rslt = 0 Then
- MessageBox('系统提示',errmsg)
- End If
- end event
- public subroutine wf_addlog_tempfilepathname (string arg_filepathname);//wf_addlog_tempfilepathname
- if isnull(arg_filepathname) or len(trim(arg_filepathname))<3 then return
- ins_openfile_log_p++
- ins_openfile_log[ins_openfile_log_p]=arg_filepathname
- end subroutine
- public subroutine wf_del_tempfilepathname ();long li
- for li=1 to ins_openfile_log_p
- if len(trim(ins_openfile_log[li]))<=0 then
- else
- FileDelete(ins_openfile_log[li])
- end if
- next
- end subroutine
- on w_msg_fj_view_newstyle.create
- int iCurrent
- call super::create
- this.dw_fj=create dw_fj
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.dw_fj
- end on
- on w_msg_fj_view_newstyle.destroy
- call super::destroy
- destroy(this.dw_fj)
- end on
- event open;call super::open;s_open = message.powerobjectparm
- ori_select_fj = dw_fj.Describe("DataWindow.Table.Select")
- dw_fj.settransobject(sqlca)
- string ls_wherestr,ls_newselect
- ls_wherestr = ' where Sys_admsg_fj.msgid = '+string(s_open.b_long)
- ls_newselect = ori_select_fj + ls_wherestr
- dw_fj.Modify("datawindow.table.select = ~"" + ls_newselect+ "~"")
- dw_fj.Retrieve()
- end event
- event close;call super::close;// 删除临时文件
- wf_del_tempfilepathname()
- end event
- type cb_func from w_publ_base`cb_func within w_msg_fj_view_newstyle
- boolean visible = false
- end type
- type cb_exit from w_publ_base`cb_exit within w_msg_fj_view_newstyle
- boolean visible = false
- end type
- type dw_fj from datawindow within w_msg_fj_view_newstyle
- integer x = 18
- integer y = 16
- integer width = 1358
- integer height = 1428
- integer taborder = 30
- boolean bringtotop = true
- string title = "none"
- string dataobject = "dw_msg_fj_newstyle_demo"
- boolean vscrollbar = true
- boolean livescroll = true
- end type
- event doubleclicked;parent.triggerevent('ue_open_fj')
- end event
- event clicked;if row > 0 then
- this.setrow(row)
- if dwo.name = 't_download' then
- parent.triggerevent('ue_download_fj')
- end if
- end if
- end event
|