w_email_signmanage.srw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. $PBExportHeader$w_email_signmanage.srw
  2. forward
  3. global type w_email_signmanage from window
  4. end type
  5. type cb_5 from commandbutton within w_email_signmanage
  6. end type
  7. type cb_4 from picturebutton within w_email_signmanage
  8. end type
  9. type cb_3 from commandbutton within w_email_signmanage
  10. end type
  11. type cb_2 from commandbutton within w_email_signmanage
  12. end type
  13. type cb_1 from commandbutton within w_email_signmanage
  14. end type
  15. type uo_1 from uo_html_editor within w_email_signmanage
  16. end type
  17. type dw_1 from datawindow within w_email_signmanage
  18. end type
  19. type gb_1 from groupbox within w_email_signmanage
  20. end type
  21. type gb_2 from groupbox within w_email_signmanage
  22. end type
  23. type gb_3 from groupbox within w_email_signmanage
  24. end type
  25. end forward
  26. global type w_email_signmanage from window
  27. integer width = 3433
  28. integer height = 1328
  29. boolean titlebar = true
  30. string title = "签名管理"
  31. boolean controlmenu = true
  32. boolean minbox = true
  33. boolean maxbox = true
  34. boolean resizable = true
  35. long backcolor = 67108864
  36. string icon = "AppIcon!"
  37. boolean center = true
  38. cb_5 cb_5
  39. cb_4 cb_4
  40. cb_3 cb_3
  41. cb_2 cb_2
  42. cb_1 cb_1
  43. uo_1 uo_1
  44. dw_1 dw_1
  45. gb_1 gb_1
  46. gb_2 gb_2
  47. gb_3 gb_3
  48. end type
  49. global w_email_signmanage w_email_signmanage
  50. type variables
  51. uo_email_sign uo_sign
  52. transaction fj_tran
  53. boolean addnew=false
  54. int newid ,ll_currrow
  55. end variables
  56. forward prototypes
  57. public subroutine wf_save ()
  58. public function string of_globalreplace1 (string as_source, string as_old, string as_new)
  59. public function string of_globalreplace (string as_source, string as_old, string as_new)
  60. end prototypes
  61. public subroutine wf_save ();//
  62. end subroutine
  63. public function string of_globalreplace1 (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos
  64. as_source=trim(as_source)
  65. as_old=trim(as_old)
  66. ll_pos = Pos(as_source,as_old)
  67. IF ll_pos > 0 Then
  68. ll_oldlen = Len(as_old)
  69. ll_newlen = Len(as_new)
  70. as_source = Replace(as_source,ll_pos,ll_oldlen,as_new)
  71. ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen)
  72. END IF
  73. RETURN as_source
  74. end function
  75. public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos
  76. as_source=trim(as_source)
  77. as_old=trim(as_old)
  78. ll_pos = Pos(as_source,as_old)
  79. IF ll_pos > 0 Then
  80. ll_oldlen = Len(as_old)
  81. ll_newlen = Len(as_new)
  82. DO WHILE ll_pos > 0
  83. as_source = Replace(as_source,ll_pos,ll_oldlen,as_new)
  84. ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen)
  85. LOOP
  86. END IF
  87. RETURN as_source
  88. end function
  89. on w_email_signmanage.create
  90. this.cb_5=create cb_5
  91. this.cb_4=create cb_4
  92. this.cb_3=create cb_3
  93. this.cb_2=create cb_2
  94. this.cb_1=create cb_1
  95. this.uo_1=create uo_1
  96. this.dw_1=create dw_1
  97. this.gb_1=create gb_1
  98. this.gb_2=create gb_2
  99. this.gb_3=create gb_3
  100. this.Control[]={this.cb_5,&
  101. this.cb_4,&
  102. this.cb_3,&
  103. this.cb_2,&
  104. this.cb_1,&
  105. this.uo_1,&
  106. this.dw_1,&
  107. this.gb_1,&
  108. this.gb_2,&
  109. this.gb_3}
  110. end on
  111. on w_email_signmanage.destroy
  112. destroy(this.cb_5)
  113. destroy(this.cb_4)
  114. destroy(this.cb_3)
  115. destroy(this.cb_2)
  116. destroy(this.cb_1)
  117. destroy(this.uo_1)
  118. destroy(this.dw_1)
  119. destroy(this.gb_1)
  120. destroy(this.gb_2)
  121. destroy(this.gb_3)
  122. end on
  123. event open;
  124. uo_sign = Create uo_email_sign
  125. Long ll_ConnectionID
  126. String arg_msg
  127. IF sys_email_sqlca.DBHandle() > 0 THEN
  128. fj_tran = sys_email_sqlca
  129. ELSE
  130. MessageBox('系统提示','要使用邮件功能,请先定义邮件数据库')
  131. RETURN
  132. END IF
  133. uo_sign.uf_settrans(fj_tran)
  134. uo_sign.ownerid = publ_userid
  135. dw_1.SetTrans(fj_tran)
  136. dw_1.Retrieve(publ_userid)
  137. dw_1.SetRow(1)
  138. end event
  139. type cb_5 from commandbutton within w_email_signmanage
  140. integer x = 2903
  141. integer y = 1120
  142. integer width = 329
  143. integer height = 84
  144. integer taborder = 50
  145. integer textsize = -9
  146. integer weight = 400
  147. fontcharset fontcharset = gb2312charset!
  148. fontpitch fontpitch = variable!
  149. string facename = "宋体"
  150. string text = "保存并退出"
  151. end type
  152. event clicked;String content,ls_msg
  153. Long row
  154. row = ll_currrow
  155. IF row = 0 Or dw_1.RowCount() < row THEN
  156. GOTO ext
  157. END IF
  158. content = uo_1.uf_gethtml()
  159. IF Pos(content,"<DIV id=signName") <> 0 THEN
  160. content = of_globalreplace1(content,"<DIV id=signName",'<DIV id=signName style="MARGIN-TOP: 0px; cellpadding: 0px; cellspacing: 0px" valign="top" height="100%" width="100%"><DIV ')
  161. content = content+"</DIV>"
  162. END IF
  163. uo_sign.signcontent = content
  164. uo_sign.id = dw_1.Object.id[row]
  165. uo_sign.signname = dw_1.Object.signname[row]
  166. uo_sign.uf_save(Ref ls_msg)
  167. ext:
  168. Close(Parent)
  169. end event
  170. type cb_4 from picturebutton within w_email_signmanage
  171. integer x = 105
  172. integer y = 84
  173. integer width = 78
  174. integer height = 64
  175. integer taborder = 30
  176. integer textsize = -9
  177. integer weight = 400
  178. fontcharset fontcharset = gb2312charset!
  179. fontpitch fontpitch = variable!
  180. string facename = "宋体"
  181. string picturename = "delete.bmp"
  182. alignment htextalign = left!
  183. end type
  184. event clicked;long row,ll_id
  185. string ls_msg
  186. row=dw_1.getrow()
  187. uo_1.uf_sethtml("")
  188. if row=0 then
  189. return
  190. end if
  191. ll_id=dw_1.object.id[row]
  192. dw_1.deleterow(row)
  193. if uo_sign.uf_delete(ll_id,ref ls_msg)=0 then
  194. messagebox('',ls_msg)
  195. return
  196. end if
  197. uo_1.uf_sethtml("")
  198. addnew=false
  199. //dw_1.trigger event rowfocuschanged(dw_1.getrow())
  200. end event
  201. type cb_3 from commandbutton within w_email_signmanage
  202. integer x = 23
  203. integer y = 80
  204. integer width = 78
  205. integer height = 68
  206. integer taborder = 30
  207. integer textsize = -9
  208. integer weight = 400
  209. fontcharset fontcharset = gb2312charset!
  210. fontpitch fontpitch = variable!
  211. string facename = "宋体"
  212. string text = "+"
  213. end type
  214. event clicked;OpenWithParm(w_getname,'签名')
  215. String ls_name,ls_msg
  216. ls_name = Message.StringParm
  217. IF ls_name = '' THEN
  218. RETURN
  219. END IF
  220. addnew = True
  221. dw_1.trigger event rowfocuschanging(dw_1.getrow(),1)
  222. uo_sign.uf_reset()
  223. uo_sign.signname = ls_name
  224. uo_sign.uf_save(Ref ls_msg)
  225. uo_1.uf_sethtml(uo_sign.signcontent)
  226. addnew = False
  227. dw_1.Retrieve(publ_userid)
  228. ll_currrow=dw_1.rowcount()
  229. end event
  230. type cb_2 from commandbutton within w_email_signmanage
  231. integer x = 2510
  232. integer y = 1120
  233. integer width = 325
  234. integer height = 84
  235. integer taborder = 40
  236. integer textsize = -9
  237. integer weight = 400
  238. fontcharset fontcharset = gb2312charset!
  239. fontpitch fontpitch = variable!
  240. string facename = "宋体"
  241. string text = "取消"
  242. end type
  243. event clicked;close(parent)
  244. end event
  245. type cb_1 from commandbutton within w_email_signmanage
  246. integer x = 2080
  247. integer y = 1120
  248. integer width = 329
  249. integer height = 84
  250. integer taborder = 30
  251. integer textsize = -9
  252. integer weight = 400
  253. fontcharset fontcharset = gb2312charset!
  254. fontpitch fontpitch = variable!
  255. string facename = "宋体"
  256. string text = "保存"
  257. end type
  258. event clicked;String content,ls_msg
  259. Long row
  260. row = ll_currrow
  261. IF row = 0 or dw_1.rowcount() <row THEN
  262. GOTO ext
  263. end if
  264. content = uo_1.uf_gethtml()
  265. IF Pos(content,"<DIV id=signName") <> 0 THEN
  266. content=of_globalreplace1(content,"<DIV id=signName",'<DIV id=signName style="MARGIN-TOP: 0px; cellpadding: 0px; cellspacing: 0px" valign="top" height="100%" width="100%"><DIV ')
  267. content = content+"</DIV>"
  268. END IF
  269. uo_sign.signcontent = content
  270. uo_sign.id = dw_1.Object.id[row]
  271. uo_sign.signname = dw_1.Object.signname[row]
  272. uo_sign.uf_save(Ref ls_msg)
  273. ext:
  274. end event
  275. type uo_1 from uo_html_editor within w_email_signmanage
  276. integer x = 850
  277. integer y = 92
  278. integer width = 2510
  279. integer height = 960
  280. integer taborder = 30
  281. end type
  282. on uo_1.destroy
  283. call uo_html_editor::destroy
  284. end on
  285. type dw_1 from datawindow within w_email_signmanage
  286. integer x = 18
  287. integer y = 152
  288. integer width = 786
  289. integer height = 900
  290. integer taborder = 20
  291. string title = "none"
  292. string dataobject = "dw_email_signlist"
  293. boolean livescroll = true
  294. borderstyle borderstyle = stylelowered!
  295. end type
  296. event doubleclicked;
  297. if row=0 then
  298. return
  299. end if
  300. string ls_signname,ls_msg
  301. ls_signname=this.object.signname[row]
  302. openwithparm(w_getname,ls_signname)
  303. ls_signname=message.stringparm
  304. if ls_signname='' then
  305. return
  306. end if
  307. uo_sign.signname=ls_signname
  308. if uo_sign.uf_save(ref ls_msg)=0 then
  309. messagebox('',ls_msg)
  310. end if
  311. end event
  312. event rowfocuschanged;//string content
  313. //content=uo_1.uf_gethtml()
  314. //uo_sign.signcontent=content
  315. string ls_msg
  316. //messagebox('',string(currentrow))
  317. if currentrow=0 then
  318. return
  319. end if
  320. ///保存之前内容
  321. ///保存之前内容
  322. newid=this.object.id[currentrow]
  323. if uo_sign.uf_set_sign(newid,publ_userid,ref ls_msg)=0 then
  324. messagebox('',ls_msg)
  325. return
  326. end if
  327. uo_1.uf_sethtml(uo_sign.signcontent)
  328. end event
  329. event rowfocuschanging;//String content,ls_msg
  330. //
  331. //IF currentrow = 0 THEN
  332. // RETURN
  333. //END IF
  334. //IF addnew THEN
  335. // content = uo_1.uf_gethtml()
  336. //
  337. ////IF Pos(content,"<DIV id=signName") = 0 and len(content)>200 THEN
  338. //// content=of_globalreplace1(content,"</DIV>","")
  339. //// content = left(content,Len(content) - 6)
  340. //// content = content+"</DIV></DIV>"
  341. ////
  342. ////END IF
  343. //
  344. // uo_sign.signcontent = content
  345. // uo_sign.id = This.Object.id[currentrow]
  346. // uo_sign.signname = This.Object.signname[currentrow]
  347. // uo_sign.uf_save(Ref ls_msg)
  348. //ELSE
  349. // addnew = True
  350. //END IF
  351. //
  352. //
  353. //
  354. //
  355. //
  356. end event
  357. event clicked;//string content
  358. //content=uo_1.uf_gethtml()
  359. //uo_sign.signcontent=content
  360. string ls_msg
  361. //messagebox('',string(currentrow))
  362. if dw_1.getrow()=0 then
  363. return
  364. end if
  365. ll_currrow = row
  366. ///保存之前内容
  367. ///保存之前内容
  368. newid=this.object.id[dw_1.getrow()]
  369. if uo_sign.uf_set_sign(newid,publ_userid,ref ls_msg)=0 then
  370. messagebox('',ls_msg)
  371. return
  372. end if
  373. uo_1.uf_sethtml(uo_sign.signcontent)
  374. end event
  375. type gb_1 from groupbox within w_email_signmanage
  376. integer width = 832
  377. integer height = 1080
  378. integer taborder = 10
  379. integer textsize = -9
  380. integer weight = 400
  381. fontcharset fontcharset = gb2312charset!
  382. fontpitch fontpitch = variable!
  383. string facename = "宋体"
  384. long textcolor = 33554432
  385. long backcolor = 67108864
  386. string text = "选择签名"
  387. end type
  388. type gb_2 from groupbox within w_email_signmanage
  389. integer x = 832
  390. integer width = 2551
  391. integer height = 1076
  392. integer taborder = 20
  393. integer textsize = -9
  394. integer weight = 400
  395. fontcharset fontcharset = gb2312charset!
  396. fontpitch fontpitch = variable!
  397. string facename = "宋体"
  398. long textcolor = 33554432
  399. long backcolor = 67108864
  400. string text = "编辑签名"
  401. end type
  402. type gb_3 from groupbox within w_email_signmanage
  403. integer y = 1260
  404. integer width = 2871
  405. integer height = 496
  406. integer taborder = 20
  407. integer textsize = -9
  408. integer weight = 400
  409. fontcharset fontcharset = gb2312charset!
  410. fontpitch fontpitch = variable!
  411. string facename = "宋体"
  412. long textcolor = 33554432
  413. long backcolor = 67108864
  414. boolean enabled = false
  415. string text = "选择账号默认签名"
  416. end type