w_ljmail_send_fx.srw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. $PBExportHeader$w_ljmail_send_fx.srw
  2. $PBExportComments$(协同)发送邮件
  3. forward
  4. global type w_ljmail_send_fx from w_publ_base_style
  5. end type
  6. type uo_1 from uo_html_editor within w_ljmail_send_fx
  7. end type
  8. type st_1 from statictext within w_ljmail_send_fx
  9. end type
  10. type sle_contact from singlelineedit within w_ljmail_send_fx
  11. end type
  12. type pb_contact from picturebutton within w_ljmail_send_fx
  13. end type
  14. type st_2 from statictext within w_ljmail_send_fx
  15. end type
  16. type sle_subject from singlelineedit within w_ljmail_send_fx
  17. end type
  18. type cb_send from uo_imflatbutton within w_ljmail_send_fx
  19. end type
  20. type cb_save from uo_imflatbutton within w_ljmail_send_fx
  21. end type
  22. end forward
  23. global type w_ljmail_send_fx from w_publ_base_style
  24. integer width = 4037
  25. integer height = 2404
  26. string title = "发送邮件"
  27. boolean maxbox = true
  28. boolean resizable = true
  29. long backcolor = 16777215
  30. string icon = "graphics\chain_link_128px.ico"
  31. uo_1 uo_1
  32. st_1 st_1
  33. sle_contact sle_contact
  34. pb_contact pb_contact
  35. st_2 st_2
  36. sle_subject sle_subject
  37. cb_send cb_send
  38. cb_save cb_save
  39. end type
  40. global w_ljmail_send_fx w_ljmail_send_fx
  41. type variables
  42. s_fx_ljmail_contact ins_contacts // 收件人信息
  43. long ins_msgid
  44. end variables
  45. forward prototypes
  46. public function integer wf_chk ()
  47. public function integer wf_save ()
  48. public function integer wf_send ()
  49. public function integer wf_get_contact (long arg_commid, string arg_ljmail)
  50. end prototypes
  51. public function integer wf_chk ();// 发送前检查(保存不需要检查)
  52. int rslt = 1
  53. string msg
  54. if UpperBound(ins_contacts.revljmail) <= 0 then
  55. rslt = 0
  56. msg += '请选择收件人~r~n'
  57. end if
  58. if (Trim(sle_subject.Text) = '') then
  59. rslt = 0
  60. msg += '请填写主题~r~n'
  61. end if
  62. if (Trim(uo_1.uf_gethtml()) = '') then
  63. rslt = 0
  64. msg += '请填写正文内容~r~n'
  65. end if
  66. if (rslt = 0) then
  67. MessageBox('提示', msg)
  68. end if
  69. return rslt
  70. end function
  71. public function integer wf_save ();int rslt = 1
  72. oleobject mxs, mxItem
  73. mxs = FXAppCom.CreArrOfPbDictionary()
  74. long i
  75. for i = 1 to UpperBound(ins_contacts.revljmail)
  76. mxItem = FXAppCom.CreatePbDictionary()
  77. mxItem.SetString('comname', ins_contacts.revname[i])
  78. mxItem.SetString('empid', ins_contacts.revempid[i])
  79. mxItem.SetString('empname', ins_contacts.revname[i])
  80. mxItem.SetString('reltype', ins_contacts.reltype[i])
  81. mxItem.SetString('relid', 0)
  82. mxItem.SetString('ljmail', ins_contacts.revljmail[i])
  83. mxs.Add(mxItem)
  84. next
  85. oleobject msg
  86. msg = FXAppCom.CreatePbDictionary()
  87. msg.SetInt('msgid', ins_msgid)
  88. msg.SetString('subject', Trim(sle_subject.Text))
  89. msg.SetString('htmlbody', Trim(uo_1.uf_gethtml()))
  90. string arg_msg
  91. long msgid
  92. msgid = FXAppCom.AddLjmail(app_token_fx, msg, mxs, ref arg_msg)
  93. if (arg_msg <> '' or msgid <= 0) then
  94. rslt = 0
  95. MessageBox('提示', '保存操作失败~r~n' + arg_msg)
  96. else
  97. ins_msgid = msgid
  98. end if
  99. return rslt
  100. end function
  101. public function integer wf_send ();int rslt = 1
  102. if (wf_chk() <> 1) then
  103. rslt = 0
  104. goto ext
  105. end if
  106. if (wf_save() <> 1) then
  107. rslt = 0
  108. goto ext
  109. end if
  110. if (ins_msgid <= 0) then
  111. rslt = 0
  112. MessageBox('提示', '请先进行保存操作')
  113. goto ext
  114. end if
  115. string arg_msg
  116. FXAppCom.SendLjmail(app_token_fx, ins_msgid, ref arg_msg)
  117. if (arg_msg <> '') then
  118. rslt = 0
  119. MessageBox('提示', '发送失败:' + arg_msg)
  120. else
  121. MessageBox('提示', '发送成功')
  122. end if
  123. ext:
  124. return rslt
  125. end function
  126. public function integer wf_get_contact (long arg_commid, string arg_ljmail);// 使用回复邮件功能
  127. // 传入发件人在本地邮件服务的CusCommID和发件人龙嘉邮箱地址
  128. int rslt = 1
  129. string arg_msg
  130. oleobject obj, parm
  131. parm = FXAppCom.CreatePbDictionary()
  132. parm.SetInt('Commid', arg_commid)
  133. parm.SetString('Ljmail', arg_ljmail)
  134. FXAppCom.GetContactByLjmail(app_token_fx, parm, ref arg_msg)
  135. if (arg_msg <> '') then
  136. rslt = 0
  137. MessageBox('提示', '获取联系人信息失败:' + arg_msg)
  138. goto ext
  139. end if
  140. s_fx_ljmail_contact contacts_empty
  141. ins_contacts = contacts_empty
  142. obj = parm.GetPBDictionary('Contact')
  143. ins_contacts.cid[1] = obj.GetInt('cid')
  144. ins_contacts.userid[1] = obj.GetInt('userid')
  145. ins_contacts.reltype[1] = obj.GetInt('relType')
  146. ins_contacts.revcuscommid[1] = obj.GetInt('revCusCommID')
  147. ins_contacts.revname[1] = obj.GetString('revName')
  148. ins_contacts.revempid[1] = obj.GetInt('revEmpid')
  149. ins_contacts.revljmail[1] = obj.GetString('revLjmail')
  150. //ins_contacts.revrep[1] = obj.GetString('revRep')
  151. sle_contact.Text += ins_contacts.revname[1] + '<' + ins_contacts.revljmail[1] + '>;'
  152. ext:
  153. return rslt
  154. end function
  155. on w_ljmail_send_fx.create
  156. int iCurrent
  157. call super::create
  158. this.uo_1=create uo_1
  159. this.st_1=create st_1
  160. this.sle_contact=create sle_contact
  161. this.pb_contact=create pb_contact
  162. this.st_2=create st_2
  163. this.sle_subject=create sle_subject
  164. this.cb_send=create cb_send
  165. this.cb_save=create cb_save
  166. iCurrent=UpperBound(this.Control)
  167. this.Control[iCurrent+1]=this.uo_1
  168. this.Control[iCurrent+2]=this.st_1
  169. this.Control[iCurrent+3]=this.sle_contact
  170. this.Control[iCurrent+4]=this.pb_contact
  171. this.Control[iCurrent+5]=this.st_2
  172. this.Control[iCurrent+6]=this.sle_subject
  173. this.Control[iCurrent+7]=this.cb_send
  174. this.Control[iCurrent+8]=this.cb_save
  175. end on
  176. on w_ljmail_send_fx.destroy
  177. call super::destroy
  178. destroy(this.uo_1)
  179. destroy(this.st_1)
  180. destroy(this.sle_contact)
  181. destroy(this.pb_contact)
  182. destroy(this.st_2)
  183. destroy(this.sle_subject)
  184. destroy(this.cb_send)
  185. destroy(this.cb_save)
  186. end on
  187. event open;call super::open;uo_1.pb_picture.Visible = False
  188. s_ljmail_msg temp
  189. temp = Message.PowerObjectParm
  190. if not IsValid(temp) then return
  191. if IsNull(temp) then return
  192. if (temp.msgid > 0) then // 使用编辑功能--编辑邮件
  193. else // 使用回复功能--回复邮件
  194. sle_subject.Text = '回复:' + temp.subject
  195. string html
  196. html = '<br/><P>####################原始邮件####################</P>' + temp.htmlbody
  197. uo_1.uf_sethtml(html)
  198. wf_get_contact(temp.revcomid, temp.revljmail)
  199. end if
  200. end event
  201. event resize;call super::resize;if (this.Width < 4000) then this.Width = 4000
  202. if (this.Height < 2300) then this.Height = 2300
  203. sle_contact.Width = this.workspacewidth( ) - sle_contact.X - pb_contact.Width - 20
  204. pb_contact.X = sle_contact.X + sle_contact.Width + 10
  205. sle_subject.Width = sle_contact.Width
  206. uo_1.Width = this.workspacewidth( )
  207. uo_1.Height = this.workspaceheight( ) - uo_1.Y
  208. cb_exit.X = this.workspacewidth( ) - cb_exit.Width
  209. end event
  210. type cb_func from w_publ_base_style`cb_func within w_ljmail_send_fx
  211. boolean visible = false
  212. integer taborder = 0
  213. boolean enabled = false
  214. end type
  215. type cb_exit from w_publ_base_style`cb_exit within w_ljmail_send_fx
  216. integer x = 1234
  217. integer taborder = 70
  218. end type
  219. type ln_bar from w_publ_base_style`ln_bar within w_ljmail_send_fx
  220. end type
  221. type ln_bar2 from w_publ_base_style`ln_bar2 within w_ljmail_send_fx
  222. end type
  223. type r_bar from w_publ_base_style`r_bar within w_ljmail_send_fx
  224. end type
  225. type uo_1 from uo_html_editor within w_ljmail_send_fx
  226. integer y = 368
  227. integer width = 2542
  228. integer height = 748
  229. integer taborder = 40
  230. boolean bringtotop = true
  231. end type
  232. on uo_1.destroy
  233. call uo_html_editor::destroy
  234. end on
  235. type st_1 from statictext within w_ljmail_send_fx
  236. integer x = 18
  237. integer y = 192
  238. integer width = 210
  239. integer height = 56
  240. boolean bringtotop = true
  241. integer textsize = -9
  242. integer weight = 400
  243. fontcharset fontcharset = gb2312charset!
  244. fontpitch fontpitch = variable!
  245. string facename = "宋体"
  246. long textcolor = 33554432
  247. long backcolor = 16777215
  248. string text = "收件人:"
  249. boolean focusrectangle = false
  250. end type
  251. type sle_contact from singlelineedit within w_ljmail_send_fx
  252. event ue_doubleclk pbm_lbuttondblclk
  253. integer x = 219
  254. integer y = 180
  255. integer width = 2075
  256. integer height = 80
  257. integer taborder = 10
  258. boolean bringtotop = true
  259. integer textsize = -9
  260. integer weight = 400
  261. fontcharset fontcharset = gb2312charset!
  262. fontpitch fontpitch = variable!
  263. string facename = "宋体"
  264. string pointer = "HyperLink!"
  265. long textcolor = 33554432
  266. boolean displayonly = true
  267. borderstyle borderstyle = stylelowered!
  268. end type
  269. event ue_doubleclk;pb_contact.post event clicked()
  270. end event
  271. type pb_contact from picturebutton within w_ljmail_send_fx
  272. integer x = 2304
  273. integer y = 180
  274. integer width = 82
  275. integer height = 80
  276. integer taborder = 20
  277. boolean bringtotop = true
  278. integer textsize = -9
  279. integer weight = 400
  280. fontcharset fontcharset = gb2312charset!
  281. fontpitch fontpitch = variable!
  282. string facename = "宋体"
  283. string pointer = "HyperLink!"
  284. string picturename = "people.bmp"
  285. alignment htextalign = left!
  286. string powertiptext = "通信录"
  287. end type
  288. event clicked;s_fx_ljmail_contact temp
  289. OpenWithParm(w_ljmail_contact_ch_fx, ins_contacts)
  290. temp = Message.PowerObjectParm
  291. if (IsValid(temp) and not IsNull(temp)) then
  292. if (temp.ifch = 1) then
  293. ins_contacts = temp
  294. sle_contact.Text = ''
  295. long i
  296. for i = 1 to UpperBound(ins_contacts.revljmail)
  297. sle_contact.Text += ins_contacts.revname[i] + '<' + ins_contacts.revljmail[i] + '>;'
  298. next
  299. end if
  300. end if
  301. end event
  302. type st_2 from statictext within w_ljmail_send_fx
  303. integer x = 18
  304. integer y = 288
  305. integer width = 210
  306. integer height = 56
  307. boolean bringtotop = true
  308. integer textsize = -9
  309. integer weight = 400
  310. fontcharset fontcharset = gb2312charset!
  311. fontpitch fontpitch = variable!
  312. string facename = "宋体"
  313. long textcolor = 33554432
  314. long backcolor = 16777215
  315. string text = "主题:"
  316. boolean focusrectangle = false
  317. end type
  318. type sle_subject from singlelineedit within w_ljmail_send_fx
  319. integer x = 219
  320. integer y = 276
  321. integer width = 2075
  322. integer height = 80
  323. integer taborder = 30
  324. boolean bringtotop = true
  325. integer textsize = -9
  326. integer weight = 400
  327. fontcharset fontcharset = gb2312charset!
  328. fontpitch fontpitch = variable!
  329. string facename = "宋体"
  330. long textcolor = 33554432
  331. borderstyle borderstyle = stylelowered!
  332. end type
  333. type cb_send from uo_imflatbutton within w_ljmail_send_fx
  334. integer width = 151
  335. integer height = 164
  336. integer taborder = 50
  337. boolean bringtotop = true
  338. string text = "发送"
  339. string normalpicname = "graphics\fx_send.bmp"
  340. integer picsize = 16
  341. toolbaralignment pic_align = alignattop!
  342. boolean border = false
  343. end type
  344. event clicked;call super::clicked;if (wf_send() = 1) then
  345. Close(parent)
  346. end if
  347. end event
  348. type cb_save from uo_imflatbutton within w_ljmail_send_fx
  349. boolean visible = false
  350. integer x = 430
  351. integer width = 165
  352. integer height = 164
  353. integer taborder = 60
  354. boolean bringtotop = true
  355. boolean enabled = false
  356. string text = "保存"
  357. boolean border = false
  358. end type