CIAVUTIL ;MSC/IND/DKM - VueCentric Manager Utilities ;27-Feb-2007 00:33;DKM
;;1.1V2;VUECENTRIC FRAMEWORK;;Mar 20, 2007
;;Copyright 2000-2006, Medsphere Systems Corporation
;=================================================================
; Initiate shutdown sequence for applications
SHUTDOWN N DELAY,MSG
W !,"Initiate VueCentric Shutdown Sequence",!!
D SHOWSESS()
W:$$GETLOGIN'="" "Note: shutdown has already been initiated.",!!
F D Q:$D(DELAY)
.R !,"# of seconds till shutdown (30 minimum): ",DELAY:DTIME,!
.E S DELAY=U
.S DELAY=$TR(DELAY," ")
.Q:DELAY[U
.I DELAY["?" D Q
..K DELAY
..W "Enter number of seconds before shutdown.",!
..W "To specify time in minutes, follow number with letter M.",!
.S:DELAY?1.N1(1"M",1"m") DELAY=DELAY*60
.S DELAY=DELAY\1
.K:DELAY<30 DELAY
Q:DELAY[U
Q:'$$ASK^CIAU("Do you really want to shut down VueCentric in "_DELAY_" seconds")
D SDINIT(.MSG,DELAY,1)
W !!,MSG,!!
Q
; Abort a shutdown sequence in progress
ABORTSD N MSG
W !,"Abort VueCentric Shutdown and Enable Logins",!!
D SHOWSESS()
W:$$GETLOGIN="" "Note: a shutdown does not appear to be in progress.",!!
Q:'$$ASK^CIAU("Do you really want to abort any shutdowns in progress and enable logins")
D SDABORT(.MSG,1)
W !!,MSG,!!
Q
; RPC: Initiate shutdown
SDINIT(DATA,DELAY,LOCK,USR) ;
N MSG
S MSG=$P(DELAY,U,2),DELAY=DELAY\1
I DELAY<30 S DATA="Invalid value for shutdown delay." Q
D:$G(LOCK) SETLOGIN("Application is currently offline. Please try later.")
S:'$L(MSG) MSG="Application is shutting down in "_DELAY_" seconds. Please log off."
D BRDCAST^CIANBEVT("SHUTDOWN",DELAY_U_MSG,.USR)
S DATA="Shutdown sequence initiated. "_$$SDMSG
Q
; RPC: Abort shutdown
SDABORT(DATA,UNLOCK,USR) ;
D BRDCAST^CIANBEVT("SHUTDOWN","-1^Application shutdown has been aborted. You may continue.",.USR)
D:$G(UNLOCK) SETLOGIN()
S DATA="Shutdown sequence aborted. "_$$SDMSG
Q
; Login status message
SDMSG() Q "Logins are "_$S($L($$GETLOGIN):"disabled.",1:"enabled.")
; Get inhibit login message
GETLOGIN() ;
Q $$OPTMSG^CIANBUTL("CIAV VUECENTRIC")
; Set inhibit login message
SETLOGIN(MSG) ;
D OPTMSG^CIANBUTL("CIAV VUECENTRIC",$G(MSG))
Q
; RPC: Get/set inhibit login message
MSGLOGIN(DATA,MSG) ;
I '$D(MSG) S DATA=$$GETLOGIN
E D SETLOGIN(MSG)
Q
; Cleanup user data upon user termination
USRTRM(USR) ;
D TMPLDEL^CIAVMCFG("$"_USR)
Q
; Show active VueCentric sessions
SHOWSESS() ;
N X
S X=$$SHOWSESS^CIANBUTL("CIAV VUECENTRIC")
Q:$Q X
Q
CIAVUTIL ;MSC/IND/DKM - VueCentric Manager Utilities ;27-Feb-2007 00:33;DKM
+1 ;;1.1V2;VUECENTRIC FRAMEWORK;;Mar 20, 2007
+2 ;;Copyright 2000-2006, Medsphere Systems Corporation
+3 ;=================================================================
+4 ; Initiate shutdown sequence for applications
SHUTDOWN NEW DELAY,MSG
+1 WRITE !,"Initiate VueCentric Shutdown Sequence",!!
+2 DO SHOWSESS()
+3 IF $$GETLOGIN'=""
WRITE "Note: shutdown has already been initiated.",!!
+4 FOR
Begin DoDot:1
+5 READ !,"# of seconds till shutdown (30 minimum): ",DELAY:DTIME,!
+6 IF '$TEST
SET DELAY=U
+7 SET DELAY=$TRANSLATE(DELAY," ")
+8 IF DELAY[U
QUIT
+9 IF DELAY["?"
Begin DoDot:2
+10 KILL DELAY
+11 WRITE "Enter number of seconds before shutdown.",!
+12 WRITE "To specify time in minutes, follow number with letter M.",!
End DoDot:2
QUIT
+13 IF DELAY?1.N1(1"M",1"m")
SET DELAY=DELAY*60
+14 SET DELAY=DELAY\1
+15 IF DELAY<30
KILL DELAY
End DoDot:1
IF $DATA(DELAY)
QUIT
+16 IF DELAY[U
QUIT
+17 IF '$$ASK^CIAU("Do you really want to shut down VueCentric in "_DELAY_" seconds")
QUIT
+18 DO SDINIT(.MSG,DELAY,1)
+19 WRITE !!,MSG,!!
+20 QUIT
+21 ; Abort a shutdown sequence in progress
ABORTSD NEW MSG
+1 WRITE !,"Abort VueCentric Shutdown and Enable Logins",!!
+2 DO SHOWSESS()
+3 IF $$GETLOGIN=""
WRITE "Note: a shutdown does not appear to be in progress.",!!
+4 IF '$$ASK^CIAU("Do you really want to abort any shutdowns in progress and enable logins")
QUIT
+5 DO SDABORT(.MSG,1)
+6 WRITE !!,MSG,!!
+7 QUIT
+8 ; RPC: Initiate shutdown
SDINIT(DATA,DELAY,LOCK,USR) ;
+1 NEW MSG
+2 SET MSG=$PIECE(DELAY,U,2)
SET DELAY=DELAY\1
+3 IF DELAY<30
SET DATA="Invalid value for shutdown delay."
QUIT
+4 IF $GET(LOCK)
DO SETLOGIN("Application is currently offline. Please try later.")
+5 IF '$LENGTH(MSG)
SET MSG="Application is shutting down in "_DELAY_" seconds. Please log off."
+6 DO BRDCAST^CIANBEVT("SHUTDOWN",DELAY_U_MSG,.USR)
+7 SET DATA="Shutdown sequence initiated. "_$$SDMSG
+8 QUIT
+9 ; RPC: Abort shutdown
SDABORT(DATA,UNLOCK,USR) ;
+1 DO BRDCAST^CIANBEVT("SHUTDOWN","-1^Application shutdown has been aborted. You may continue.",.USR)
+2 IF $GET(UNLOCK)
DO SETLOGIN()
+3 SET DATA="Shutdown sequence aborted. "_$$SDMSG
+4 QUIT
+5 ; Login status message
SDMSG() QUIT "Logins are "_$SELECT($LENGTH($$GETLOGIN):"disabled.",1:"enabled.")
+1 ; Get inhibit login message
GETLOGIN() ;
+1 QUIT $$OPTMSG^CIANBUTL("CIAV VUECENTRIC")
+2 ; Set inhibit login message
SETLOGIN(MSG) ;
+1 DO OPTMSG^CIANBUTL("CIAV VUECENTRIC",$GET(MSG))
+2 QUIT
+3 ; RPC: Get/set inhibit login message
MSGLOGIN(DATA,MSG) ;
+1 IF '$DATA(MSG)
SET DATA=$$GETLOGIN
+2 IF '$TEST
DO SETLOGIN(MSG)
+3 QUIT
+4 ; Cleanup user data upon user termination
USRTRM(USR) ;
+1 DO TMPLDEL^CIAVMCFG("$"_USR)
+2 QUIT
+3 ; Show active VueCentric sessions
SHOWSESS() ;
+1 NEW X
+2 SET X=$$SHOWSESS^CIANBUTL("CIAV VUECENTRIC")
+3 IF $QUIT
QUIT X
+4 QUIT