137 lines
6.0 KiB
Mathematica
137 lines
6.0 KiB
Mathematica
XMJMFC ;ISC-SF/GMB-Find message in file 3.9 ;07/12/2002 10:34
|
|
;;8.0;MailMan;;Jun 28, 2002
|
|
; Search for messages in the MESSAGE file
|
|
FIND(XMDUZ,XMF,XMWAIT) ;
|
|
I $G(XMF("FLAGS"))["U",'$$SSPRIV^XMXSEC1 D Q
|
|
. D SHOW^XMJERR
|
|
. D WAIT^XMXUTIL
|
|
N XMKZ,XMCNT,XMABORT,XMLEN,XMFIRST,XMPAGE,XMDETAIL,XMPMAX,XMMORE,XMFLAGS,XMSCREEN,XMFROM,XMZOOM,XMCD,XMOPT,XMOX,XMSAVE
|
|
S XMSAVE("FDATE")=XMF("FDATE") K XMF("FDATE")
|
|
S XMSAVE("TDATE")=XMF("TDATE") K XMF("TDATE")
|
|
K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
|
|
S (XMKZ,XMZ,XMPAGE,XMCNT,XMZOOM,XMCD,XMABORT)=0,(XMDETAIL,XMMORE)=1,XMPMAX=IOSL-3
|
|
D SRCHINIT(XMDUZ,.XMF,.XMFLAGS,.XMSCREEN,.XMFROM,.XMABORT) Q:XMABORT
|
|
D INIT(XMDUZ,XMFLAGS,XMDETAIL,.XMLEN)
|
|
D SETOPT^XMJMLR1(XMDUZ,$S(XMFLAGS["U":"!",1:0),.XMOPT,.XMOX)
|
|
F D Q:XMABORT
|
|
. I XMCD S XMCD=0,XMDETAIL='XMDETAIL D INIT(XMDUZ,XMFLAGS,XMDETAIL,.XMLEN)
|
|
. D DISPLAY(XMDUZ,.XMF,XMFLAGS,XMSCREEN,.XMFROM,XMDETAIL,.XMKZ,.XMCNT,.XMFIRST,.XMPAGE,.XMMORE,.XMLEN,XMZOOM,XMPMAX)
|
|
. I XMCNT=0 S XMABORT=1 Q
|
|
. D CHOOSE^XMJMLN(XMDUZ,1,0,.XMKZ,.XMFIRST,.XMPAGE,XMMORE,.XMLEN,.XMZOOM,.XMOPT,.XMOX,"READMSG^XMJMFC",.XMABORT)
|
|
. S:'$D(^TMP("XM",$J,"MSG")) XMABORT=1
|
|
I XMCNT=0 D
|
|
. W $$EZBLD^DIALOG(34401) ; No matches found.
|
|
. Q:'$G(XMWAIT)
|
|
. W ! D WAIT^XMXUTIL
|
|
K ^TMP("XM",$J,"MSG"),^TMP("XM",$J,".")
|
|
S XMF("FDATE")=XMSAVE("FDATE"),XMF("TDATE")=XMSAVE("TDATE")
|
|
Q
|
|
INIT(XMDUZ,XMFLAGS,XMDETAIL,XMLEN) ;
|
|
I XMFLAGS'["U" S XMLEN("BSKT")=10
|
|
S XMLEN("XMKZ")=3
|
|
D INIT^XMJML(XMDUZ,"","",XMDETAIL,.XMLEN,XMFLAGS["U")
|
|
Q
|
|
SRCHINIT(XMDUZ,XMF,XMFLAGS,XMSCREEN,XMFROM,XMABORT) ;
|
|
I XMV("ORDER")=-1 D
|
|
. S XMFLAGS="B"
|
|
. S XMFROM=$O(^XMB(3.9,"C",XMSAVE("TDATE")))
|
|
E D
|
|
. S XMFLAGS=""
|
|
. S XMFROM=$O(^XMB(3.9,"C",XMSAVE("FDATE")),-1)
|
|
S XMFLAGS=$S(XMV("ORDER")=-1:"B",1:"")
|
|
I $G(XMF("FLAGS"))["U" D Q:XMABORT
|
|
. S XMFLAGS=XMFLAGS_"U" ; Ignore file screen
|
|
. D AUDIT(.XMF)
|
|
. Q:'$D(XMERR)
|
|
. S XMABORT=1
|
|
. D SHOW^XMJERR
|
|
. D WAIT^XMXUTIL
|
|
S:$D(XMF("SUBJ")) XMF("SUBJ","S")=$$UP^XLFSTR(XMF("SUBJ"))
|
|
S:$D(XMF("TEXT")) XMF("TEXT","S")=$S('XMF("TEXT","C"):$$UP^XLFSTR(XMF("TEXT")),1:XMF("TEXT"))
|
|
S XMSCREEN=$$SCREEN(XMDUZ)
|
|
Q
|
|
AUDIT(XMF) ; Send a bulletin to G.XM SUPER SEARCH
|
|
N XMINSTR,XMPARM,XMTEXT,I
|
|
I '$$GOTLOCAL^XMXAPIG("XM SUPER SEARCH",90,2) D ERRSET^XMXUTIL(34413.6) Q
|
|
S XMINSTR("FROM")=.5
|
|
S XMPARM(1)=XMV("DUZ NAME")
|
|
S I=1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34443)_":",30)_$$FMTE^XLFDT(XMSAVE("FDATE"))_" - "_$$FMTE^XLFDT(XMSAVE("TDATE")) ; Search period
|
|
I $D(XMF("SUBJ")) D ; Subject contains
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34438)_":",30)_XMF("SUBJ")
|
|
I $D(XMF("FROM")) D ; Message from
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34440)_":",30)_$$NAME^XMXUTIL(XMF("FROM"))
|
|
I $D(XMF("TO")) D ; Message to
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34440.2)_":",30)_XMF("TO")
|
|
I $D(XMF("FLINE")) D ; Lines of text, minimum
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34449)_":",30)_XMF("FLINE")
|
|
;I $D(XMF("TLINE")) D ; Lines of text, maximum
|
|
;. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34450)_":",30)_XMF("TLINE")
|
|
I $D(XMF("RFROM")) D ; Response from
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34440.1)_":",30)_$$NAME^XMXUTIL(XMF("RFROM"))
|
|
I $D(XMF("TEXT")) D
|
|
. ; x.1:Message / x.2:Message or Response / x.3:Response contains
|
|
. S I=I+1,XMTEXT(I)=$$LJ^XLFSTR($$EZBLD^DIALOG(34446+(XMF("TEXT","L")/10))_":",30)_XMF("TEXT")
|
|
D SENDBULL^XMXBULL(DUZ,"XM SUPER SEARCH",.XMPARM,"XMTEXT","G.XM SUPER SEARCH",.XMINSTR)
|
|
I $D(XMERR) D ERRSET^XMXUTIL(34413.6)
|
|
Q
|
|
SCREEN(XMDUZ) ;
|
|
S XMSCREEN="N X S X=^(0)"
|
|
I XMDUZ'=.5 D
|
|
. N XMMIN
|
|
. S XMMIN=$P(^XMB(3.7,XMDUZ,0),U,7)
|
|
. ; If minimum date, don't choose lower date unless already in user's bskt
|
|
. I XMMIN>0 S XMSCREEN=" I ^(.6)'<"_XMMIN_"!$D(^XMB(3.7,""M"",Y,XMDUZ))"
|
|
; Msg must not be SPOOL, msg must not be a reply.
|
|
Q XMSCREEN_" I $P(X,U,7)'=""S"",'$P(X,U,8),$P(X,U)'?1""R"".N,$$GOODMSG^XMJMFB(XMDUZ,0,Y,.XMF)"
|
|
DISPLAY(XMDUZ,XMF,XMFLAGS,XMSCREEN,XMFROM,XMDETAIL,XMKZ,XMCNT,XMFIRST,XMPAGE,XMMORE,XMLEN,XMZOOM,XMPMAX) ;
|
|
N XMREC
|
|
S XMFIRST(XMPAGE)=XMKZ
|
|
D HEADER^XMJML(XMDETAIL,.XMLEN,$$EZBLD^DIALOG($S(XMFLAGS["U":34403.5,1:34403))) ; All Messages Super Search / All Messages Search
|
|
I XMZOOM D Q
|
|
. F S XMKZ=$O(^TMP("XM",$J,".",XMKZ)) Q:XMKZ="" D Q:$Y>XMPMAX
|
|
. . S XMREC=^TMP("XM",$J,"MSG",XMKZ)
|
|
. . D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
|
|
F S XMKZ=$O(^TMP("XM",$J,"MSG",XMKZ)) Q:XMKZ="" D Q:$Y>XMPMAX
|
|
. S XMREC=^TMP("XM",$J,"MSG",XMKZ)
|
|
. D LISTMSG^XMJML($P(XMREC,U,1),$P(XMREC,U,2),XMKZ,$P(XMREC,U,3),XMDETAIL,.XMLEN)
|
|
Q:$Y>XMPMAX!'XMMORE
|
|
; File screen ^DD(3.9,0,"SCR") insists that user be author or recipient.
|
|
; If FLAGS["U", then file screen is ignored.
|
|
D LIST^DIC(3.9,"","@",XMFLAGS,XMPMAX-$Y+1,.XMFROM,"","C",XMSCREEN)
|
|
S:$P(^TMP("DILIST",$J,0),U,3)=0 XMMORE=0
|
|
D LISTMSG(XMDUZ,XMDETAIL,.XMCNT,.XMLEN,.XMMORE)
|
|
S XMKZ=XMCNT
|
|
K ^TMP("DILIST",$J)
|
|
W:'XMMORE !,$$EZBLD^DIALOG(34402) ; Search finished.
|
|
Q
|
|
LISTMSG(XMDUZ,XMDETAIL,XMCNT,XMLEN,XMMORE) ; Check and List
|
|
N XMK,XMKN,XMZ,I,XMNA,XMSTOP,XMDATE
|
|
S I="",XMSTOP=0,XMNA=$$EZBLD^DIALOG(34014) ; * N/A *
|
|
I XMFLAGS["U" S XMK=0,XMKN=XMNA
|
|
F S I=$O(^TMP("DILIST",$J,2,I),XMV("ORDER")) Q:I'>0 D Q:XMSTOP
|
|
. S XMCNT=XMCNT+1
|
|
. S XMZ=^TMP("DILIST",$J,2,I)
|
|
. S XMDATE=+$G(^XMB(3.9,XMZ,.6))
|
|
. I XMDATE,XMDATE<XMSAVE("FDATE")!(XMDATE>XMSAVE("TDATE")) D Q
|
|
. . S XMMORE=0,XMSTOP=1
|
|
. I XMFLAGS'["U" D
|
|
. . S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,0))
|
|
. . S XMKN=$S(XMK:$P(^XMB(3.7,XMDUZ,2,XMK,0),U),1:XMNA)
|
|
. . I XMK,'$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITM^XMUT4A(XMDUZ,XMK,XMZ)
|
|
. D LISTMSG^XMJML(XMK,XMKN,XMCNT,XMZ,XMDETAIL,.XMLEN)
|
|
. S ^TMP("XM",$J,"MSG",XMCNT)=XMK_U_XMKN_U_XMZ
|
|
Q
|
|
READMSG ; (XMDUZ,XMKZ,XMREC) <- needed!
|
|
N XMK,XMKN,XMZ,XMRDR ; $G(XMRDR) is checked in READMSG^XMJBM
|
|
I XMFLAGS["U" D
|
|
. S XMK="!",XMKN=$$EZBLD^DIALOG(34014) ; * N/A *
|
|
E D
|
|
. S XMK=$P(XMREC,U,1),XMKN=$P(XMREC,U,2)
|
|
S XMZ=$P(XMREC,U,3)
|
|
D READMSG^XMJBM(XMDUZ,XMK,XMKN,XMZ)
|
|
Q:XMFLAGS["U"
|
|
Q:$D(^XMB(3.7,"M",XMZ,XMDUZ,XMK))
|
|
S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,0))
|
|
S ^TMP("XM",$J,"MSG",XMKZ)=XMK_U_$S(XMK=0:$$EZBLD^DIALOG(34014),1:$P(^XMB(3.7,XMDUZ,2,XMK,0),U))_U_XMZ ; * N/A *
|
|
Q
|