LEXDMGU ;ISL/KER - Defaults - Manager/User Group ;04/21/2014
;;2.0;LEXICON UTILITY;**80**;Sep 23, 1996;Build 10
;
; Global Variables
; None
;
; External References
; ^DIR ICR 10026
;
; LEXDICS(0) Filter name
; LEXSHOW(0) Display name
; LEXSUB(0) Vocabulary name
; LEXCTX(0) Shortcut Context name
;
; LEXC Counter
; LEXI Incremental counter
; LEXS Service
; LEXMORE Flag - Select more users (Y/N)
; LEXOVER Flag - Overwrite user defaults (Y/N)
; LEXSEL User input/selection
; LEXUSR Flag - User has been selected
; LEXVER Flag - Default values are verified (Y/N)
; LEXX Return value
;
; LEXLIM Limits (parameter for LEXMETH)
; LEXMETH Method, singel user, by service or all users
;
USER(LEXX) ; User or user group by name or by type
N LEXUSR,LEXMETH,LEXLIM,LEXMORE,LEXOVER,LEXVER
GRP ; Get user/user group
K DIC,DIR S LEXX=""
W ! D DM S (LEXX,LEXUSR)=$$USR I LEXX[U G EXIT
GETUSER ; Get user or user group type
S (LEXMETH,LEXLIM)=""
I +LEXX=1 W ! S LEXLIM=$$USER^LEXDM4,LEXMETH="ONE"
I +LEXX=2 W ! S LEXLIM=$$SERV^LEXDM4,LEXMETH="SEV"
I +LEXX=3 S LEXLIM=1,LEXMETH="ALL"
D LIMIT,METHOD
Q:+($G(LEXLIM))'>0 LEXLIM
; Check defaults - DEFCK^LEXDMGV
D DEFCK^LEXDMGV
; Check user - USERCK^LEXDMGV
D USERCK^LEXDMGV
; Ask to overwrite defaults - $$OVER^LEXDMGO
S LEXOVER=$$OVER^LEXDMGO
Q:LEXOVER["^^" "^^"
; Verify before setting global - $$VER^LEXDMGV
S LEXVER=$$VER^LEXDMGV
S:LEXVER[U LEXS=U S:LEXVER["^^" LEXX="^^" Q:LEXX[U LEXX
D:+($G(LEXVER))>0 UPDATE^LEXDMGT
; More users
S LEXMORE=0 I +($G(LEXUSR))>0,+($G(LEXUSR))<3 S LEXMORE=1
I +($G(LEXMORE))>0,LEXX'["^^" D G:+($G(LEXMORE))>0 GRP
. S LEXMORE=$$MOREUSR
Q LEXX
LIMIT ; Check search limits
Q:+($G(LEXLIM))>0 S:LEXLIM["^^" LEXLIM="^^" Q:LEXLIM[U
S LEXLIM=U Q
METHOD ; Check search method
Q:+($G(LEXLIM))>0 S:LEXLIM[U!($G(LEXLIM)="") LEXMETH="" Q
EXIT ; Quit USER selection
Q LEXX
MOREUSR(LEXX) ; Want to set the current defaults for more users?
N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
S DIR("A",1)="Do you wish to set the currently selected user"
S DIR("A")="defaults to another user or group of users? "
S DIR("B")="No",(DIR("?"),DIR("??"))="^D MOREHLP^LEXDMGU"
S DIR(0)="YAO" D ^DIR K DIR S LEXX=+Y Q:$D(DTOUT) "^" S:X[U LEXX=U
S:X["^^" LEXX="^^" Q:LEXX[U LEXX S LEXX=+Y Q LEXX
MOREHLP ; More user help
D CD W !,"The defaults you selected may be applied to another user/user group",!
Q
USR(LEXX) ; Get response for USER
W ! N Y,DTOUT,DUOUT,DIRUT,DIROUT S DIR("A")="Select 1-3: "
S DIR("B")=1,(DIR("?"),DIR("??"))="^D USRHLP^LEXDMGU"
S DIR(0)="NAO^1:3:0" D ^DIR K DIR S LEXX=+Y
Q:$D(DTOUT) "^^" S:X[U LEXX=U S:X["^^" LEXX="^^" Q:LEXX[U LEXX
S:+Y>0&(+Y<6) LEXX=+Y Q LEXX
Q
USRHLP ; Help for respons to USER
I X'["?",+X<1!(+X>3) D Q
. W !!,"Press <Return> to continue, "
. W """^"" to exit or select (1-3)" D DM
I '$L(($G(LEXDICS(0))_$G(LEXSHOW(0))_$G(LEXSUB(0))_$G(LEXCTX(0)))) D Q
. W !!,"Press <Return> to continue, "
. W """^"" to exit or select (1-3)" D DM
D CD W !,"The default selections listed above may be applied to either"
W !,"a single user, a user group based on service, or all users."
W !,"You may either select a user/user group (1-3), or press "
W !,"<Return> to continue, or ""^"" to exit." D DM
Q
CD ; Current defaults
W !!,"Current default selections:",!
W !," Filter - "
W $S($L($G(LEXDICS(0))):$G(LEXDICS(0)),1:"Not selected")
W !," Display - "
W $S($L($G(LEXSHOW(0))):$G(LEXSHOW(0)),1:"Not selected")
W !," Vocabulary - "
W $S($L($G(LEXSUB(0))):$G(LEXSUB(0)),1:"Not selected")
W !," Shortcuts - "
W $S($L($G(LEXCTX(0))):$G(LEXCTX(0)),1:"Not selected") W !
Q
DM ; Display menu
W !!,"User/User groups:",!
N LEXC F LEXC=1:1:999 Q:$P($T(UM+LEXC^LEXDMGU),";",2)="" D
. W !," ",$J($P($T(UM+LEXC^LEXDMGU),";",2),2)," "
. W $P($T(UM+LEXC^LEXDMGU),";",3)
Q
UM ;; User/user group menu data
;1;Single User
;2;Group based on Service
;3;All Users
;;
LEXDMGU ;ISL/KER - Defaults - Manager/User Group ;04/21/2014
+1 ;;2.0;LEXICON UTILITY;**80**;Sep 23, 1996;Build 10
+2 ;
+3 ; Global Variables
+4 ; None
+5 ;
+6 ; External References
+7 ; ^DIR ICR 10026
+8 ;
+9 ; LEXDICS(0) Filter name
+10 ; LEXSHOW(0) Display name
+11 ; LEXSUB(0) Vocabulary name
+12 ; LEXCTX(0) Shortcut Context name
+13 ;
+14 ; LEXC Counter
+15 ; LEXI Incremental counter
+16 ; LEXS Service
+17 ; LEXMORE Flag - Select more users (Y/N)
+18 ; LEXOVER Flag - Overwrite user defaults (Y/N)
+19 ; LEXSEL User input/selection
+20 ; LEXUSR Flag - User has been selected
+21 ; LEXVER Flag - Default values are verified (Y/N)
+22 ; LEXX Return value
+23 ;
+24 ; LEXLIM Limits (parameter for LEXMETH)
+25 ; LEXMETH Method, singel user, by service or all users
+26 ;
USER(LEXX) ; User or user group by name or by type
+1 NEW LEXUSR,LEXMETH,LEXLIM,LEXMORE,LEXOVER,LEXVER
GRP ; Get user/user group
+1 KILL DIC,DIR
SET LEXX=""
+2 WRITE !
DO DM
SET (LEXX,LEXUSR)=$$USR
IF LEXX[U
GOTO EXIT
GETUSER ; Get user or user group type
+1 SET (LEXMETH,LEXLIM)=""
+2 IF +LEXX=1
WRITE !
SET LEXLIM=$$USER^LEXDM4
SET LEXMETH="ONE"
+3 IF +LEXX=2
WRITE !
SET LEXLIM=$$SERV^LEXDM4
SET LEXMETH="SEV"
+4 IF +LEXX=3
SET LEXLIM=1
SET LEXMETH="ALL"
+5 DO LIMIT
DO METHOD
+6 IF +($GET(LEXLIM))'>0
QUIT LEXLIM
+7 ; Check defaults - DEFCK^LEXDMGV
+8 DO DEFCK^LEXDMGV
+9 ; Check user - USERCK^LEXDMGV
+10 DO USERCK^LEXDMGV
+11 ; Ask to overwrite defaults - $$OVER^LEXDMGO
+12 SET LEXOVER=$$OVER^LEXDMGO
+13 IF LEXOVER["^^"
QUIT "^^"
+14 ; Verify before setting global - $$VER^LEXDMGV
+15 SET LEXVER=$$VER^LEXDMGV
+16 IF LEXVER[U
SET LEXS=U
IF LEXVER["^^"
SET LEXX="^^"
IF LEXX[U
QUIT LEXX
+17 IF +($GET(LEXVER))>0
DO UPDATE^LEXDMGT
+18 ; More users
+19 SET LEXMORE=0
IF +($GET(LEXUSR))>0
IF +($GET(LEXUSR))<3
SET LEXMORE=1
+20 IF +($GET(LEXMORE))>0
IF LEXX'["^^"
Begin DoDot:1
+21 SET LEXMORE=$$MOREUSR
End DoDot:1
IF +($GET(LEXMORE))>0
GOTO GRP
+22 QUIT LEXX
LIMIT ; Check search limits
+1 IF +($GET(LEXLIM))>0
QUIT
IF LEXLIM["^^"
SET LEXLIM="^^"
IF LEXLIM[U
QUIT
+2 SET LEXLIM=U
QUIT
METHOD ; Check search method
+1 IF +($GET(LEXLIM))>0
QUIT
IF LEXLIM[U!($GET(LEXLIM)="")
SET LEXMETH=""
QUIT
EXIT ; Quit USER selection
+1 QUIT LEXX
MOREUSR(LEXX) ; Want to set the current defaults for more users?
+1 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
+2 SET DIR("A",1)="Do you wish to set the currently selected user"
+3 SET DIR("A")="defaults to another user or group of users? "
+4 SET DIR("B")="No"
SET (DIR("?"),DIR("??"))="^D MOREHLP^LEXDMGU"
+5 SET DIR(0)="YAO"
DO ^DIR
KILL DIR
SET LEXX=+Y
IF $DATA(DTOUT)
QUIT "^"
IF X[U
SET LEXX=U
+6 IF X["^^"
SET LEXX="^^"
IF LEXX[U
QUIT LEXX
SET LEXX=+Y
QUIT LEXX
MOREHLP ; More user help
+1 DO CD
WRITE !,"The defaults you selected may be applied to another user/user group",!
+2 QUIT
USR(LEXX) ; Get response for USER
+1 WRITE !
NEW Y,DTOUT,DUOUT,DIRUT,DIROUT
SET DIR("A")="Select 1-3: "
+2 SET DIR("B")=1
SET (DIR("?"),DIR("??"))="^D USRHLP^LEXDMGU"
+3 SET DIR(0)="NAO^1:3:0"
DO ^DIR
KILL DIR
SET LEXX=+Y
+4 IF $DATA(DTOUT)
QUIT "^^"
IF X[U
SET LEXX=U
IF X["^^"
SET LEXX="^^"
IF LEXX[U
QUIT LEXX
+5 IF +Y>0&(+Y<6)
SET LEXX=+Y
QUIT LEXX
+6 QUIT
USRHLP ; Help for respons to USER
+1 IF X'["?"
IF +X<1!(+X>3)
Begin DoDot:1
+2 WRITE !!,"Press <Return> to continue, "
+3 WRITE """^"" to exit or select (1-3)"
DO DM
End DoDot:1
QUIT
+4 IF '$LENGTH(($GET(LEXDICS(0))_$GET(LEXSHOW(0))_$GET(LEXSUB(0))_$GET(LEXCTX(0))))
Begin DoDot:1
+5 WRITE !!,"Press <Return> to continue, "
+6 WRITE """^"" to exit or select (1-3)"
DO DM
End DoDot:1
QUIT
+7 DO CD
WRITE !,"The default selections listed above may be applied to either"
+8 WRITE !,"a single user, a user group based on service, or all users."
+9 WRITE !,"You may either select a user/user group (1-3), or press "
+10 WRITE !,"<Return> to continue, or ""^"" to exit."
DO DM
+11 QUIT
CD ; Current defaults
+1 WRITE !!,"Current default selections:",!
+2 WRITE !," Filter - "
+3 WRITE $SELECT($LENGTH($GET(LEXDICS(0))):$GET(LEXDICS(0)),1:"Not selected")
+4 WRITE !," Display - "
+5 WRITE $SELECT($LENGTH($GET(LEXSHOW(0))):$GET(LEXSHOW(0)),1:"Not selected")
+6 WRITE !," Vocabulary - "
+7 WRITE $SELECT($LENGTH($GET(LEXSUB(0))):$GET(LEXSUB(0)),1:"Not selected")
+8 WRITE !," Shortcuts - "
+9 WRITE $SELECT($LENGTH($GET(LEXCTX(0))):$GET(LEXCTX(0)),1:"Not selected")
WRITE !
+10 QUIT
DM ; Display menu
+1 WRITE !!,"User/User groups:",!
+2 NEW LEXC
FOR LEXC=1:1:999
IF $PIECE($TEXT(UM+LEXC^LEXDMGU),";",2)=""
QUIT
Begin DoDot:1
+3 WRITE !," ",$JUSTIFY($PIECE($TEXT(UM+LEXC^LEXDMGU),";",2),2)," "
+4 WRITE $PIECE($TEXT(UM+LEXC^LEXDMGU),";",3)
End DoDot:1
+5 QUIT
UM ;; User/user group menu data
+1 ;1;Single User
+2 ;2;Group based on Service
+3 ;3;All Users
+4 ;;