source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMJMP1.m@ 789

Last change on this file since 789 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 8.8 KB
Line 
1XMJMP1 ;ISC-SF/GMB-Print,Backup (cont.) ;12/04/2002 10:57
2 ;;8.0;MailMan;**9**;Jun 28, 2002
3BSKT(XMDUZ,XMZ,XMK,XMKN) ;
4 I +$G(XMK),$D(^XMB(3.7,"M",XMZ,XMDUZ,XMK)) S XMKN=$$BSKTNAME^XMXUTIL(XMDUZ,XMK) Q
5 N XMKSTR
6 S XMKSTR=$$BSKT^XMXUTIL2(XMDUZ,XMZ,1)
7 S XMK=$P(XMKSTR,U,1),XMKN=$S(XMK:$P(XMKSTR,U,2),1:$$EZBLD^DIALOG(34014)) ; * N/A *
8 Q
9HOWMUCH(XMZ,XMRESPS,XMWHICH,XMABORT) ;
10 N DIR,DIRUT,Y,XMRESP,XMTEXT
11 ; There is 1 response. / There are X responses. Response 0 is the original message. (?? shows index)
12 D BLD^DIALOG($S(XMRESPS=1:34514,1:34515),XMRESPS,"","XMTEXT")
13 M DIR("A")=XMTEXT
14 I XMWHICH<XMRESPS,XMWHICH'="" D ; (On broadcasts with responses, XMWHICH will usually be null.)
15 . S DIR("A")=$$EZBLD^DIALOG(34518) ; Backup to:
16 . S DIR("B")=+$O(^XMB(3.9,XMZ,3,XMWHICH)) ; (XMWHICH+1)
17 E D
18 . S DIR("A")=$$EZBLD^DIALOG(34519) ; Backup to: Original message
19 . S DIR("B")=0
20 S DIR(0)="NA^-"_XMRESPS_":"_XMRESPS
21 D BLD^DIALOG(34520,"","","DIR(""?"")")
22 ;If you select 0, you will Backup to the original message.
23 ;If you select one of the responses, you will Backup to it.
24 S DIR("??")="^D HELPRESP^XMJMP1(XMZ,XMRESPS)"
25 D ^DIR I $D(DIRUT) S XMABORT=1 Q
26 S XMRESP=$S(Y<0:XMRESPS+Y+1,1:Y)
27 S XMWHICH=$S(XMRESP=XMRESPS:XMRESP,1:XMRESP_"-"_XMRESPS)
28 Q
29HELPRESP(XMZ,XMRESPS) ;
30 N XMRESP,XMLEN,XMABORT
31 S XMABORT=0
32 W @IOF,$$EZBLD^DIALOG($S(XMRESPS=1:34530,1:34531),XMRESPS)
33 ;There is 1 response / There are _XMRESPS_ responses. Response 0 is the original message.
34 S XMRESP=$S(XMV("ORDER")=1:0,1:XMRESPS+1)
35 W ! D HRHDR(XMRESPS,XMRESP,.XMLEN)
36 D:XMV("ORDER")=1 HRLINE(XMZ,0)
37 F S XMRESP=$O(^XMB(3.9,XMZ,3,XMRESP),XMV("ORDER")) Q:XMRESP'>0 D Q:XMABORT
38 . I $Y+3>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT D
39 . . W @IOF D HRHDR(XMRESPS,XMRESP,.XMLEN)
40 . D HRLINE($P(^XMB(3.9,XMZ,3,XMRESP,0),U),XMRESP)
41 Q:XMABORT
42 Q:XMV("ORDER")=1
43 I $Y+3>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT D
44 . W @IOF D HRHDR(XMRESPS,XMRESP,.XMLEN)
45 D HRLINE(XMZ,0)
46 Q
47HRHDR(XMRESPS,XMRESP,XMLEN) ;
48 S XMLEN("RESP")=$S(XMV("ORDER")=1:$L($$MIN^XLFMTH(XMRESPS,XMRESP+IOSL)),1:$L(XMRESP))
49 S XMLEN("DATE")=$L($$MMDT^XMXUTIL1(DT))
50 S XMLEN("LINE")=5
51 S XMLEN("FROM")=79-XMLEN("RESP")-XMLEN("DATE")-XMLEN("LINE")-3
52 W $$LJ^XLFSTR($$EZBLD^DIALOG(34532),XMLEN("RESP")+XMLEN("DATE")+3,"."),$$LJ^XLFSTR($$EZBLD^DIALOG(34006),XMLEN("FROM"),"."),$$EZBLD^DIALOG(34003.1) ; "Response"/"From"/"Lines"
53 Q
54HRLINE(XMZ,XMRESP) ;
55 N XMZREC
56 S XMZREC=$G(^XMB(3.9,XMZ,0))
57 W !,$J(XMRESP,XMLEN("RESP")),") ",$$DATE^XMXUTIL2(XMZREC,0)," ",$$MELD^XMXUTIL1($$NAME^XMXUTIL($P(XMZREC,U,2),1),+$P($G(^XMB(3.9,XMZ,2,0)),U,4),XMLEN("FROM")+XMLEN("LINE"))
58 Q
59RESPHDR(XMZ,XMRESP) ;
60 N XMZREC
61 S XMZREC=$G(^XMB(3.9,XMZ,0))
62 D WL(XMRESP_") "_$$NAME^XMXUTIL($P(XMZREC,U,2),1))
63 D:$P(XMZREC,U,4)'="" W(" ",$$EZBLD^DIALOG(34533,$$NAME^XMXUTIL($P(XMZREC,U,4),1))) ; (Sender: x)
64 D W(" ",$$DATE($P(XMZREC,U,3)))
65 D W(" ",$$LINES(XMZ))
66 Q
67DATE(XMDT) ;
68 Q:XMDT'=+XMDT XMDT
69 Q $$MMDT^XMXUTIL1(XMDT)
70LINES(XMZ) ;
71 N XMLINES
72 S XMLINES=+$P($G(^XMB(3.9,XMZ,2,0)),U,4)
73 Q $$EZBLD^DIALOG($S(XMLINES=1:34534.1,1:34534),XMLINES) ; line/lines
74PRINTIT(XMDUZ,XMK,XMKN,XMZ,XMZREC,XMRESPS,XMPTR,XMWHICH,XMRECIPS,XMDISP,XMPRTHDR,XMMULT,XMABORT) ;
75 N XMSUBJ,XMPAGE,XMZSTR,I,XMRESP,XMRANGE,XMREMMSG
76 S:'$D(XMABORT) XMABORT=0
77 S XMSUBJ=$P(XMZREC,U,1) S:XMSUBJ["~U~" XMSUBJ=$$DECODEUP^XMXUTIL1(XMSUBJ)
78 S XMSUBJ=$$EZBLD^DIALOG(34536,XMSUBJ),XMZSTR=$$EZBLD^DIALOG(34537,XMZ) ; Subj: x / [#x]
79 S XMREMMSG=($P(XMZREC,U,2)["@")
80 S XMPAGE=1
81 D:XMPRTHDR HEADER(XMDUZ,XMK,XMKN,XMZ,XMRESPS,XMZREC,XMSUBJ,XMZSTR)
82 I XMWHICH>XMRESPS D:$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) NONEW^XMXUTIL(XMDUZ,XMK,XMZ,1) Q
83 F I=1:1:$L(XMWHICH,",") D Q:XMABORT
84 . S XMRANGE=$P(XMWHICH,",",I)
85 . S:$E(XMRANGE,$L(XMRANGE))="-" XMRANGE=XMRANGE_XMRESPS
86 . F XMRESP=$P(XMRANGE,"-",1):1:$S(XMRANGE["-":$P(XMRANGE,"-",2),1:XMRANGE) D Q:XMABORT
87 . . I XMRESP>0 D RESPONSE(XMZ,.XMRESP,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,XMREMMSG,.XMPAGE,.XMABORT) Q
88 . . D BODY(XMZ,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,.XMPAGE,.XMABORT)
89 D:XMPTR LASTACC(XMDUZ,XMK,XMZ,XMZREC,XMSUBJ,XMPTR,XMRESP,+$G(XMMULT))
90 Q:XMABORT
91 D:XMRECIPS PRECIPS(XMDUZ,XMK,XMZ,XMRECIPS,XMSUBJ,XMZSTR,XMPRTHDR,.XMPAGE,.XMABORT)
92 I XMK,$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)),+XMRESP=+$P($G(^XMB(3.9,XMZ,3,0)),U,4) D NONEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
93 Q
94LASTACC(XMDUZ,XMK,XMZ,XMZREC,XMSUBJ,XMPTR,XMRESP,XMMULT) ; Note first, last accesses, number of responses read
95 N XMIM,XMIU,XMINSTR,XMCONFRM
96 S XMIM("SUBJ")=$P(XMSUBJ," ",2,99)
97 S XMIM("FROM")=$P(XMZREC,U,2)
98 S XMINSTR("FLAGS")=$S("^Y^y^"[(U_$P(XMZREC,U,5)_U):"R",1:"")
99 S XMIU("IEN")=XMPTR
100 S XMIU("RESP")=XMRESP
101 D LASTACC^XMXUTIL(XMDUZ,XMK,XMZ,XMRESP,.XMIM,.XMINSTR,.XMIU,.XMCONFRM)
102 Q:'XMCONFRM!$D(ZTQUEUED)
103 U IO(0)
104 D:XMMULT NOGOID^XMJMP2(XMZ,XMZREC)
105 W !,$$EZBLD^DIALOG(34540) ; >> Confirmation message sent to sender. <<
106 U IO
107 Q
108PRECIPS(XMDUZ,XMK,XMZ,XMRECIPS,XMSUBJ,XMZSTR,XMPRTHDR,XMPAGE,XMABORT) ; Print recipients (replaces QE2^XMA5)
109 D INFO^XMJMQ1(XMDUZ,XMK,XMZ,XMPRTHDR,XMSUBJ,XMZSTR,.XMPAGE,.XMABORT) Q:XMABORT
110 D LATER^XMJMQ1(XMDUZ,XMZ,XMPRTHDR,XMSUBJ,XMZSTR,.XMPAGE,.XMABORT) Q:XMABORT
111 I XMRECIPS=1 D
112 . D SUMMARY^XMJMQ1(XMZ,XMPRTHDR,XMSUBJ,XMZSTR,.XMPAGE,.XMABORT)
113 E D DETAIL^XMJMQ(XMZ,XMPRTHDR,XMSUBJ,XMZSTR,.XMPAGE,.XMABORT)
114 Q
115HEADER(XMDUZ,XMK,XMKN,XMZ,XMRESPS,XMZREC,XMSUBJ,XMZSTR) ;
116 D PAGE1HDR(XMDUZ,XMK,XMKN,XMZ,XMRESPS,XMZREC,XMSUBJ,XMZSTR)
117 D W(" ",$$EZBLD^DIALOG(34541)) ; Page 1
118 I XMK,$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) D W(" ",$$EZBLD^DIALOG($S($D(^XMB(3.7,XMDUZ,"N",XMK,XMZ)):34543,1:34544))) ; Priority! / *New*
119 D LINE
120 Q
121LINE ;
122 W !,"-------------------------------------------------------------------------------"
123 Q
124PAGE1HDR(XMDUZ,XMK,XMKN,XMZ,XMRESPS,XMZREC,XMSUBJ,XMZSTR) ;
125 W XMSUBJ
126 D W(" ",XMZSTR)
127 D W(" ",$$DATE($P(XMZREC,U,3)))
128 D W(" ",$$LINES(XMZ))
129 ;D:$O(^XMB(3.9,XMZ,2005,0)) W(" ",$$EZBLD^DIALOG(34573)) ; Attachment(s).
130 D WL($$EZBLD^DIALOG(34538,$$NAME^XMXUTIL($P(XMZREC,U,2),1))) ; From:
131 D:$P(XMZREC,U,4)'="" W(" ",$$EZBLD^DIALOG(34533,$$NAME^XMXUTIL($P(XMZREC,U,4),1))) ; (Sender: x)
132 I XMRESPS>0 D
133 . N XMPTR,XMRESP,XMPARM
134 . ;S XMPTR=+$O(^XMB(3.9,XMZ,1,"C",$S(XMDUZ=.6:DUZ,1:XMDUZ),0))
135 . S XMPTR=+$O(^XMB(3.9,XMZ,1,"C",XMDUZ,0))
136 . S XMRESP=+$P($G(^XMB(3.9,XMZ,1,XMPTR,0)),U,2)
137 . S XMPARM(1)=XMRESP,XMPARM(2)=XMRESPS
138 . D W(" ",$$EZBLD^DIALOG($S(XMRESPS=1:34545,1:34546),.XMPARM)) ; XMRESP_ of _XMRESPS_ response(s) read.
139 D W(" ",$$EZBLD^DIALOG(34539,XMKN)) ; In '_XMKN_' basket.
140 I $O(^XMB(3.73,"AC",XMZ,XMDUZ,0)) D W(" ",$$EZBLD^DIALOG(34595.1)) ; Message will be NEW Later.
141 I XMK D
142 . N XMVAPOR
143 . S XMVAPOR=$P($G(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)),U,5)
144 . I XMVAPOR D W(" ",$$EZBLD^DIALOG(34572,$$FMTE^XLFDT(XMVAPOR))) ; Automatic Deletion Date:
145 Q
146WL(XMSTRING) ;
147 I $L(XMSTRING)'<IOM,IOM>1 F D Q:$L(XMSTRING)<IOM
148 . W !,$E(XMSTRING,1,IOM-1)
149 . S XMSTRING=$E(XMSTRING,IOM,999)
150 W !,XMSTRING
151 Q
152W(XMSPACE,XMSTRING) ;
153 I $X+$L(XMSPACE)+$L(XMSTRING)>IOM D WL(XMSTRING) Q
154 W XMSPACE,XMSTRING
155 Q
156BODY(XMZ,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,XMPAGE,XMABORT) ;
157 N XMTEXT,I,J
158 S I=.999999
159 F S I=$O(^XMB(3.9,XMZ,2,I)) Q:I'>0 D Q:XMABORT
160 . S XMTEXT=^XMB(3.9,XMZ,2,I,0)
161 . I $D(XMSECURE),'$G(XMPAKMAN) S XMTEXT=$$DECSTR^XMJMCODE(XMTEXT) ; PackMan messages are never scrambled, just "secured".
162 . I $E(XMTEXT,1)="$",$F("$TXT$END",$E(XMTEXT,1,4))#4=1 S XMTEXT=$P(XMTEXT,U) ; hide code for secured packman msg.
163 . I XMTEXT["|TAB|" F S J=$F(XMTEXT,"|TAB|")-6 Q:J<0 S XMTEXT=$E(XMTEXT,1,J)_$E(" ",1,9-(J-(J\9*9)))_$E(XMTEXT,J+6,999)
164 . ; A site was sending a print to a device whose IOM was 0.
165 . ; In such a case, we should ignore IOM.
166 . F D Q:$L(XMTEXT)<IOM!XMABORT!(IOM<2) S XMTEXT=$E(XMTEXT,IOM,999)
167 . . I $Y+3+($E($G(IOST),1,2)="C-")>IOSL D Q:XMABORT
168 . . . D PAGE(XMZ,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,.XMPAGE,.XMABORT)
169 . . E W !
170 . . W $S(IOM>1:$E(XMTEXT,1,IOM-1),1:XMTEXT)
171 Q
172PAGE(XMZ,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,XMPAGE,XMABORT) ;
173 I $E($G(IOST),1,2)="C-",XMDISP W ! D PAGE^XMXUTIL(.XMABORT) Q:XMABORT
174 W @IOF
175 D:XMPRTHDR PAGE2HDR(XMSUBJ,XMZSTR,.XMPAGE)
176 Q
177PAGE2HDR(XMSUBJ,XMZSTR,XMPAGE) ;
178 S XMPAGE=XMPAGE+1
179 W XMSUBJ
180 D W(" ",XMZSTR)
181 D W(" ",$$EZBLD^DIALOG(34542,XMPAGE)) ; Page x
182 D LINE
183 W !
184 Q
185RESPONSE(XMZ,XMRESP,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,XMREMMSG,XMPAGE,XMABORT) ;
186 N XMZR,XMRSUBJ,XMREMREP
187 S XMZR=+$P($G(^XMB(3.9,XMZ,3,XMRESP,0)),U)
188 ;I '$D(^XMB(3.9,XMZR,0)) D Q
189 ;. ;N DA,DIK
190 ;. ;S DA(1)=XMZ,DA=XMRESP
191 ;. ;S DIK="^XMB(3.9,XMZ,3,"
192 ;. ;D ^DIK
193 S XMRSUBJ=$P($G(^XMB(3.9,XMZR,0)),U)
194 S XMREMREP=$S(XMRSUBJ?1"R"1.N:0,XMRSUBJ="":0,1:1) ; Reply is to or from a remote site
195 I $Y+(XMREMMSG!XMREMREP)+7+($E($G(IOST),1,2)="C-")>IOSL D Q:XMABORT
196 . D PAGE(XMZR,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,.XMPAGE,.XMABORT)
197 . S:XMABORT XMRESP=XMRESP-1
198 E W !
199 D RESPHDR(XMZR,XMRESP)
200 I XMREMREP D
201 . W !," ",$$EZBLD^DIALOG(34536,$S(XMRSUBJ["~U~":$$DECODEUP^XMXUTIL1(XMRSUBJ),1:XMRSUBJ)) ; Subj:
202 E I XMREMMSG D
203 . W !," ",$$EZBLD^DIALOG(34535) ; <Local Reply>
204 W !
205 D BODY(XMZR,XMSUBJ,XMZSTR,XMDISP,XMPRTHDR,.XMPAGE,.XMABORT)
206 Q
Note: See TracBrowser for help on using the repository browser.