XMJMR1 ;ISC-SF/GMB-Interactive Reply (cont.) ;08/24/2001 08:29
;;8.0;MailMan;;Jun 28, 2002
INIT(XMDUZ,XMK,XMKN,XMZO,XMZOSUBJ,XMZOFROM,XMINSTR,XMINCL,XMZI,XMWHICH,XMABORT) ;
N DIR,Y,DIRUT,XMRESPS
I XMDUZ=.6,DUZ=.6 D Q
. ; This is already handled in OPTMSG^XMXSEC2, but, just in case...
. S XMABORT=1
. W !,$$EZBLD^DIALOG(37422.6) ; SHARED,MAIL may not Reply to a message.
. G H^XUS
D CHKLOCK^XMJMS(XMDUZ,.XMABORT) Q:XMABORT
I XMINSTR("FLAGS")["P" D Q:XMABORT
. N XMTEXT
. W !,$C(7)
. D BLD^DIALOG(34200,"","","XMTEXT","F") ; Responses to priority messages are not ... (need priority? send a new msg)
. D MSG^DIALOG("WH","","","","XMTEXT")
. W !
. D PAGE^XMXUTIL(.XMABORT)
I XMZOFROM["POSTMASTER",XMZOFROM["@" D Q:XMABORT
. N XMTEXT
. W !,$C(7)
. D BLD^DIALOG(34201,"","","XMTEXT","F") ; Because this message is from a remote ... (reply stays local)
. D MSG^DIALOG("WH","","","","XMTEXT")
. W !
. D PAGE^XMXUTIL(.XMABORT)
D CHKBSKT^XMJMOI(XMDUZ,XMZO,.XMK,.XMKN)
I +XMK<1 D
. W !
. D SAVEMSG^XMJMOI(XMDUZ,.XMK,.XMKN,XMZO,XMZOSUBJ,XMZOFROM,$G(XMINSTR("RCPT BSKT")))
S XMRESPS=+$P($G(^XMB(3.9,XMZO,3,0)),U,4)
D WHICH(XMDUZ,XMZO,XMINCL,.XMZI,.XMWHICH,.XMABORT)
Q
WHICH(XMDUZ,XMZO,XMINCL,XMZI,XMWHICH,XMABORT) ;
; XMINCL =0 Do not include previous responses. Just reply.
; =1 Include previous response(s) from this message
; or include response(s) from another message in reply.
; =2 Include response(s) from another message in a new message.
Q:XMINCL=0
D WHICHMSG(XMDUZ,XMZO,XMINCL,.XMZI,.XMABORT) Q:XMABORT
D WHICH^XMJMC(XMZI,$$EZBLD^DIALOG(34209),.XMWHICH,.XMABORT) ; include
Q
WHICHMSG(XMDUZ,XMZO,XMINCL,XMZI,XMABORT) ; Include responses from which (different) message
N DIR,X,Y,XMIN,XMAX,XMPARM
S (XMPARM(1),XMIN)=$O(^XMB(3.9,0)),(XMPARM(2),XMAX)=$O(^XMB(3.9,":"),-1)
W !
S DIR("A")=$$EZBLD^DIALOG(34270) ; Include responses from which message
I XMINCL=1 D
. S DIR("B")=$$EZBLD^DIALOG(34271) ; This message
. S DIR(0)="FO^"_$$MIN^XLFMTH($L(XMIN),$L(DIR("B")))_":"_$$MAX^XLFMTH($L(XMAX),$L(DIR("B")))_"^D CHKMSG^XMJMR1(.Y)"
. D BLD^DIALOG(34272,.XMPARM,"","DIR(""?"")")
. ;Press Enter to include previous responses from this message
. ;or enter the internal entry number of a different message
. ;(_XMIN_-_XMAX_) to include any of its responses.
E D
. S DIR(0)="NO^"_XMIN_":"_XMAX_":0^D CHKMSG^XMJMR1(.Y)"
. D BLD^DIALOG(34273,.XMPARM,"","DIR(""?"")")
. ;Enter the internal entry number of a different message
. ;(_XMIN_-_XMAX_) to include any of its responses.
D ^DIR
I 'Y S XMABORT=1 Q
S XMZI=+Y
Q:XMINCL=1
; Do you want to review this message first?
Q
CHKMSG(XMZI) ;
I XMINCL=1,XMZI=DIR("B") S XMZI=XMZO Q ; Include previous responses from this message.
I XMINCL=1,$S(XMZI'?.N:1,XMZI<XMIN:1,XMZI>XMAX:1,1:0) K X W $C(7)," ?" Q
I XMINCL=2,XMZI=XMZO D Q
. K X
. W !,$$EZBLD^DIALOG(34274) ; You can't include the message you're editing.
N XMZIREC ; Include responses from another message.
S XMZIREC=$G(^XMB(3.9,XMZI,0))
I XMZIREC="" K X Q
I '$$INCLUDE^XMXSEC(XMDUZ,XMZI) D Q
. K X
. D SHOW^XMJERR
W " ",$P(XMZIREC,U,1)
Q
COPYTEXT(XMZI,XMZ,XMWHICH,XMHDR) ;
N I,XMRESP,XMRANGE,XMC
I $G(XMHDR) S XMHDR("XMZ")=XMZI,XMHDR("REC")=^XMB(3.9,XMZI,0)
W !,$$EZBLD^DIALOG(34202) ; Copying...
S XMC=+$O(^XMB(3.9,XMZ,2,""),-1)
F I=1:1:$L(XMWHICH,",") D
. S XMRANGE=$P(XMWHICH,",",I)
. Q:XMRANGE="" ; (XMWHICH can end with a ",", giving us a null piece.)
. F XMRESP=$P(XMRANGE,"-",1):1:$S(XMRANGE["-":$P(XMRANGE,"-",2),1:XMRANGE) D
. . I XMRESP=0 D COPYRESP(XMRESP,XMZI,XMZ,.XMC,.XMHDR) Q
. . D COPYRESP(XMRESP,+$G(^XMB(3.9,XMZI,3,XMRESP,0)),XMZ,.XMC,.XMHDR)
S ^XMB(3.9,XMZ,2,0)="^3.92A^"_XMC_U_XMC_U_DT
Q
COPYRESP(XMRESP,XMZI,XMZ,XMC,XMHDR) ;
N XMF,XMFROM,XMDT,XMZREC,XMPARM
S XMC=XMC+1
S ^XMB(3.9,XMZ,2,XMC,0)=""
S XMZREC=$G(^XMB(3.9,XMZI,0))
S XMFROM=$$NAME^XMXUTIL($P(XMZREC,U,2))
S XMDT=$P(XMZREC,U,3)
I $G(XMHDR) D
. S XMC=XMC+1
. S ^XMB(3.9,XMZ,2,XMC,0)="In the message:"
. S XMC=XMC+1
. S ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34536,$$SUBJ^XMXUTIL2(XMHDR("REC")))_" "_$$EZBLD^DIALOG(34537,XMHDR("XMZ")) ; Subj: / [#]
. S XMC=XMC+1
. S ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34538,$$FROM^XMXUTIL2(XMHDR("REC")))_$S($P(XMHDR("REC"),U,4)="":"",1:" "_$$EZBLD^DIALOG(34533,$$NAME^XMXUTIL($P(XMHDR("REC"),U,4)))) ; From: |1| (Sender: |1|)
. S XMC=XMC+1
. S ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34585,$$MMDT^XMXUTIL1($P(XMHDR("REC"),U,3))) ; Sent: |1|
S XMC=XMC+1
S XMPARM(1)=$$MMDT^XMXUTIL1(XMDT)
S XMPARM(2)=$S(XMRESP:$$EZBLD^DIALOG(34204,XMRESP),1:$$EZBLD^DIALOG(34205)) ; Response #|1| / Original message
S XMPARM(3)=XMFROM
S ^XMB(3.9,XMZ,2,XMC,0)=$$EZBLD^DIALOG(34203,.XMPARM) ; On |1| (|2|) |3| wrote:
S XMF=.999999
F S XMF=$O(^XMB(3.9,XMZI,2,XMF)) Q:XMF="" D
. S XMC=XMC+1
. W:XMC#50=0 "."
. S ^XMB(3.9,XMZ,2,XMC,0)=$E(">"_^XMB(3.9,XMZI,2,XMF,0),1,254)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMJMR1 5019 printed Sep 15, 2024@21:36:26 Page 2
XMJMR1 ;ISC-SF/GMB-Interactive Reply (cont.) ;08/24/2001 08:29
+1 ;;8.0;MailMan;;Jun 28, 2002
INIT(XMDUZ,XMK,XMKN,XMZO,XMZOSUBJ,XMZOFROM,XMINSTR,XMINCL,XMZI,XMWHICH,XMABORT) ;
+1 NEW DIR,Y,DIRUT,XMRESPS
+2 IF XMDUZ=.6
IF DUZ=.6
Begin DoDot:1
+3 ; This is already handled in OPTMSG^XMXSEC2, but, just in case...
+4 SET XMABORT=1
+5 ; SHARED,MAIL may not Reply to a message.
WRITE !,$$EZBLD^DIALOG(37422.6)
+6 GOTO H^XUS
End DoDot:1
QUIT
+7 DO CHKLOCK^XMJMS(XMDUZ,.XMABORT)
if XMABORT
QUIT
+8 IF XMINSTR("FLAGS")["P"
Begin DoDot:1
+9 NEW XMTEXT
+10 WRITE !,$CHAR(7)
+11 ; Responses to priority messages are not ... (need priority? send a new msg)
DO BLD^DIALOG(34200,"","","XMTEXT","F")
+12 DO MSG^DIALOG("WH","","","","XMTEXT")
+13 WRITE !
+14 DO PAGE^XMXUTIL(.XMABORT)
End DoDot:1
if XMABORT
QUIT
+15 IF XMZOFROM["POSTMASTER"
IF XMZOFROM["@"
Begin DoDot:1
+16 NEW XMTEXT
+17 WRITE !,$CHAR(7)
+18 ; Because this message is from a remote ... (reply stays local)
DO BLD^DIALOG(34201,"","","XMTEXT","F")
+19 DO MSG^DIALOG("WH","","","","XMTEXT")
+20 WRITE !
+21 DO PAGE^XMXUTIL(.XMABORT)
End DoDot:1
if XMABORT
QUIT
+22 DO CHKBSKT^XMJMOI(XMDUZ,XMZO,.XMK,.XMKN)
+23 IF +XMK<1
Begin DoDot:1
+24 WRITE !
+25 DO SAVEMSG^XMJMOI(XMDUZ,.XMK,.XMKN,XMZO,XMZOSUBJ,XMZOFROM,$GET(XMINSTR("RCPT BSKT")))
End DoDot:1
+26 SET XMRESPS=+$PIECE($GET(^XMB(3.9,XMZO,3,0)),U,4)
+27 DO WHICH(XMDUZ,XMZO,XMINCL,.XMZI,.XMWHICH,.XMABORT)
+28 QUIT
WHICH(XMDUZ,XMZO,XMINCL,XMZI,XMWHICH,XMABORT) ;
+1 ; XMINCL =0 Do not include previous responses. Just reply.
+2 ; =1 Include previous response(s) from this message
+3 ; or include response(s) from another message in reply.
+4 ; =2 Include response(s) from another message in a new message.
+5 if XMINCL=0
QUIT
+6 DO WHICHMSG(XMDUZ,XMZO,XMINCL,.XMZI,.XMABORT)
if XMABORT
QUIT
+7 ; include
DO WHICH^XMJMC(XMZI,$$EZBLD^DIALOG(34209),.XMWHICH,.XMABORT)
+8 QUIT
WHICHMSG(XMDUZ,XMZO,XMINCL,XMZI,XMABORT) ; Include responses from which (different) message
+1 NEW DIR,X,Y,XMIN,XMAX,XMPARM
+2 SET (XMPARM(1),XMIN)=$ORDER(^XMB(3.9,0))
SET (XMPARM(2),XMAX)=$ORDER(^XMB(3.9,":"),-1)
+3 WRITE !
+4 ; Include responses from which message
SET DIR("A")=$$EZBLD^DIALOG(34270)
+5 IF XMINCL=1
Begin DoDot:1
+6 ; This message
SET DIR("B")=$$EZBLD^DIALOG(34271)
+7 SET DIR(0)="FO^"_$$MIN^XLFMTH($LENGTH(XMIN),$LENGTH(DIR("B")))_":"_$$MAX^XLFMTH($LENGTH(XMAX),$LENGTH(DIR("B")))_"^D CHKMSG^XMJMR1(.Y)"
+8 DO BLD^DIALOG(34272,.XMPARM,"","DIR(""?"")")
+9 ;Press Enter to include previous responses from this message
+10 ;or enter the internal entry number of a different message
+11 ;(_XMIN_-_XMAX_) to include any of its responses.
End DoDot:1
+12 IF '$TEST
Begin DoDot:1
+13 SET DIR(0)="NO^"_XMIN_":"_XMAX_":0^D CHKMSG^XMJMR1(.Y)"
+14 DO BLD^DIALOG(34273,.XMPARM,"","DIR(""?"")")
+15 ;Enter the internal entry number of a different message
+16 ;(_XMIN_-_XMAX_) to include any of its responses.
End DoDot:1
+17 DO ^DIR
+18 IF 'Y
SET XMABORT=1
QUIT
+19 SET XMZI=+Y
+20 if XMINCL=1
QUIT
+21 ; Do you want to review this message first?
+22 QUIT
CHKMSG(XMZI) ;
+1 ; Include previous responses from this message.
IF XMINCL=1
IF XMZI=DIR("B")
SET XMZI=XMZO
QUIT
+2 IF XMINCL=1
IF $SELECT(XMZI'?.N:1,XMZI<XMIN:1,XMZI>XMAX:1,1:0)
KILL X
WRITE $CHAR(7)," ?"
QUIT
+3 IF XMINCL=2
IF XMZI=XMZO
Begin DoDot:1
+4 KILL X
+5 ; You can't include the message you're editing.
WRITE !,$$EZBLD^DIALOG(34274)
End DoDot:1
QUIT
+6 ; Include responses from another message.
NEW XMZIREC
+7 SET XMZIREC=$GET(^XMB(3.9,XMZI,0))
+8 IF XMZIREC=""
KILL X
QUIT
+9 IF '$$INCLUDE^XMXSEC(XMDUZ,XMZI)
Begin DoDot:1
+10 KILL X
+11 DO SHOW^XMJERR
End DoDot:1
QUIT
+12 WRITE " ",$PIECE(XMZIREC,U,1)
+13 QUIT
COPYTEXT(XMZI,XMZ,XMWHICH,XMHDR) ;
+1 NEW I,XMRESP,XMRANGE,XMC
+2 IF $GET(XMHDR)
SET XMHDR("XMZ")=XMZI
SET XMHDR("REC")=^XMB(3.9,XMZI,0)
+3 ; Copying...
WRITE !,$$EZBLD^DIALOG(34202)
+4 SET XMC=+$ORDER(^XMB(3.9,XMZ,2,""),-1)
+5 FOR I=1:1:$LENGTH(XMWHICH,",")
Begin DoDot:1
+6 SET XMRANGE=$PIECE(XMWHICH,",",I)
+7 ; (XMWHICH can end with a ",", giving us a null piece.)
if XMRANGE=""
QUIT
+8 FOR XMRESP=$PIECE(XMRANGE,"-",1):1:$SELECT(XMRANGE["-":$PIECE(XMRANGE,"-",2),1:XMRANGE)
Begin DoDot:2
+9 IF XMRESP=0
DO COPYRESP(XMRESP,XMZI,XMZ,.XMC,.XMHDR)
QUIT
+10 DO COPYRESP(XMRESP,+$GET(^XMB(3.9,XMZI,3,XMRESP,0)),XMZ,.XMC,.XMHDR)
End DoDot:2
End DoDot:1
+11 SET ^XMB(3.9,XMZ,2,0)="^3.92A^"_XMC_U_XMC_U_DT
+12 QUIT
COPYRESP(XMRESP,XMZI,XMZ,XMC,XMHDR) ;
+1 NEW XMF,XMFROM,XMDT,XMZREC,XMPARM
+2 SET XMC=XMC+1
+3 SET ^XMB(3.9,XMZ,2,XMC,0)=""
+4 SET XMZREC=$GET(^XMB(3.9,XMZI,0))
+5 SET XMFROM=$$NAME^XMXUTIL($PIECE(XMZREC,U,2))
+6 SET XMDT=$PIECE(XMZREC,U,3)
+7 IF $GET(XMHDR)
Begin DoDot:1
+8 SET XMC=XMC+1
+9 SET ^XMB(3.9,XMZ,2,XMC,0)="In the message:"
+10 SET XMC=XMC+1
+11 ; Subj: / [#]
SET ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34536,$$SUBJ^XMXUTIL2(XMHDR("REC")))_" "_$$EZBLD^DIALOG(34537,XMHDR("XMZ"))
+12 SET XMC=XMC+1
+13 ; From: |1| (Sender: |1|)
SET ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34538,$$FROM^XMXUTIL2(XMHDR("REC")))_$SELECT($PIECE(XMHDR("REC"),U,4)="":"",1:" "_$$EZBLD^DIALOG(34533,$$NAME^XMXUTIL($PIECE(XMHDR("REC"),U,4))))
+14 SET XMC=XMC+1
+15 ; Sent: |1|
SET ^XMB(3.9,XMZ,2,XMC,0)=">"_$$EZBLD^DIALOG(34585,$$MMDT^XMXUTIL1($PIECE(XMHDR("REC"),U,3)))
End DoDot:1
+16 SET XMC=XMC+1
+17 SET XMPARM(1)=$$MMDT^XMXUTIL1(XMDT)
+18 ; Response #|1| / Original message
SET XMPARM(2)=$SELECT(XMRESP:$$EZBLD^DIALOG(34204,XMRESP),1:$$EZBLD^DIALOG(34205))
+19 SET XMPARM(3)=XMFROM
+20 ; On |1| (|2|) |3| wrote:
SET ^XMB(3.9,XMZ,2,XMC,0)=$$EZBLD^DIALOG(34203,.XMPARM)
+21 SET XMF=.999999
+22 FOR
SET XMF=$ORDER(^XMB(3.9,XMZI,2,XMF))
if XMF=""
QUIT
Begin DoDot:1
+23 SET XMC=XMC+1
+24 if XMC#50=0
WRITE "."
+25 SET ^XMB(3.9,XMZ,2,XMC,0)=$EXTRACT(">"_^XMB(3.9,XMZI,2,XMF,0),1,254)
End DoDot:1
+26 QUIT