Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMJML

XMJML.m

Go to the documentation of this file.
XMJML ;ISC-SF/GMB-List messages in basket (can't read) ;04/17/2002  10:03
 ;;8.0;MailMan;;Jun 28, 2002
 ; Replaces 1^XMAL0 (ISC-WASH/THM/CAP)
LIST(XMDUZ,XMK,XMKN,XMKZ,XMDETAIL) ; List messages in one basket
 ; (This routine does NOT let the user read the messages.)
 ; XMDETAIL 0=Summary; 1=Detailed
 N XMLEN,XMORDER,XMHDLINE,XMABORT
 I XMDUZ=.5,XMK>999 S XMORDER=XMV("ORDER"),XMV("ORDER")=1
 S XMABORT=0
 D INIT(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN,1)
 S XMHDLINE=$$HEADLINE(XMDUZ,XMK,XMKN)
 D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 S:XMKZ'="" XMKZ=XMKZ-XMV("ORDER")
 F  S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ),XMV("ORDER")) Q:XMKZ=""  D  Q:XMABORT
 . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,""))
 . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITC^XMUT4A(XMDUZ,XMK,XMZ,XMKZ)
 . I '$D(^XMB(3.9,XMZ,0)) D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q
 . I $Y+4>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT  D
 . . D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 . D LISTMSG(XMK,XMKN,XMKZ,XMZ,XMDETAIL,.XMLEN)
 I $D(XMORDER) S XMV("ORDER")=XMORDER
 Q
LISTNEW(XMDUZ,XMK,XMKN) ; List new messages in one basket
 ; (This routine does NOT let the user read the messages.)
 ; XMDETAIL 0=Summary; 1=Detailed
 I '$O(^XMB(3.7,XMDUZ,"N0",XMK,0)) D  Q
 . I $P(^XMB(3.7,XMDUZ,2,XMK,0),U,2) S $P(^(0),U,2)=0
 . W !!,$C(7),$$EZBLD^DIALOG(34013),! ;No NEW messages
 N XMKZ,XMZ,XMLEN,XMDETAIL,XMTYPE,XMHDLINE,XMABORT
 S XMDETAIL=1,XMTYPE="N0",XMABORT=0
 D INIT(XMDUZ,XMK,XMKN,XMDETAIL,.XMLEN,1)
 S XMHDLINE=$$HEADLINE^XMJMLN(XMDUZ,0,XMK,XMKN,XMTYPE)
 D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 S XMZ=""
 F  S XMZ=$O(^XMB(3.7,XMDUZ,XMTYPE,XMK,XMZ),XMV("ORDER")) Q:XMZ=""  D  Q:XMABORT
 . S XMKZ=$P($G(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)),U,2)
 . I 'XMKZ D
 . . D ADDITN^XMUT4A(XMDUZ,XMTYPE,XMK,XMZ)
 . . S XMKZ=$P($G(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)),U,2)
 . I '$D(^XMB(3.9,XMZ,0)) D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q
 . I $Y+4>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT  D
 . . D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 . D LISTMSG(XMK,XMKN,XMKZ,XMZ,XMDETAIL,.XMLEN)
 Q
LISTPRI(XMDUZ) ; List priority messages in all baskets (Replaces PRIO^XMAL0)
 ; (This routine does NOT let the user read the messages.)
 ; XMDETAIL 0=Summary; 1=Detailed
 N XMK,XMKN,XMKZ,XMZ,XMLEN,XMDETAIL,XMTYPE,XMHDLINE,XMABORT
 S XMDETAIL=1,XMTYPE="N",XMABORT=0
 D INIT^XMJMLN(XMDUZ,XMTYPE,XMDETAIL,1,.XMLEN)
 S XMHDLINE=$$HEADLINE^XMJMLN(XMDUZ,1,"","",XMTYPE)
 D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 S XMK=""
 F  S XMK=$O(^XMB(3.7,XMDUZ,XMTYPE,XMK)) Q:XMK=""  D  Q:XMABORT
 . S XMZ="",XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
 . F  S XMZ=$O(^XMB(3.7,XMDUZ,XMTYPE,XMK,XMZ),XMV("ORDER")) Q:XMZ=""  D  Q:XMABORT
 . . S XMKZ=$P($G(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)),U,2)
 . . I 'XMKZ D
 . . . D ADDITN^XMUT4A(XMDUZ,XMTYPE,XMK,XMZ)
 . . . S XMKZ=$P($G(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)),U,2)
 . . I '$D(^XMB(3.9,XMZ,0)) D ZAPIT^XMXMSGS2(XMDUZ,XMK,XMZ) Q
 . . I $Y+4>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT  D
 . . . D HEADER(XMDETAIL,.XMLEN,XMHDLINE)
 . . D LISTMSG(XMK,XMKN,XMKZ,XMZ,XMDETAIL,.XMLEN)
 Q
