LEXDMGO ;ISL/KER - Defaults - Manager/Overwrite ;04/21/2014
;;2.0;LEXICON UTILITY;**80**;Sep 23, 1996;Build 10
;
; Global Variables
; None
;
; External References
; ^DIR ICR 10026
;
; LEXOVER Flag - Overwrite user defaults (Y/N)
; LEXDNAM Default name
; LEXDVAL Default value
; LEXX Return value
;
OVER(LEXX) ; Replace existing defaults
S LEXX=$$OVERW Q LEXX
OVERW(LEXX) ; Ask to overwrite (replace)
W !
OVERP ; Get user response
N DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
S DIR("A")="Replace existing user defaults? "
S DIR("B")="No",DIR(0)="YAO",DIR("?")="^D OVRH^LEXDMGO"
S DIR("??")="^D OVRH^LEXDMGO" D ^DIR K DIR I Y[U S LEXX=Y Q LEXX
S LEXX=0 S:+Y>0 LEXX=1 Q LEXX
OVRH ; Overwrite help
W !!," By answering No:"
W !!," Existing defaults will have precedence over the selected changes"
W !," Replacing or deleting existing defaults will not be allowed"
W !," Adding defaults where none previously existed will be allowed"
W !!," By answering Yes:"
W !!," Selected changes will have precedence over existing defaults"
W !," Adding defaults where none previously existed will be allowed",!
D DISCHG Q
OVRCHG ; Display effects of overwrite changes
I +($G(LEXOVER))>0 D Q
. W !,"Replace existing defaults:"
. W " Yes, existing defaults will be changed",! D DISCHG
I +($G(LEXOVER))'>0 D Q
. W !!,"Replace existing defaults:"
. W " No, existing defaults will remain unaltered",!
Q
DISCHG ; Display changes
D CHG("LEXDICS","filter"),CHG("LEXSHOW","display")
D CHG("LEXSUB","vocabulary"),CHG("LEXCTX","shortcuts")
Q
CHG(LEXDVAL,LEXDNAM) ; Changes
I $G(@LEXDVAL)="" D Q
. W !," No changes made to the default ",LEXDNAM
I $G(@LEXDVAL)'="@" D Q
. W !," Existing ",LEXDNAM," will be replaced"
I $G(@LEXDVAL)="@" D
. W !," Existing ",LEXDNAM," will be deleted"
Q
LEXDMGO ;ISL/KER - Defaults - Manager/Overwrite ;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 ; LEXOVER Flag - Overwrite user defaults (Y/N)
+10 ; LEXDNAM Default name
+11 ; LEXDVAL Default value
+12 ; LEXX Return value
+13 ;
OVER(LEXX) ; Replace existing defaults
+1 SET LEXX=$$OVERW
QUIT LEXX
OVERW(LEXX) ; Ask to overwrite (replace)
+1 WRITE !
OVERP ; Get user response
+1 NEW DIR,DTOUT,DUOUT,DIRUT,DIROUT,X,Y
+2 SET DIR("A")="Replace existing user defaults? "
+3 SET DIR("B")="No"
SET DIR(0)="YAO"
SET DIR("?")="^D OVRH^LEXDMGO"
+4 SET DIR("??")="^D OVRH^LEXDMGO"
DO ^DIR
KILL DIR
IF Y[U
SET LEXX=Y
QUIT LEXX
+5 SET LEXX=0
IF +Y>0
SET LEXX=1
QUIT LEXX
OVRH ; Overwrite help
+1 WRITE !!," By answering No:"
+2 WRITE !!," Existing defaults will have precedence over the selected changes"
+3 WRITE !," Replacing or deleting existing defaults will not be allowed"
+4 WRITE !," Adding defaults where none previously existed will be allowed"
+5 WRITE !!," By answering Yes:"
+6 WRITE !!," Selected changes will have precedence over existing defaults"
+7 WRITE !," Adding defaults where none previously existed will be allowed",!
+8 DO DISCHG
QUIT
OVRCHG ; Display effects of overwrite changes
+1 IF +($GET(LEXOVER))>0
Begin DoDot:1
+2 WRITE !,"Replace existing defaults:"
+3 WRITE " Yes, existing defaults will be changed",!
DO DISCHG
End DoDot:1
QUIT
+4 IF +($GET(LEXOVER))'>0
Begin DoDot:1
+5 WRITE !!,"Replace existing defaults:"
+6 WRITE " No, existing defaults will remain unaltered",!
End DoDot:1
QUIT
+7 QUIT
DISCHG ; Display changes
+1 DO CHG("LEXDICS","filter")
DO CHG("LEXSHOW","display")
+2 DO CHG("LEXSUB","vocabulary")
DO CHG("LEXCTX","shortcuts")
+3 QUIT
CHG(LEXDVAL,LEXDNAM) ; Changes
+1 IF $GET(@LEXDVAL)=""
Begin DoDot:1
+2 WRITE !," No changes made to the default ",LEXDNAM
End DoDot:1
QUIT
+3 IF $GET(@LEXDVAL)'="@"
Begin DoDot:1
+4 WRITE !," Existing ",LEXDNAM," will be replaced"
End DoDot:1
QUIT
+5 IF $GET(@LEXDVAL)="@"
Begin DoDot:1
+6 WRITE !," Existing ",LEXDNAM," will be deleted"
End DoDot:1
+7 QUIT