146 lines
4.9 KiB
Mathematica
146 lines
4.9 KiB
Mathematica
FSCRPCN ;SLC/STAFF-NOIS RPC Notifications ;1/13/98 16:01
|
|
;;1.1;NOIS;;Sep 06, 1998
|
|
;
|
|
SIGNUP(IN,OUT) ; from FSCRPX (RPBSignupNotify)
|
|
N CALL,EVENT,LINE,METHOD,USER
|
|
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
|
|
S CALL=$P(LINE,U),METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3),USER=$P(LINE,U,4)
|
|
Q:'CALL Q:'$L(METHOD) Q:'$L(EVENT) Q:'USER
|
|
D SETUP^FSCNOT(CALL,,,USER_U_1,METHOD,EVENT)
|
|
Q
|
|
;
|
|
BE(IN,OUT) ; from FSCRPX (RPCBeNotified)
|
|
N CALL,EVENT,LINE,METHOD,NUM
|
|
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
|
|
S METHOD=$P(LINE,U,2),EVENT=$P(LINE,U,3)
|
|
Q:'$L(METHOD) Q:'$L(EVENT)
|
|
I $P(LINE,U) D
|
|
.S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D CALLSET(CALL,METHOD,EVENT)
|
|
E D
|
|
.S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D CALLSET(CALL,METHOD,EVENT)
|
|
Q
|
|
;
|
|
CALLSET(CALL,METHOD,EVENT) ;
|
|
N NUM
|
|
I $D(^FSCD("NOTIFY","ACUSER",CALL,DUZ)) S NUM=+^(DUZ) D Q
|
|
.S $P(^FSCD("NOTIFY",NUM,0),U,5,7)=METHOD_U_EVENT_U_1
|
|
D SETUP^FSCNOT(CALL,,,DUZ_U_1,METHOD,EVENT)
|
|
Q
|
|
;
|
|
FIND(IN,OUT) ; from FSCRPX (RPCFindNotification)
|
|
N LINE,USER
|
|
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
|
|
S USER=$P(LINE,U,2)
|
|
I 'USER Q
|
|
I $P(LINE,U) D ALL(USER)
|
|
E D ONLY(USER)
|
|
Q
|
|
;
|
|
ALL(USER) ;
|
|
N CALL,LNUM
|
|
K ^TMP("FSC LIST",$J),^TMP("FSC CURRENT LIST",$J)
|
|
D ALL^FSCLMPNF(USER)
|
|
S LNUM=0
|
|
S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
|
|
.S LNUM=LNUM+1
|
|
.S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
|
|
.S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
|
|
K ^TMP("FSC LIST",$J)
|
|
Q
|
|
;
|
|
ONLY(USER) ;
|
|
N CALL,DONE,LNUM
|
|
K ^TMP("FSC LIST",$J)
|
|
S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
|
|
.I $D(^FSCD("NOTIFY","ACUSER",CALL,USER)) S ^TMP("FSC LIST",$J,CALL)="" Q
|
|
.S (DONE,LNUM)=0 F S LNUM=$O(^FSCD("NOTIFY","ACLIST",CALL,LNUM)) Q:LNUM<1 D Q:DONE
|
|
..I $D(^FSC("LIST","C",USER,LNUM)) S ^TMP("FSC LIST",$J,CALL)="",DONE=1
|
|
K ^TMP("FSC CURRENT LIST",$J)
|
|
S LNUM=0
|
|
S CALL="A" F S CALL=$O(^TMP("FSC LIST",$J,CALL),-1) Q:CALL<1 D
|
|
.S LNUM=LNUM+1
|
|
.S (^TMP("FSCRPC",$J,"OUTPUT",LNUM),^TMP("FSC CURRENT LIST",$J,LNUM+1000))=CALL_U_$$SHORT^FSCRPXUS(CALL,DUZ)
|
|
.S ^TMP("FSC CURRENT LIST",$J,"C",CALL)=LNUM+1000
|
|
K ^TMP("FSC LIST",$J)
|
|
Q
|
|
REMOVE(IN,OUT) ; from FSCRPX (RPCRemoveNotification)
|
|
N LINE
|
|
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
|
|
I '$L(LINE) Q
|
|
I +LINE=1 D REMLIST
|
|
E D REMCALLS
|
|
Q
|
|
REMLIST ;
|
|
N CALL,DA,DIK
|
|
S DIK="^FSCD(""NOTIFY"","
|
|
S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D
|
|
.K ^TMP("FSC NOTIFY",$J)
|
|
.D NOTINFO^FSCNOT(CALL,DUZ)
|
|
.S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
|
|
K ^TMP("FSC NOTIFY",$J)
|
|
Q
|
|
;
|
|
REMCALLS ;
|
|
N CALL,DA,DIK,NUM
|
|
S DIK="^FSCD(""NOTIFY"","
|
|
S NUM=0 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D
|
|
.K ^TMP("FSC NOTIFY",$J)
|
|
.D NOTINFO^FSCNOT(CALL,DUZ)
|
|
.S DA=0 F S DA=$O(^TMP("FSC NOTIFY",$J,DA)) Q:DA<1 D ^DIK
|
|
K ^TMP("FSC NOTIFY",$J)
|
|
Q
|
|
;
|
|
NOTIFY(IN,OUT) ; from FSCRPX (RPCNotify)
|
|
N CALLFLAG,DELIVERY,LINE,METHOD,MSG,RECIP,YOURSELF K RECIP
|
|
S LINE=$G(^TMP("FSCRPC",$J,"INPUT",1))
|
|
S CALLFLAG=$P(LINE,U),METHOD=$P(LINE,U,2),YOURSELF=$P(LINE,U,3),DELIVERY=$P(LINE,U,4),MSG=$P(LINE,U,5,99)
|
|
I '$L(METHOD) Q
|
|
D RECIP(.RECIP)
|
|
I 'YOURSELF S DELIVERY=""
|
|
E S RECIP(DUZ)=""
|
|
I METHOD="ALERT" D ALERT(CALLFLAG,DELIVERY,MSG,.RECIP)
|
|
I METHOD="MAIL" D MAIL(MSG,.RECIP)
|
|
Q
|
|
;
|
|
MAIL(XMSUB,XMY) ;
|
|
Q:'$D(XMSUB) I XMSUB[U S XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
|
|
N CNT,LINE,NUM,XMTEXT,XMZ K ^TMP("FSC MAIL",$J)
|
|
S ^TMP("FSC MAIL",$J,1,0)=" "
|
|
S ^TMP("FSC MAIL",$J,2,0)=" *** NOIS INFORMATION ***"
|
|
S CNT=2
|
|
S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
|
|
I NUM<1 Q
|
|
F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) Q:LINE="<<<>>>" S CNT=CNT+1,^TMP("FSC MAIL",$J,CNT,0)=LINE
|
|
S XMTEXT="^TMP(""FSC MAIL"",$J,"
|
|
S XMY(DUZ)=""
|
|
D ^XMD I $G(XMZ) ; W !,"Message #",XMZ," sent." H 2
|
|
D KILL^XM K ^TMP("FSC MAIL",$J)
|
|
Q
|
|
;
|
|
ALERT(CALLFLAG,DELIVERY,XQAMSG,XQA) ;
|
|
N ALERT,CALL,NUM,XQADATA,XQAID,XQAROU
|
|
I $L(DELIVERY) S XQAMSG=XQAMSG_" from: Yourself, sent: "_$$FMTE^XLFDT(DT)
|
|
E S XQAMSG=XQAMSG_" from: "_$$VALUE^FSCGET(DUZ,7100,2.1)
|
|
I DELIVERY=DT S DELIVERY=""
|
|
D NEWALERT^FSCNOTS(DUZ,,XQAMSG,.ALERT,DELIVERY)
|
|
I CALLFLAG S CALL=0 F S CALL=$O(^TMP("FSC CURRENT LIST",$J,"C",CALL)) Q:CALL<1 D NEWSEND^FSCNAS(ALERT,CALL)
|
|
I 'CALLFLAG D
|
|
.S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{Info}" Q
|
|
.I NUM<1 Q
|
|
.F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S CALL=+^(NUM) I CALL D NEWSEND^FSCNAS(ALERT,CALL)
|
|
I DELIVERY Q
|
|
S XQADATA=ALERT,XQAROU="ALERT^FSCNAR",XQAID="FSC-M"
|
|
D SETUP^XQALERT
|
|
Q
|
|
;
|
|
RECIP(RECIP) ;
|
|
N LINE,NUM,OK
|
|
S NUM=1 F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 I ^(NUM)="{SendTo}" Q
|
|
I NUM<1 Q
|
|
F S NUM=$O(^TMP("FSCRPC",$J,"INPUT",NUM)) Q:NUM<1 S LINE=^(NUM) Q:LINE="<<<>>>" Q:'$L(LINE) D
|
|
.I $L(LINE)>4,$E(LINE,1,2)="G." S OK=1
|
|
.E S LINE=+LINE S OK=1 I 'LINE S OK=0
|
|
.I OK S RECIP(LINE)=""
|
|
Q
|
|
;
|