INIT(XMDUZ,XMK,XMKN,XMDETAIL,XMLEN,XMONE) ;
 N XMLEFT
 S XMLEFT=79
 I XMDETAIL D
 . S XMLEN("XMZ")=$L($O(^XMB(3.9,":"),-1))+2
 . ;S XMLEN("XMZ")=$L($O(^XMB(3.7,XMDUZ,2,XMK,1,":"),-1))+2
 . S XMLEN("LINE")=5
 . I '$G(XMONE),'$D(XMLEN("BSKT")) S XMLEN("BSKT")=$$MIN^XLFMTH($L(XMKN),10)
 . S XMLEN("RESP")=9
 . S XMLEN("DATE")=$L($$MMDT^XMXUTIL1(DT))
 . S XMLEFT=XMLEFT-XMLEN("XMZ")-XMLEN("LINE")-$G(XMLEN("BSKT"))-XMLEN("RESP")-XMLEN("DATE")-3+$S($G(XMLEN("BSKT")):0,1:1)
 S:'$D(XMLEN("XMKZ")) XMLEN("XMKZ")=$L($O(^XMB(3.7,XMDUZ,2,XMK,1,"C",""),-1))
 S XMLEFT=XMLEFT-XMLEN("XMKZ")-5
 S XMLEN("SUBJ")=XMLEFT*2\3
 S XMLEN("FROM")=XMLEFT-XMLEN("SUBJ")
 Q
