USRRUL1 ; SLC/JER - Rule Browser subroutines & functions ; 05/13/1998
;;1.0;AUTHORIZATION/SUBSCRIPTION;**7**;Jun 20, 1997
UPDATE(ITEM) ; Updates list following edit
N USRDA,USRULE,USRPAD
S $P(USRPAD," ",6-$L(+ITEM))=""
S USRDA=$P(ITEM,U,2)
D XLATE^USRAEDT(.USRULE,USRDA)
D SET^VALM10(+ITEM,+ITEM_USRPAD_$P(USRULE,"|"),USRDA)
D RESTORE^VALM10(+ITEM),CNTRL^VALM10(+ITEM,1,VALM("RM"),IOINHI,IOINORM)
Q
RESIZE(LONG,SHORT,SHRINK) ; Resizes list area
N USRBM S USRBM=$S(VALMMENU:SHORT,+$G(SHRINK):SHORT,1:LONG)
I VALM("BM")'=USRBM S VALMBCK="R" D
. S VALM("BM")=USRBM,VALM("LINES")=(USRBM-VALM("TM"))+1
. I +$G(VALMCC) D RESET^VALM4
Q
PICK(USRITEM) ; Highlight selected list elements, add to VALMY(ITEM) array
N I,ITEM,LINE,MRSI
F I=1:1:$L(USRITEM,",") S ITEM=$P(USRITEM,",",I) Q:+ITEM'>0 D
. S LINE=+$O(@VALMAR@("IDX",+ITEM,0))
. I '+LINE S LINE=ITEM
.;Keep track of the most recently selected item.
. S MRSI=ITEM
. I '$D(VALMY(ITEM)) D I 1
. . D RESTORE^VALM10(LINE),CNTRL^VALM10(LINE,6,VALM("RM"),IORVON,IORVOFF)
. . D WRITE^VALM10(LINE)
. . S VALMY(ITEM)=""
. E D
. . D RESTORE(LINE),WRITE^VALM10(LINE)
. . K VALMY(ITEM)
;Move the display to 5 lines before the MRSI
S VALMBG=$$MAX^XLFMTH(1,(MRSI-5))
D RE^VALM4
Q
FIXLST ; Restore video attributes to entire list
N USRI S USRI=0
Q:'$D(VALMAR)
F S USRI=$O(@VALMAR@(USRI)) Q:+USRI'>0 D
. D RESTORE^VALM10(USRI)
Q
RESTORE(ITEM) ; Restore video attributes for a single list element
D RESTORE^VALM10(ITEM)
Q
REMOVE(ITEM) ; Remove an element from the list
N USRULE,USRPAD
S $P(USRPAD," ",6-$L(USRCNT))=""
S USRULE="<Business Rule DELETED>"
D SET^VALM10(+ITEM,+ITEM_USRPAD_USRULE,+$P(ITEM,U,2))
D RESTORE^VALM10(+ITEM),CNTRL^VALM10(+ITEM,6,VALM("RM"),IOINHI,IOINORM)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HUSRRUL1 1807 printed Oct 16, 2024@17:39:55 Page 2
USRRUL1 ; SLC/JER - Rule Browser subroutines & functions ; 05/13/1998
+1 ;;1.0;AUTHORIZATION/SUBSCRIPTION;**7**;Jun 20, 1997
UPDATE(ITEM) ; Updates list following edit
+1 NEW USRDA,USRULE,USRPAD
+2 SET $PIECE(USRPAD," ",6-$LENGTH(+ITEM))=""
+3 SET USRDA=$PIECE(ITEM,U,2)
+4 DO XLATE^USRAEDT(.USRULE,USRDA)
+5 DO SET^VALM10(+ITEM,+ITEM_USRPAD_$PIECE(USRULE,"|"),USRDA)
+6 DO RESTORE^VALM10(+ITEM)
DO CNTRL^VALM10(+ITEM,1,VALM("RM"),IOINHI,IOINORM)
+7 QUIT
RESIZE(LONG,SHORT,SHRINK) ; Resizes list area
+1 NEW USRBM
SET USRBM=$SELECT(VALMMENU:SHORT,+$GET(SHRINK):SHORT,1:LONG)
+2 IF VALM("BM")'=USRBM
SET VALMBCK="R"
Begin DoDot:1
+3 SET VALM("BM")=USRBM
SET VALM("LINES")=(USRBM-VALM("TM"))+1
+4 IF +$GET(VALMCC)
DO RESET^VALM4
End DoDot:1
+5 QUIT
PICK(USRITEM) ; Highlight selected list elements, add to VALMY(ITEM) array
+1 NEW I,ITEM,LINE,MRSI
+2 FOR I=1:1:$LENGTH(USRITEM,",")
SET ITEM=$PIECE(USRITEM,",",I)
if +ITEM'>0
QUIT
Begin DoDot:1
+3 SET LINE=+$ORDER(@VALMAR@("IDX",+ITEM,0))
+4 IF '+LINE
SET LINE=ITEM
+5 ;Keep track of the most recently selected item.
+6 SET MRSI=ITEM
+7 IF '$DATA(VALMY(ITEM))
Begin DoDot:2
+8 DO RESTORE^VALM10(LINE)
DO CNTRL^VALM10(LINE,6,VALM("RM"),IORVON,IORVOFF)
+9 DO WRITE^VALM10(LINE)
+10 SET VALMY(ITEM)=""
End DoDot:2
IF 1
+11 IF '$TEST
Begin DoDot:2
+12 DO RESTORE(LINE)
DO WRITE^VALM10(LINE)
+13 KILL VALMY(ITEM)
End DoDot:2
End DoDot:1
+14 ;Move the display to 5 lines before the MRSI
+15 SET VALMBG=$$MAX^XLFMTH(1,(MRSI-5))
+16 DO RE^VALM4
+17 QUIT
FIXLST ; Restore video attributes to entire list
+1 NEW USRI
SET USRI=0
+2 if '$DATA(VALMAR)
QUIT
+3 FOR
SET USRI=$ORDER(@VALMAR@(USRI))
if +USRI'>0
QUIT
Begin DoDot:1
+4 DO RESTORE^VALM10(USRI)
End DoDot:1
+5 QUIT
RESTORE(ITEM) ; Restore video attributes for a single list element
+1 DO RESTORE^VALM10(ITEM)
+2 QUIT
REMOVE(ITEM) ; Remove an element from the list
+1 NEW USRULE,USRPAD
+2 SET $PIECE(USRPAD," ",6-$LENGTH(USRCNT))=""
+3 SET USRULE="<Business Rule DELETED>"
+4 DO SET^VALM10(+ITEM,+ITEM_USRPAD_USRULE,+$PIECE(ITEM,U,2))
+5 DO RESTORE^VALM10(+ITEM)
DO CNTRL^VALM10(+ITEM,6,VALM("RM"),IOINHI,IOINORM)
+6 QUIT