[641] | 1 | XBMAIL ; IHS/ADC/GTH - MAIL MESSAGE TO SECURITY KEY HOLDERS ; [ 02/07/97 3:02 PM ]
|
---|
| 2 | ;;4.0;XB;;Jul 20, 2009;Build 2
|
---|
| 3 | ;
|
---|
| 4 | ; This utility generates a mail message to everyone on the
|
---|
| 5 | ; local machine that holds a security key according to the
|
---|
| 6 | ; namespace, range, or single key provided in the parameter.
|
---|
| 7 | ; The text of the mail messages must be provided by you, and
|
---|
| 8 | ; passed to the utility as a line reference. The utility
|
---|
| 9 | ; uses the first line after the line reference as the mail
|
---|
| 10 | ; message subject, and subsequent lines as the body of the
|
---|
| 11 | ; message, until a null string is encountered. This places
|
---|
| 12 | ; an implicit limit on your mail messages to the maximum
|
---|
| 13 | ; size of a routine. Suggested text would be to inform the
|
---|
| 14 | ; users that a patch has been installed, and describe any
|
---|
| 15 | ; changes in displays or functionality, or problems
|
---|
| 16 | ; addressed, and provide a contact number for questions,
|
---|
| 17 | ; e.g:
|
---|
| 18 | ; ------------------------------------------------------------------
|
---|
| 19 | ; Please direct your questions or comments about RPMS software to:
|
---|
| 20 | ; OIRM / DSD (Division of Systems Development)
|
---|
| 21 | ; 5300 Homestead Road NE
|
---|
| 22 | ; Albuquerque NM 87110
|
---|
| 23 | ; 505-837-4189
|
---|
| 24 | ; ------------------------------------------------------------------
|
---|
| 25 | ;
|
---|
| 26 | ; Call examples are:
|
---|
| 27 | ;
|
---|
| 28 | ; D MAIL^XBMAIL("ACHS*","MSG^ACHSP56")
|
---|
| 29 | ; D MAIL^XBMAIL("AG*,XUMGR-XUPROGMODE,APCDZMENU","LABEL^AGP5")
|
---|
| 30 | ;
|
---|
| 31 | ; The second example would deliver a mail message containing
|
---|
| 32 | ; the text beginning at LABEL+2^AGP5, and continuing to the
|
---|
| 33 | ; end of routine AGP5, to each local user that holds a
|
---|
| 34 | ; security key in the AG namespace, in the range from XUMGR
|
---|
| 35 | ; to XUPROGMODE (inclusive), and to holders of the APCDZMENU
|
---|
| 36 | ; security key.
|
---|
| 37 | ;
|
---|
| 38 | ; If you are indicating a namespace, your namespace must end
|
---|
| 39 | ; with a star ("*") character.
|
---|
| 40 | ;
|
---|
| 41 | ; If you are indicating a range of security keys, the
|
---|
| 42 | ; beginning and ending keys must be separated with a dash
|
---|
| 43 | ; ("-"). If the utility encounters a dash in a comma-piece
|
---|
| 44 | ; of the first parameter, it will consider it to be
|
---|
| 45 | ; range-indicated, and not part of the name of the key.
|
---|
| 46 | ; Use caution not to begin or end with a key that has a dash
|
---|
| 47 | ; in it's name.
|
---|
| 48 | ;
|
---|
| 49 | ; If a comma-piece does not contain a star or dash, a single
|
---|
| 50 | ; key is assumed.
|
---|
| 51 | ;
|
---|
| 52 | ; The subject of the message is assumed to be the first line
|
---|
| 53 | ; after LABEL^AGP5:
|
---|
| 54 | ; LABEL ;EP - Mail msg text.
|
---|
| 55 | ; ;;PATIENT REG, PATCH 5 CHANGES.
|
---|
| 56 | ;
|
---|
| 57 | ; The utility will return Y=0 if successful, and Y=-1 if not
|
---|
| 58 | ; successful. The message "Message delivered." will be
|
---|
| 59 | ; displayed if the routine is called interactively.
|
---|
| 60 | ;
|
---|
| 61 | ;
|
---|
| 62 | Q
|
---|
| 63 | ;
|
---|
| 64 | MAIL(XBNS,XBREF) ;PEP - XBNS is namespace, XBREF is line reference.
|
---|
| 65 | ;
|
---|
| 66 | NEW XBLAB,XBRTN,XMSUB,XMDUZ,XMTEXT,XMY
|
---|
| 67 | S XBLAB=$P(XBREF,U),XBRTN=$P(XBREF,U,2)
|
---|
| 68 | I XBLAB=""!(XBRTN="") S Y=-1 Q ; Invalid label reference.
|
---|
| 69 | I '$L($T(@XBLAB+1^@XBRTN)) S Y=-1 Q ; No text to send.
|
---|
| 70 | S XMSUB=$P($T(@XBLAB+1^@XBRTN),";",3)
|
---|
| 71 | KILL ^TMP("XBMAIL",$J)
|
---|
| 72 | D WRITDESC,GETRECIP
|
---|
| 73 | I '$D(XMY) S Y=-1 Q ; No recipients.
|
---|
| 74 | S XMDUZ=$S($G(DUZ):DUZ,1:.5),XMTEXT="^TMP(""XBMAIL"",$J,"
|
---|
| 75 | D ^XMD
|
---|
| 76 | KILL ^TMP("XBMAIL",$J)
|
---|
| 77 | I '$D(ZTQUEUED) W !!,"Message delivered.",!
|
---|
| 78 | S Y=0
|
---|
| 79 | Q
|
---|
| 80 | ;
|
---|
| 81 | GETRECIP ;
|
---|
| 82 | NEW X,XBCTR,Y
|
---|
| 83 | F XBCTR=1:1 S %=$P(XBNS,",",XBCTR) Q:%="" D
|
---|
| 84 | . I %["*" D NS(%) Q
|
---|
| 85 | . I %["-" D RANGE(%) Q
|
---|
| 86 | . D SINGLE(%)
|
---|
| 87 | .Q
|
---|
| 88 | Q
|
---|
| 89 | ;
|
---|
| 90 | SINGLE(K) ; Get holders of a single key K.
|
---|
| 91 | S Y=0
|
---|
| 92 | Q:'$D(^XUSEC(K))
|
---|
| 93 | F S Y=$O(^XUSEC(K,Y)) Q:'Y S XMY(Y)=""
|
---|
| 94 | Q
|
---|
| 95 | ;
|
---|
| 96 | RANGE(R) ; Get holders of a range of keys.
|
---|
| 97 | S X=$P(R,"-",1),R=$P(R,"-",2)
|
---|
| 98 | D SINGLE(X)
|
---|
| 99 | F S X=$O(^XUSEC(X)) Q:X=R!(X="") S Y=0 F S Y=$O(^XUSEC(X,Y)) Q:'Y S XMY(Y)=""
|
---|
| 100 | D SINGLE(R)
|
---|
| 101 | Q
|
---|
| 102 | ;
|
---|
| 103 | NS(N) ; Get holders of keys in namespace N.
|
---|
| 104 | S (X,N)=$P(N,"*",1),Y=0
|
---|
| 105 | D SINGLE(X)
|
---|
| 106 | F S X=$O(^XUSEC(X)) Q:'($E(X,1,$L(N))=N) S Y=0 F S Y=$O(^XUSEC(X,Y)) Q:'Y S XMY(Y)=""
|
---|
| 107 | Q
|
---|
| 108 | ;
|
---|
| 109 | ;
|
---|
| 110 | WRITDESC ;
|
---|
| 111 | F %=2:1 S X=$P($T(@XBLAB+%^@XBRTN),";",3) Q:X="" S ^TMP("XBMAIL",$J,%)=X
|
---|
| 112 | Q
|
---|
| 113 | ;
|
---|