source: GuiMail/trunk/p/CWMAILA.m@ 1751

Last change on this file since 1751 was 1139, checked in by George Lilly, 14 years ago

version 2.3 of GuiMail

File size: 5.0 KB
RevLine 
[1139]1CWMAILA ;INDPLS/PLS- DELPHI VISTA MAIL SERVER CONT'D ;21-Jun-2005 06:34;CLC
2 ;;2.3;CWMAIL;;Jul 19, 2005
[1138]3 ;MODIFIED FOR XM*7.1*50
4 Q ;ROUTINE CAN'T BE CALLED DIRECTLY
5%READ(CWDATA,CWINPUT) ;
6 ;CWINPUT FORMAT - DELIMITER ';'
7 ; 1st - IEN of message
8 ; 4th - New message (value >0 indicates new messages only)
9 K CWDATA
10 N CWMSGN,CWNMFLG
11 S CWMSGN=$P(CWINPUT,";")
12 S CWNMFLG=+$P(CWINPUT,";",4)
13 D:CWMSGN PROCMS^CWMAIL0(.CWDATA,CWMSGN,CWNMFLG)
14 Q
15%LIST(CWDATA,CWINPUT) ;
16 ;CWINPUT - MAIL TYPE OR MAILBOX NUMBER - DELIMITER ';'
17 ; 2nd - IEN of MailBasket or non-numeric for new mail
18 ;CWARY format: piece value
19 ; 1 message basket
20 ; 2 message ien
21 ; 3 message subject
22 ; 4 message date sent
23 ; 5 not used
24 ; 6 message type
25 ; 7 confirmation flag
26 ; 8 closed flag
27 ; 9 info flag
28 ; 10 confidential flag
29 ; 11 sender ien
30 ; 12 broadcast flag
31 ; 13 sender name
32 ; 14 total # of recipients
33 ; 15 total # of replies
34 ; 16 priority flag
35 ; 17 last response read
36 ; 18 message basket sequence number
37 ; 19 new message flag
38 ; 20 answer message flag
39 ;
40 S CWDATA(1)="0^AN ERROR HAS OCCURRED"
41 N CWVAL,CWMSG,CWMSGSUB,CWMSGDT,CWDCNT,CWMAIB,CWMSGBX,CWMSGLP
42 N CWARY
43 S CWVAL=$P(CWINPUT,";",2)
44 S CWMSG=0,CWDCNT=2,CWMSGLP=0
45 S CWMAIB=CWVAL
46 ;CALL API TO RETRIEVE MESSAGES
47 I CWVAL=+CWVAL D
[1139]48 . D LISTMSGS^XMXAPIB(XMDUZ,+CWMAIB,"BSKT;SUBJ;DATE;SEQN;NEW","",3500) ; data put in ^TMP("XMLIST",$J
[1138]49 . Q:'+$P($G(^TMP("XMLIST",$J,0)),U,1) ;NO DATA FOUND
50 . D BLDLST^CWMAILF(.CWDATA,$NA(^TMP("XMLIST",$J)),.CWDCNT)
51 E D ;PROCESS NEW MESSAGE REQUEST
[1139]52 . D LISTMSGS^XMXAPIB(XMDUZ,"*","BSKT;SUBJ;DATE;NEW","N",3500) ;SEQN;NEW","N")
[1138]53 . Q:'+$P($G(^TMP("XMLIST",$J,0)),U,1) ;NO DATA FOUND
54 . D BLDLST^CWMAILF(.CWDATA,$NA(^TMP("XMLIST",$J)),.CWDCNT)
55 I $O(CWDATA(1)) S CWDATA(1)="1^^DATA HAS BEEN FOUND"
56 E S CWDATA(1)=$S(+CWVAL:"1^^No Messages Found in Specified Mail Box",1:"1^^"_"You have no NEW Messages")
57 S $P(CWDATA(1),U,2)=CWDCNT-2
58 Q
59 ;
60%DELETE(CWDATA,CWINPUT) ;
61 ;CWINPUT - DELIMITER ';'
62 ; 1st - IEN of message
63 ; 2nd - IEN of mail basket
64 N XMZ,XMDUZ,XMK,XMKZA,XMMSG
65 S XMZ=$P(CWINPUT,";")
66 S XMDUZ=DUZ
67 S XMK=$P(CWINPUT,";",2)
68 S XMKZA(XMZ)=""
69 D DELMSG^XMXAPI(XMDUZ,"",.XMKZA,.XMMSG)
70 I +$G(XMMSG) D
71 . S CWDATA(1)="1^0^Message Deleted"
72 E S CWDATA(1)="0^0^Unable to delete message"
73 Q
74%SAVE(CWDATA,CWINPUT) ;
75 ;CWINPUT - DELIMITER ';'
76 ; 1st - IEN of message
77 ; 2nd - IEN of mail basket
78 ; 3rd - IEN of new mail basket
79 N XMZ,XMK,XMKM,XMMSG,XMKZA
80 S XMZ=$P(CWINPUT,";"),XMK=$P(CWINPUT,";",2)
81 S XMKZA(XMZ)=""
82 S XMKM=$P(CWINPUT,";",3)
83 D MOVEMSG^XMXAPI(XMDUZ,"",.XMKZA,XMKM,.XMMSG)
84 S CWDATA(1)=+$G(XMMSG) ;Return Status
85 Q
86%MAKNEW(CWDATA,CWINPUT) ;
87 ;CWINPUT - DELIMITER ';'
88 ; 1st - IEN of message
89 ; 2nd - IEN of mail basket
90 N XMZ,XMK,XMKZA,XMMSG
91 S CWDATA(1)=0
92 S XMZ=$P(CWINPUT,";")
93 S XMK=+$P(CWINPUT,";",2)
94 D MAKENEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
95 I XMK<.6 D ;MUST MOVE MESSAGE FROM WASTE BASKET TO IN BASKET
96 . S XMKZA(XMZ)=""
97 . D MOVEMSG^XMXAPI(XMDUZ,"",.XMKZA,1,.XMMSG)
98 S CWDATA(1)="1^1" ;FORCE TO SUCCESS
99 Q
100%NEWBSK(CWDATA,CWINPUT) ;CREATE A NEW MAIL BASKET
101 ;CWINPUT - DELIMITER ';'
102 ; 1st Piece - New basket name
103 N CWBASKET,CWBSKN,CWMSG
104 S CWBASKET=$$UP^XLFSTR($P(CWINPUT,";")) ;FORCE TO UPPER CASE
105 D CRE8BSKT^XMXAPIB(XMDUZ,CWBASKET,.CWBSKN)
106 I +$G(CWBSKN)>0 D
107 . D QBSKT^XMXAPIB(XMDUZ,+CWBSKN,.CWMSG)
108 . S CWDATA(1)="1"_U_CWBSKN_U_$P($G(CWMSG),U,2)
109 E S CWDATA(1)=0_U_"Error-unable to create basket."
110 Q
111%RESEQ(CWDATA,CWINPUT) ;RESEQUENCE A VISTA MAIL BASKET
112 ;CWINPUT - DELIMITER ';'
113 ; 2nd - IEN of mail basket
114 N CWBASKET,CWDATT
115 S CWBASKET=$P(CWINPUT,";",2)
116 G:'CWBASKET RESEQE
117 D RSEQBSKT^XMXAPIB(XMDUZ,CWBASKET,.CWDATT)
118 I $L(CWDATT) S CWDATA(1)="1^1"
119 E S CWDATA(1)="0^0^Error-unable to resequence messages."
120RESEQE Q
121 ;
122%MSGSRC(CWDATA,CWINPUT,CWTEXT) ;MESSAGE SEARCH
123 ;INPUT - CWINPUT AND CWTEXT ARRAY HOLD CRITERIA
124 ;OUTPUT - REFER TO %LIST
125 S CWDATA(1)="0^AN ERROR HAS OCCURRED"
126 N CWVAL,CWMSG,CWMSGSUB,CWMSGDT,CWDCNT,CWMAIB,CWMSGBX,CWMSGLP
127 N CWARY,CWFLAGS
128 S CWFLAGS=$P(CWINPUT,";") ;Processing Flags
129 S CWMAIB=$P(CWINPUT,";",2) ;MailBasket
130 S CWMSG=0,CWDCNT=2,CWMSGLP=0
131 S CWMAIB=$S($L(CWMAIB):CWMAIB,1:"*")
132 ;Convert External dates to FM Dates
133 I $G(CWTEXT("FDATE")) D
134 . S CWTEXT("FDATE")=$$CONVERT^XMXUTIL1(CWTEXT("FDATE"))
135 I $G(CWTEXT("TDATE")) D
136 . S CWTEXT("TDATE")=$$CONVERT^XMXUTIL1(CWTEXT("TDATE"))
137 ;CALL API TO RETRIEVE MESSAGES
138 D LISTMSGS^XMXAPIB(XMDUZ,CWMAIB,"BSKT;SUBJ;DATE;NEW",CWFLAGS,,,.CWTEXT) ; data put in ^TMP("XMLIST",$J
139 I +$P($G(^TMP("XMLIST",$J,0)),U,1) D ;
140 . D BLDLST^CWMAILF(.CWDATA,$NA(^TMP("XMLIST",$J)),.CWDCNT)
141 I $O(CWDATA(1)) S CWDATA(1)="1^^DATA HAS BEEN FOUND"
142 E S CWDATA(1)="1^^No Messages Found In Search"
143 S $P(CWDATA(1),U,2)=CWDCNT-2
144MSGSRCE Q
Note: See TracBrowser for help on using the repository browser.