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

XMJMORX1.m

Go to the documentation of this file.
XMJMORX1 ;ISC-SF/GMB-^XMJMORX (cont.) ;09/16/2002  11:16
 ;;8.0;MailMan;**5**;Jun 28, 2002
 ;DELMSG(XMDUZ,XMK,XMKZ,XMZ,XMCNT)
XDEL ;
 Q:'XMK
 K XMERR,^TMP("XMERR",$J)
 D DEL^XMXMSGS2(XMDUZ,XMK,XMZ,.XMCNT)
 I $D(XMERR) D ZSHOW^XMJERR Q
 I XMKALL,$G(XMTYPE)'["N" D  Q
 . S ^TMP("XM",$J,"MSG",XMKZ)=$S(XMK'=.5:".5^"_$$EZBLD^DIALOG(37004),1:"0^"_$$EZBLD^DIALOG(34014))_U_XMZ ; "WASTE" / "* N/A *"
 K:XMTMP ^TMP("XM",$J,"MSG",XMKZ)
 K:$D(^TMP("XM",$J,".",XMKZ)) ^TMP("XM",$J,".",XMKZ)
 Q
 ;FLTRMSG(XMDUZ,XMK,XMKZ,XMZ,XMCNT)
XFLTR ;
 N XMKN,XMKTO,XMKNTO
 S XMKN=$P(^TMP("XM",$J,"MSG",XMKZ),U,2)
 D FLTR^XMXMSGS2(XMDUZ,XMK,XMKN,XMZ,.XMCNT,.XMKTO,.XMKNTO)
 I $D(XMERR) D ZSHOW^XMJERR Q
 I XMKALL D  Q
 . S:XMKN'=XMKNTO ^TMP("XM",$J,"MSG",XMKZ)=XMKTO_U_XMKNTO_U_XMZ
 Q:XMKN=XMKNTO
 K ^TMP("XM",$J,"MSG",XMKZ)
 K:$D(^TMP("XM",$J,".",XMKZ)) ^TMP("XM",$J,".",XMKZ)
 Q
 ;NTOGLMSG(XMDUZ,XMK,XMKZ,XMZ,XMCNT)
XNTOGL ;
 N XMKN,XMKTO,XMKNTO
 S XMKN=$P(^TMP("XM",$J,"MSG",XMKZ),U,2)
 D NTOGL^XMXMSGS2(XMDUZ,X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)=XMZ Q
 . I $L(XMZLIST(J))+$L(XMZ)>240 S J=J+1,XMZLIST(J)=XMZ Q
 . S XMZLIST(J)=XMZLIST(J)_","_XMZ
 Q
LIST(XMWHICH,XMZLIST) ;
 N I,J,XMRANGE,XMKZ,XMZ
 S J=0
 F I=1:1:$L(XMWHICH,",") D
 . S XMRANGE=$P(XMWHICH,",",I)
 . Q:'XMRANGE
 . F XMKZ=$P(XMRANGE,"-",1):1:$S(XMRANGE["-":$P(XMRANGE,"-",2),1:XMRANGE) D
 . . S XMZ=$P($G(^TMP("XM",$J,"MSG",XMKZ)),U,3) Q:'XMZ
 . . I J=0 S J=1,XMZLIST(1)=XMZ Q
 . . I $L(XMZLIST(J))+$L(XMZ)>240 S J=J+1,XMZLIST(J)=XMZ Q
 . . S XMZLIST(J)=XMZLIST(J)_","_XMZ
 Q
ACTWHICH(XMDUZ,XMTMP,XMKALL,XMK,XMRTN,XMPROMPT,XMSUM,XMCONFRM,XMMSG,XMABORT) ;,XMKTO)
 N XMWHICH
 D WHICH(XMPROMPT,XMCONFRM,.XMWHICH,.XMABORT) Q:XMABORT
 D ACTMSG(XMDUZ,XMTMP,XMKALL,XMK,XMWHICH,XMRTN,XMSUM,.XMMSG)
 Q
WHICH(XMPROMPT,XMCONFRM,XMWHICH,XMABORT) ;
 N DIR,Y,XMHI,XMLO
 S XMLO=$O(^TMP("XM",$J,"MSG",""))
 S XMHI=$O(^TMP("XM",$J,"MSG",""),-1)
 S DIR("A")=$$EZBLD^DIALOG(XMPROMPT) ; ... which messages?
 S DIR("??")="XM-U-M-CHOOSE RANGE"
 S DIR(0)="LC^"_XMLO_":"_XMHI
 D ^DIR I $D(DIRUT) S XMABORT=1 Q
 S XMWHICH=Y
 I XMCONFRM D CONFIRM^XMJMOR(XMCONFRM,.XMABORT)
 Q
ACTMSG(XMDUZ,XMTMP,XMKALL,XMK,XMKZA,XMRTN,XMSUM,XMMSG) ;,XMKTO)
 ; XMKZA    Array of msg numbers  DEL("1-3,7,11-15")
 ; XMKZL    List of msg numbers   1-3,7,11-15
 ;          (It is OK if the list ends with a comma)
 ; XMKZR    Range of msg numbers  1-3
 ; XMKZ1    First number in range 1
 ; XMKZN    Last number in range  3
 N XMKZ,XMREC,XMKZL,XMKZR,XMI,XMKZ1,XMKZN,XMZ,XMCNT,XMPIECES
 S XMCNT=0
 ; is this an array or a variable?
 I $G(XMKZA)]"",$O(XMKZA(""))="" S XMKZA(XMKZA)=""
 S XMKZL=""
 F  S XMKZL=$O(XMKZA(XMKZL)) Q:XMKZL=""  D
 . S XMPIECES=$L(XMKZL,",")
 . S:'$P(XMKZL,",",XMPIECES) XMPIECES=XMPIECES-1
 . F XMI=1:1:XMPIECES D
 . . S XMKZR=$P(XMKZL,",",XMI)
 . . I XMKZR["-" D  Q
 . . . ; deal with a range of msg #s
 . . . S XMKZ1=$P(XMKZR,"-",1)
 . . . S XMKZN=$P(XMKZR,"-",2)
 . . . S XMKZ=XMKZ1-.1
 . . . I XMTMP D  Q
 . . . . F  S XMKZ=$O(^TMP("XM",$J,"MSG",XMKZ)) Q:XMKZ>XMKZN!'XMKZ  D
 . . . . . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
 . . . . . S:XMKALL XMK=$P(XMREC,U,1)
 . . . . . S XMZ=$P(XMREC,U,3) Q:'XMZ
 . . . . . D @XMRTN ;(XMDUZ,XMK,XMZ)
 . . . F  S XMKZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ)) Q:XMKZ>XMKZN!'XMKZ  D
 . . . . S XMZ=$O(^XMB(3.7,XMDUZ,2,XMK,1,"C",XMKZ,0)) Q:'XMZ
 . . . . D @XMRTN ;(XMDUZ,XMK,XMZ)
 . . S XMKZ=XMKZR
 . . I XMTMP D  Q
 . . . S XMREC=$G(^TMP("XM",$J,"MSG",XMKZ))
 . . . I XMREC="" S XMZ=0 Q
 . . . S:XMKALL XMK=$P(XMREC,U,1)
 . . . S XMZ=$P(XMREC,U,3) Q:'XMZ
 . . .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