LISTMSG(XMK,XMKN,XMKZ,XMZ,XMDETAIL,XMLEN) ;
 N XMZREC
 S XMZREC=$G(^XMB(3.9,XMZ,0))
 I XMDUZ=.5,XMK>999 D
 . N XMTPRI ; Transmit priority
 . S XMTPRI=$P($G(^XMB(3.7,.5,2,XMK,1,XMZ,0)),U,6)
 . W !,$S($D(^TMP("XM",$J,".",XMKZ)):">",1:" "),$S('XMTPRI:" ",XMTPRI=1:"^",1:"v"),$J(XMKZ,XMLEN("XMKZ")),". "
 E  W !,$S($D(^TMP("XM",$J,".",XMKZ)):">",1:" "),$S('$D(^XMB(3.7,XMDUZ,"N0",XMK,XMZ)):" ",$P(XMZREC,U,7)["P":"!",1:"*"),$J(XMKZ,XMLEN("XMKZ")),". "
 I XMDETAIL D
 . W:$D(XMLEN("BSKT")) $$LJ^XLFSTR($E(XMKN,1,XMLEN("BSKT")),XMLEN("BSKT"))," "
 . W $J("["_XMZ_"]",XMLEN("XMZ"))," ",$$DATE^XMXUTIL2(XMZREC,0)
 . W " ",$$MELD^XMXUTIL1($$SUBJ^XMXUTIL2(XMZREC),$$LINES(XMZ),XMLEN("SUBJ")+XMLEN("LINE"))
 . W " ",$$MELD^XMXUTIL1($$NAME^XMXUTIL($P(XMZREC,U,2)),$$RESPONSE(XMDUZ,XMK,XMZ),XMLEN("FROM")+9)
 E  D
 . W $$LJ^XLFSTR($E($$SUBJ^XMXUTIL2(XMZREC),1,XMLEN("SUBJ")),XMLEN("SUBJ"))," ",$E($$NAME^XMXUTIL($P(XMZREC,U,2)),1,XMLEN("FROM"))
 Q
HEADLINE(XMDUZ,XMK,XMKN) ;
 N XMNEWCNT,XMCNT
 S XMNEWCNT=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,2)
 S XMCNT=$P(^XMB(3.7,XMDUZ,2,XMK,1,0),U,4)
 ;Basket / messages / message / new
 Q XMKN_" "_$$EZBLD^DIALOG(34011)_", "_XMCNT_$S(XMCNT>1:$$EZBLD^DIALOG(34007.1)_" ("_$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",0))_"-"_$O(^(""),-1)_")",1:$$EZBLD^DIALOG(34007))_$S(XMNEWCNT:", "_XMNEWCNT_$$EZBLD^DIALOG(34008),1:"")
 I $D(XMHDLINE) W @IOF,XMHDLINE,!
 E  W @IOF
 I XMDETAIL D
 . W $$LJ^XLFSTR($$EZBLD^DIALOG(34001),XMLEN("XMZ")+$G(XMLEN("BSKT"),-1)+XMLEN("XMKZ")+XMLEN("DATE")+7,".") ;*=New/!=Priority
 . W $$COMBO($$EZBLD^DIALOG(34002),$$EZBLD^DIALOG(34003.1),XMLEN("SUBJ")+XMLEN("LINE")) ;Subject / Lines
 . W "."
 . W $$COMBO($$EZBLD^DIALOG(34006),$$EZBLD^DIALOG(34004),XMLEN("FROM")+XMLEN("RESP")) ;From / Read/Rcvd
 E  D
 . W $$LJ^XLFSTR($$EZBLD^DIALOG(34005),79-XMLEN("FROM"),"."),$$LJ^XLFSTR($$EZBLD^DIALOG(34006),XMLEN("FROM"),".") ;*=New/!=Priority.......Subject / From
 Q
COMBO(XMSTR1,XMSTR2,XMLEN) ;
 Q $$LJ^XLFSTR($E(XMSTR1,1,XMLEN-$L(XMSTR2)-1),XMLEN-$L(XMSTR2),".")_XMSTR2
LINES(XMZ) ;
 Q +$P($G(^XMB(3.9,XMZ,2,0)),U,4)
RESPONSE(XMDUZ,XMK,XMZ) ;
 I XMDUZ=.5,XMK>999 Q ""
 N XMPTR,XMRESP,XMRESPS
 S XMRESPS=+$P($G(^XMB(3.9,XMZ,3,0)),U,4)
 I XMRESPS=0 Q ""
 ;S XMPTR=$O(^XMB(3.9,XMZ,1,"C",$S(XMDUZ=.6:DUZ,1:XMDUZ),0))
 S XMPTR=+$O(^XMB(3.9,XMZ,1,"C",XMDUZ,0))
 S XMRESP=+$P($G(^XMB(3.9,XMZ,1,XMPTR,0)),U,2)
 Q XMRESP_"/"_XMRESPS
LISTTMP ; List messages in ^TMP global
 ; (This routine does NOT let the user read the messages.)
 ; The following variables are expected to exist:
 ; XMDETAIL 0=Summary; 1=Detailed
 ; XMLEN
 N XMK,XMKN,XMKZ,XMZ,XMABORT,XMREC
 S XMABORT=0
 D HEADER(XMDETAIL,.XMLEN)
 S XMKZ=0
 F  S XMKZ=$O(^TMP("XM",$J,"MSG",XMKZ)) Q:XMKZ=""  D  Q:XMABORT
 . I $Y+4>IOSL D PAGE^XMXUTIL(.XMABORT) Q:XMABORT  D
 . . D HEADER(XMDETAIL,.XMLEN)
 . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
 . S XMK=$P(XMREC,U,1),XMKN=$P(XMREC,U,2),XMZ=$P(XMREC,U,3)
 . D LISTMSG(XMK,XMKN,XMKZ,XMZ,XMDETAIL,.XMLEN)
 Q