VistA-WorldVistAEHR/r/MAILMAN-XM/XMJMOI.m

250 lines
8.3 KiB
Mathematica
Raw Normal View History

2009-11-29 13:37:14 -05:00
XMJMOI ;ISC-SF/GMB-Options at Ignore prompt ;03/20/2003 09:28
;;8.0;MailMan;**15**;Jun 28, 2002
; Replaces ^XMA1,^XMA10 (ISC-WASH/CAP/THM)
READMSG(XMNEWS,XMDUZ,XMK,XMKN,XMZ,XMABORT) ;
N XMFINISH,XMFROM,XMINSTR,XMRESTR,XMIEN,XMSUBJ,XMSETPRI,XMRESPSO,XMRESP,XMORIGN8,XMDIR,XMY,XMOPT,XMOX
D INIT^XMJMOI1(XMDUZ,XMZ,.XMSUBJ,.XMFROM,.XMORIGN8,.XMINSTR,.XMRESTR,.XMIEN,.XMRESPSO,.XMRESP)
S (XMFINISH,XMABORT)=0
F D Q:XMFINISH!XMABORT
. N XMNAME,XMEDITOK
. D CHKBSKT(XMDUZ,XMZ,.XMK,.XMKN)
. D READSET^XMJMOI1(XMDUZ,XMK,XMKN,XMZ,XMFROM,XMORIGN8,.XMINSTR,XMIEN,.XMDIR,.XMOPT,.XMOX)
. I XMIEN,'$D(XMOPT("B","?")) D CHKRESP^XMJMP(XMDUZ,XMZ,XMRESPSO,XMRESP)
. D XMDIR^XMJDIR(.XMDIR,.XMOPT,.XMOX,.XMY,.XMABORT)
. S XMEDITOK='$D(XMOPT("E","?")) ; Used in 'forward'
. K XMDIR,XMOPT,XMOX
. Q:XMABORT
. D CHKBSKT(XMDUZ,XMZ,.XMK,.XMKN)
. D @XMY
D:XMINSTR("FLAGS")["P" PRIORITY^XMJMOI1
I XMINSTR("FLAGS")["N" D Q
. I XMNEWS D Q
. . I $D(^XTMP("XM","MAKENEW",XMDUZ,XMZ)),$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) D NONEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
. D MAKENEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
;I 'XMABORT,$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)
I 'XMABORT,$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) D NONEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
I XMABORT,XMNEWS,'$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) S ^XTMP("XM","MAKENEW",XMDUZ,XMZ)=""
Q
CHKBSKT(XMDUZ,XMZ,XMK,XMKN) ; Is the message still where we think it is?
I XMK,'$D(^XMB(3.7,"M",XMZ,XMDUZ,XMK)) D RESETXMK^XMJMOI1(XMDUZ,XMZ,.XMK,.XMKN) Q
I 'XMK,$D(^XMB(3.7,"M",XMZ,XMDUZ)) D RESETXMK^XMJMOI1(XMDUZ,XMZ,.XMK,.XMKN)
Q
A ; Answer to sender only
I '$$GOTNS^XMVVITA(XMDUZ) D Q:'$$GOTNS^XMVVITA(XMDUZ)
. W !!,$$EZBLD^DIALOG(37401.1) ; You must have a Network Signature to Answer a message.
. D CRE8NS^XMVVITA
D ANSWER^XMJMA(XMDUZ,XMZ,XMSUBJ,XMFROM)
D IMBACK^XMJMOI1(34070) ; Finished with 'Answer' command.
Q
AA ; Access Attachments
N XMAPBLOB
I $G(IOT)="IMPC" D BLOB^XMAPBLOB Q
D NODISP^XMAPBLOB
Q
B ; Backup
D BACKUP^XMJMP(XMDUZ,XMK,XMKN,XMZ)
S XMRESP=$P($G(^XMB(3.9,XMZ,1,XMIEN,0)),U,2)
Q
BR ; Print to the Browser
D PRINT(1,1)
Q
C ; Copy
D COPY^XMJMC(XMDUZ,XMK,XMZ,XMFROM)
D IMBACK^XMJMOI1(34071) ; Finished with 'Copy' command.
Q
D ; Delete
D DEL^XMXMSGS2(XMDUZ,XMK,XMZ)
W !,$$EZBLD^DIALOG(34302.2) ; Message deleted.
S XMFINISH=1
Q:XMINSTR("FLAGS")'["N"
S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"N")
K:XMNEWS ^XTMP("XM","MAKENEW",XMDUZ,XMZ)
Q
E ; Edit
D EDIT^XMJMOIE(XMDUZ,XMK,XMZ,.XMSUBJ,.XMINSTR,.XMRESTR)
Q
F ; Forward
N XMABORT
D GETRESTR^XMJMOI1(XMDUZ,XMZ,"",.XMINSTR,.XMRESTR)
S XMABORT=0
D INIT^XMXADDR
D TOWHOM^XMJMT(XMDUZ,$$EZBLD^DIALOG(34111),.XMINSTR,.XMRESTR,.XMABORT) ; Find out to whom to forward
I 'XMABORT D
. I XMEDITOK,'$D(XMINSTR("VAPOR")),$$BCAST^XMJMSO D I XMABORT W !,$$EZBLD^DIALOG(34309.4) Q ; Message not forwarded.
. . I '$$QVAPOR^XMJMSO S:$D(DTOUT)!$D(DUOUT) XMABORT=1 Q
. . D V^XMJMOIE I $D(DTOUT)!$D(DUOUT) S XMABORT=1
. D FWD^XMKP(XMDUZ,XMZ,.XMINSTR)
. W !,$$EZBLD^DIALOG(34309.2) ; Message forwarded.
D CLEANUP^XMXADDR
Q
H ; Headerless Print
D PRINT(0)
Q
HG ; Help:Group Information
D HELP^XMHIG
Q
HU ; Help:User Information
D HELP^XMHIU
Q
I ; Ignore
S XMFINISH=1
Q
IN ; Information Only toggle
I $G(XMINSTR("FLAGS"))["I" D
. S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"I")
. S $P(^XMB(3.9,XMZ,0),U,12)=""
. W !,$$EZBLD^DIALOG(37409.9) ; Message is no longer 'Information only'.
E D
. S XMINSTR("FLAGS")=$G(XMINSTR("FLAGS"))_"I"
. S $P(^XMB(3.9,XMZ,0),U,12)="y"
. W !,$$EZBLD^DIALOG(37408.9) ; Message is now 'Information only'. No one may reply.
Q
K ; Toggle Priority of future replies
I $G(XMINSTR("FLAGS"))["K" D
. S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"K")
. S $P(^XMB(3.9,XMZ,1,XMIEN,0),U,9)=1
. W !,$$EZBLD^DIALOG(37412.9) ; Responses will not be delivered as Priority Mail.
E D
. S XMINSTR("FLAGS")=$G(XMINSTR("FLAGS"))_"K"
. S $P(^XMB(3.9,XMZ,1,XMIEN,0),U,9)=""
. W !,$$EZBLD^DIALOG(37411.9) ; Responses will be delivered as Priority Mail.
S XMSETPRI=1
Q
L ; Later
D LATER^XMJMD(XMDUZ,XMZ)
Q
N ; Toggle New
I XMINSTR("FLAGS")["N" D
. S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"N")
. K:XMNEWS ^XTMP("XM","MAKENEW",XMDUZ,XMZ)
. W !,$$EZBLD^DIALOG(37415.9) ; Message will NOT be new next time.
E D
. S XMINSTR("FLAGS")=XMINSTR("FLAGS")_"N"
. S:XMNEWS ^XTMP("XM","MAKENEW",XMDUZ,XMZ)=""
. W !,$$EZBLD^DIALOG(37414.9) ; Message will be new next time.
. I XMK>.5!XMNEWS Q
. D SAVEMSG(XMDUZ,.XMK,.XMKN,XMZ,XMSUBJ,XMFROM,$G(XMINSTR("RCPT BSKT")))
Q
P ; Print
D PRINT(1)
Q
PRINT(XMPRTHDR,XMBROWSE) ;
N XMABORT
S XMABORT=0
I '$G(XMBROWSE),XMINSTR("TYPE")["K"!(XMINSTR("TYPE")["X") D Q:XMABORT
. N DIR,XMMSG,XMPARM
. S XMMSG=$$EZBLD^DIALOG($S(XMINSTR("TYPE")["K":34076,1:34077)) ; KIDS build / PackMan message
. D BLD^DIALOG(34078,XMMSG,"","DIR(""A"")") ; Print just the descriptive text of this _XMMSG
. ;This is a _XMMSG_.
. ;Answer YES to print just the descriptive text.
. ;Answer NO to print the whole thing (x lines) and/or any responses.
. S XMPARM(1)=XMMSG,XMPARM(2)=$$LINE^XMXUTIL2(XMZ)
. D BLD^DIALOG(34079,.XMPARM,"","DIR(""?"")") ; Print just the descriptive text of this _XMMSG
. S DIR(0)="Y",DIR("B")=$$EZBLD^DIALOG(39054) ; Yes
. D ^DIR I $D(DIRUT) S XMABORT=1 Q
. Q:'Y
. N A,DIE,DIF,X,XCF,XCN,XMR
. S XMR=^XMB(3.9,XMZ,0)
. D XT^XMP2
. S XMABORT=1
D PRINT^XMJMP(XMDUZ,XMK,XMZ,XMPRTHDR,.XMBROWSE)
S XMRESP=$P($G(^XMB(3.9,XMZ,1,XMIEN,0)),U,2)
Q
Q ; Query
D Q^XMJMQ(XMDUZ,XMK,XMKN,XMZ)
Q
QC ; Query Current
D QX^XMJMQ(XMDUZ,XMK,XMKN,XMZ,"QC")
Q
QD ; Query Detailed
I $D(XMNAME) D QNAMEX^XMJMQ(XMDUZ,XMK,XMKN,XMZ,XMNAME) Q
D QD^XMJMQ(XMDUZ,XMK,XMKN,XMZ)
Q
QN ; Query Network
D QN^XMJMQ(XMDUZ,XMK,XMKN,XMZ)
Q
QNC ; Query Not Current
D QX^XMJMQ(XMDUZ,XMK,XMKN,XMZ,"QNC")
Q
QT ; Query Terminated
D QX^XMJMQ(XMDUZ,XMK,XMKN,XMZ,"QT")
Q
RI ; Reply, Include previous response(s)
R ; Reply
N XMINCL
S XMINCL=(XMY="RI")
I $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)
D REPLY^XMJMR(XMDUZ,.XMK,.XMKN,XMZ,XMSUBJ,XMFROM,.XMINSTR,XMIEN,XMRESPSO,XMINCL,.XMRESP)
Q
S ; Save (replaces S^XMA1B)
N XMKTO,XMDIC
I XMK,XMK'=.5 S XMDIC("B")="@" ; no default basket
E D
. N XMKTO
. S XMKTO=0
. D CHEKBSKT^XMTDL2(XMDUZ,.XMKTO,XMSUBJ,XMFROM,$G(XMINSTR("RCPT BSKT")))
. S XMDIC("B")=$P(^XMB(3.7,XMDUZ,2,XMKTO,0),U)
D SELBSKT^XMJBU(XMDUZ,$$EZBLD^DIALOG(34325.1),"L",.XMDIC,.XMKTO) Q:XMKTO=U ; Save message into basket:
D CHKBSKT(XMDUZ,XMZ,.XMK,.XMKN)
I XMKTO=XMK D
. W !,$$EZBLD^DIALOG(34326.1) ; That's the same basket the message is already in.
E D
. I $D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)) D NONEW^XMXUTIL(XMDUZ,XMK,XMZ,1)
. D MOVEIT^XMXMSGS2(XMDUZ,XMK,XMZ,XMKTO)
. W !,$$EZBLD^DIALOG(34324.2) ; Message saved.
. S XMK=XMKTO
S XMFINISH=1
Q
T ; Terminate (replaces T^XMA1)
D TERM^XMXMSGS2(XMDUZ,XMK,XMZ)
W !,$$EZBLD^DIALOG($S(XMK<1:34331.1,1:34331)) ; You won't see future replies. (In WASTE basket)
S XMFINISH=1
S:XMINSTR("FLAGS")["P" XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"P")
Q:XMINSTR("FLAGS")'["N"
S XMINSTR("FLAGS")=$TR(XMINSTR("FLAGS"),"N")
K:XMNEWS ^XTMP("XM","MAKENEW",XMDUZ,XMZ)
Q
V ; Set Vaporize date for msg in basket (replaces DATE^XMA11A)
N DIE,DA,DR
L +^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0):1
S DIE="^XMB(3.7,"_XMDUZ_",2,"_XMK_",1,"
S DA(2)=XMDUZ,DA(1)=XMK,DA=XMZ
S DR=5
D ^DIE
L -^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)
Q
W ; Write a new msg
N XMSECURE,XMPAKMAN,XMSECBAD ; Needed! (In case Write from KIDS msg.)
D SEND^XMJMS
D IMBACK^XMJMOI1(34072) ; Finished with 'Write' command.
Q
X ; Xtract PackMan msg
I XMDUZ=.5,XMK>999 G XP
N X,DIC,C,I,ER,J,K,T,X2,XCF,XCM,XCN,XMLOC,XMN,XMP0,XMR,XMS
S X=XMZ,DIC(0)="N"
D MM^XMP
Q
XP ; Xmit Priority Toggle (for remote transmit queues only)
N XMTPRI,XMABORT
S XMABORT=0
D ASKPRI^XMJMORX(.XMTPRI,.XMABORT) Q:XMABORT
D XP^XMXMSGS1(XMDUZ,XMK,XMZ,XMTPRI)
Q
SAVEMSG(XMDUZ,XMK,XMKN,XMZ,XMSUBJ,XMFROM,XMZBSKT) ;
; The message is currently in the waste basket or no basket.
; Save it to an appropriate (not waste) basket.
N XMKTO
S XMKTO=0
D CHEKBSKT^XMTDL2(XMDUZ,.XMKTO,XMSUBJ,XMFROM,$G(XMINSTR("RCPT BSKT")))
S:XMKTO=.5 XMKTO=1
S XMKN=$P(^XMB(3.7,XMDUZ,2,XMKTO,0),U,1)
I 'XMK D
. D PUTMSG^XMXMSGS2(XMDUZ,XMKTO,XMKN,XMZ)
E D
. ; Message is in waste basket
. D COPYIT^XMXMSGS2(XMDUZ,.5,XMZ,XMKTO)
. D ZAPIT^XMXMSGS2(XMDUZ,.5,XMZ)
S XMK=XMKTO
W !,$$EZBLD^DIALOG(34325.9,XMKN) ; Message saved to _XMKN_ basket.
Q