MAGGTU41 ;WOIFO/GEK/SG - VERSION CONTROL UTILITIES ; 3/04/10 4:25pm
;;3.0;IMAGING;**46,59,93,90**;Mar 19, 2002;Build 1764;Jun 09, 2010
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q
;
;+++++ CHECKS THE CLIENT VERSION AGIANST THE LIST OF SUPPORTED ONES
;
; .VCD Reference to a local variable where the version
; control data is cached (see the $$GETVCD^MAGGTU41
; for details).
;
; CLNAME Client name ("CAPTURE", "CLUTILS", "DISPLAY",
; "TELEREADER", or "VISTARAD")
;
; .CLVER Reference to a local variable that stores the client
; application version (Major.Minor.Patch.Build).
;
; Return Values
; =============
; <0 Error descriptor (see $$ERROR^MAGUERR)
; 0 Latest version of the client
; 1 Latest version but old build (T-version)
; 2 Supported version of the client
; 3 Supported version but old build (T-version)
; 4 Client is not supported
;
CHKVER1(VCD,CLNAME,CLVER) ;
N CT,CV,RC
;--- Bug in patch 42: the version comes in as 30.5.42.x
;--- (patch 42 was not released)
S:$P(CLVER,".")="30" CLVER="3.0."_$P(CLVER,".",3,99)
;--- Parse the client version
S CV=$P(CLVER,".",1,3),CT=$P(CLVER,".",4)
S:CT="" $P(CLVER,".",4)=0,CT=0
;--- Get the version control data (if not cached already)
I $D(VCD(CLNAME))<10 S RC=$$GETVCD(.VCD,CLNAME) Q:RC<0 RC
;--- Client and server versions are different
I CV'=VCD(CLNAME,"SV") D Q RC
. S RC=$S('$D(VCD(CLNAME,"ST",CV)):4,CT<VCD(CLNAME,"ST",CV):3,1:2)
. Q
;--- The versions are the same
Q $S(CT&(CT'=VCD(CLNAME,"ST")):1,1:0)
;
;##### RETURNS THE CLIENT APPLICATION DESCRIPTOR
;
; CLNAME Client application name
;
; If this parameter is not defined or empty, then the
; function returns the list of supported client names
; separated by commas.
;
; Return Values
; =============
; <0 Error descriptor (see $$ERROR^MAGUERR)
; ... Client descriptor
; ^01: Name of the version control routine
; ^02: Number of the version field in the IMAGING
; WINDOWS WORKSTATIONS file (2006.81)
; ^03: Number of the date/time field in the IMAGING
; WINDOWS WORKSTATIONS file (2006.81)
;
CLADESC(CLNAME) ;
Q:$G(CLNAME)="" "CAPTURE,CLUTILS,DISPLAY,TELEREADER,VISTARAD"
N DSC
D
. I CLNAME="CAPTURE" S DSC="MAGGTU4C^9.5^5.5" Q
. I CLNAME="CLUTILS" S DSC="MAGGTU4L^9.9^5.9" Q
. I CLNAME="DISPLAY" S DSC="MAGGTU4D^9^5" Q
. I CLNAME="TELEREADER" S DSC="MAGGTU4T^9.3^5.3" Q
. I CLNAME="VISTARAD" S DSC="MAGJTU4V^9.7^5.7" Q
. Q
;
Q $S($G(DSC)'="":DSC,1:$$ERROR^MAGUERR(-24,,CLNAME))
;
;+++++ BUILDS THE GENERAL ERROR MESSAGE IN THE RESULT ARRAY
;
; .MAGRES Reference to the RPC result array where
; the error message is returned to.
;
; ERR Error descriptor (see $$ERROR^MAGUERR)
;
ERROR(MAGRES,ERR) ;
Q:ERR'<0
N MAGPRMS K MAGRES
S MAGPRMS("ERRMSG")=$P(ERR,U,2) ; Message text
S MAGPRMS("ERRLOC")=$P(ERR,U,3) ; Location
D BLD^DIALOG(20050005.002,.MAGPRMS,,"MAGRES")
S MAGRES(0)="2^"_$G(MAGRES(1)) K MAGRES(1)
Q
;
;+++++ RETURNS THE ROW OF THE CLIENT VERSION CONTROL TABLE
;
; ROW Sequential number of the row (starting from 1)
;
; Input Variables
; ===============
; MAGRTN
;
GETVCL(ROW) ;
Q $P($T(@("CLVERCT+"_(ROW+3)_"^"_MAGRTN)),";;",2)
;
;##### RETURNS THE SERVER VERSION AND THE LIST OF SUPPORTED CLIENTS
;
; .VCD( Reference to a local variable where the version
; control data is returned to.
; CLNAME,
; "SV") Server version (Major.Minor.Patch.Build)
; "ST", Server build number (T-version)
; Ver) Build number of the version Ver release.
; Ver is in the Major.Minor.Patch format.
;
; CLNAME Client name ("CAPTURE", "CLUTILS", "DISPLAY",
; "TELEREADER", or "VISTARAD")
;
; See also the CLVERCT^MAGGTU4C, CLVERCT^MAGGTU4D,
; CLVERCT^MAGGTU4L, and CLVERCT^MAGGTU4T for client
; specific version tables.
;
; Return Values
; =============
; <0 Error descriptor (see $$ERROR^MAGUERR)
; 0 Success
;
GETVCD(VCD,CLNAME) ;
N MAGRTN ; Name of the routine with the version control table
;
N BUF,I,SV,TMP,VER K VCD(CLNAME)
F I="ST","SV" S VCD(CLNAME,I)=""
;
;=== Get the name of the routine that contains the
;=== version control table for the client
S MAGRTN=$P($$CLADESC(CLNAME),U) Q:MAGRTN<0 MAGRTN
;
;=== Get the server version from the second line of the
;=== routine that contains the version control table
S BUF=$P($T(@("+2^"_MAGRTN)),";;",2,999)
Q:BUF="" $$ERROR^MAGUERR(-25,,MAGRTN)
;--- Get the package version
S SV=$TR($P(BUF,";")," ")
;--- Get the patch number (the last one) from the list
S TMP=$TR($P($P(BUF,";",3),"**",2)," ")
S SV=SV_"."_(+$P(TMP,",",$L(TMP,",")))
;
;=== Load the version control table
F I=1:1 S BUF=$$GETVCL(I) Q:BUF="" D
. S BUF=$TR(BUF,"| ",U),VER=$P(BUF,U,2)
. S:VER>0 VCD(CLNAME,"ST",VER)=+$P(BUF,U,3)
. Q
;
;=== Get the build number and remove the server version from the list
S VCD(CLNAME,"SV")=SV
S VCD(CLNAME,"ST")=+$G(VCD(CLNAME,"ST",SV))
K VCD(CLNAME,"ST",SV)
Q 0
;
;+++++ APPENDS THE CLIENT-SPECIFIC WARNING TO THE ARRAY
;
; .MAGRES Reference to the RPC result array that
; the warning is apppended to.
;
; CLNAME Client name
;
; CLVER Client application version (Major.Minor.Patch.Build)
;
; CVRC Version check code returned by the $$CHKVER1^MAGGTU41
;
WARNING(MAGRES,CLNAME,CLVER,CVRC) ;
;--- Do not append the warning if the RPC result array already
;--- contains an error message that will terminate the client.
Q:+$G(MAGRES(0),1)=2
;
N EP,MAGBUF,RI,SPI
S:$P(CLVER,".",4)="" $P(CLVER,".",4)=0
;--- Get the name of the client's version control routine
S EP=$P($$CLADESC(CLNAME),U) Q:EP<0
S EP="WARNING^"_EP Q:$T(@EP)=""
;--- Get the client-specific warning
X "D "_EP_"(.MAGBUF,CLVER,CVRC)"
S SPI=$Q(MAGBUF) Q:SPI=""
;--- Append the 1st line of the warning text to the result array
;--- and make sure that the client will diplay the warning
S RI=$O(MAGRES(""),-1)
I RI'="" D S:+$G(MAGRES(0),1)=1 $P(MAGRES(0),U)=0
. S RI=RI+1,MAGRES(RI)=" "
. S RI=RI+1,MAGRES(RI)=@SPI
. Q
E S MAGRES(0)="1^"_@SPI
;--- Append the remaining lines
F S SPI=$Q(@SPI) Q:SPI="" S RI=RI+1,MAGRES(RI)=@SPI
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTU41 7765 printed Nov 22, 2024@17:13:31 Page 2
MAGGTU41 ;WOIFO/GEK/SG - VERSION CONTROL UTILITIES ; 3/04/10 4:25pm
+1 ;;3.0;IMAGING;**46,59,93,90**;Mar 19, 2002;Build 1764;Jun 09, 2010
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 QUIT
+18 ;
+19 ;+++++ CHECKS THE CLIENT VERSION AGIANST THE LIST OF SUPPORTED ONES
+20 ;
+21 ; .VCD Reference to a local variable where the version
+22 ; control data is cached (see the $$GETVCD^MAGGTU41
+23 ; for details).
+24 ;
+25 ; CLNAME Client name ("CAPTURE", "CLUTILS", "DISPLAY",
+26 ; "TELEREADER", or "VISTARAD")
+27 ;
+28 ; .CLVER Reference to a local variable that stores the client
+29 ; application version (Major.Minor.Patch.Build).
+30 ;
+31 ; Return Values
+32 ; =============
+33 ; <0 Error descriptor (see $$ERROR^MAGUERR)
+34 ; 0 Latest version of the client
+35 ; 1 Latest version but old build (T-version)
+36 ; 2 Supported version of the client
+37 ; 3 Supported version but old build (T-version)
+38 ; 4 Client is not supported
+39 ;
CHKVER1(VCD,CLNAME,CLVER) ;
+1 NEW CT,CV,RC
+2 ;--- Bug in patch 42: the version comes in as 30.5.42.x
+3 ;--- (patch 42 was not released)
+4 if $PIECE(CLVER,".")="30"
SET CLVER="3.0."_$PIECE(CLVER,".",3,99)
+5 ;--- Parse the client version
+6 SET CV=$PIECE(CLVER,".",1,3)
SET CT=$PIECE(CLVER,".",4)
+7 if CT=""
SET $PIECE(CLVER,".",4)=0
SET CT=0
+8 ;--- Get the version control data (if not cached already)
+9 IF $DATA(VCD(CLNAME))<10
SET RC=$$GETVCD(.VCD,CLNAME)
if RC<0
QUIT RC
+10 ;--- Client and server versions are different
+11 IF CV'=VCD(CLNAME,"SV")
Begin DoDot:1
+12 SET RC=$SELECT('$DATA(VCD(CLNAME,"ST",CV)):4,CT<VCD(CLNAME,"ST",CV):3,1:2)
+13 QUIT
End DoDot:1
QUIT RC
+14 ;--- The versions are the same
+15 QUIT $SELECT(CT&(CT'=VCD(CLNAME,"ST")):1,1:0)
+16 ;
+17 ;##### RETURNS THE CLIENT APPLICATION DESCRIPTOR
+18 ;
+19 ; CLNAME Client application name
+20 ;
+21 ; If this parameter is not defined or empty, then the
+22 ; function returns the list of supported client names
+23 ; separated by commas.
+24 ;
+25 ; Return Values
+26 ; =============
+27 ; <0 Error descriptor (see $$ERROR^MAGUERR)
+28 ; ... Client descriptor
+29 ; ^01: Name of the version control routine
+30 ; ^02: Number of the version field in the IMAGING
+31 ; WINDOWS WORKSTATIONS file (2006.81)
+32 ; ^03: Number of the date/time field in the IMAGING
+33 ; WINDOWS WORKSTATIONS file (2006.81)
+34 ;
CLADESC(CLNAME) ;
+1 if $GET(CLNAME)=""
QUIT "CAPTURE,CLUTILS,DISPLAY,TELEREADER,VISTARAD"
+2 NEW DSC
+3 Begin DoDot:1
+4 IF CLNAME="CAPTURE"
SET DSC="MAGGTU4C^9.5^5.5"
QUIT
+5 IF CLNAME="CLUTILS"
SET DSC="MAGGTU4L^9.9^5.9"
QUIT
+6 IF CLNAME="DISPLAY"
SET DSC="MAGGTU4D^9^5"
QUIT
+7 IF CLNAME="TELEREADER"
SET DSC="MAGGTU4T^9.3^5.3"
QUIT
+8 IF CLNAME="VISTARAD"
SET DSC="MAGJTU4V^9.7^5.7"
QUIT
+9 QUIT
End DoDot:1
+10 ;
+11 QUIT $SELECT($GET(DSC)'="":DSC,1:$$ERROR^MAGUERR(-24,,CLNAME))
+12 ;
+13 ;+++++ BUILDS THE GENERAL ERROR MESSAGE IN THE RESULT ARRAY
+14 ;
+15 ; .MAGRES Reference to the RPC result array where
+16 ; the error message is returned to.
+17 ;
+18 ; ERR Error descriptor (see $$ERROR^MAGUERR)
+19 ;
ERROR(MAGRES,ERR) ;
+1 if ERR'<0
QUIT
+2 NEW MAGPRMS
KILL MAGRES
+3 ; Message text
SET MAGPRMS("ERRMSG")=$PIECE(ERR,U,2)
+4 ; Location
SET MAGPRMS("ERRLOC")=$PIECE(ERR,U,3)
+5 DO BLD^DIALOG(20050005.002,.MAGPRMS,,"MAGRES")
+6 SET MAGRES(0)="2^"_$GET(MAGRES(1))
KILL MAGRES(1)
+7 QUIT
+8 ;
+9 ;+++++ RETURNS THE ROW OF THE CLIENT VERSION CONTROL TABLE
+10 ;
+11 ; ROW Sequential number of the row (starting from 1)
+12 ;
+13 ; Input Variables
+14 ; ===============
+15 ; MAGRTN
+16 ;
GETVCL(ROW) ;
+1 QUIT $PIECE($TEXT(@("CLVERCT+"_(ROW+3)_"^"_MAGRTN)),";;",2)
+2 ;
+3 ;##### RETURNS THE SERVER VERSION AND THE LIST OF SUPPORTED CLIENTS
+4 ;
+5 ; .VCD( Reference to a local variable where the version
+6 ; control data is returned to.
+7 ; CLNAME,
+8 ; "SV") Server version (Major.Minor.Patch.Build)
+9 ; "ST", Server build number (T-version)
+10 ; Ver) Build number of the version Ver release.
+11 ; Ver is in the Major.Minor.Patch format.
+12 ;
+13 ; CLNAME Client name ("CAPTURE", "CLUTILS", "DISPLAY",
+14 ; "TELEREADER", or "VISTARAD")
+15 ;
+16 ; See also the CLVERCT^MAGGTU4C, CLVERCT^MAGGTU4D,
+17 ; CLVERCT^MAGGTU4L, and CLVERCT^MAGGTU4T for client
+18 ; specific version tables.
+19 ;
+20 ; Return Values
+21 ; =============
+22 ; <0 Error descriptor (see $$ERROR^MAGUERR)
+23 ; 0 Success
+24 ;
GETVCD(VCD,CLNAME) ;
+1 ; Name of the routine with the version control table
NEW MAGRTN
+2 ;
+3 NEW BUF,I,SV,TMP,VER
KILL VCD(CLNAME)
+4 FOR I="ST","SV"
SET VCD(CLNAME,I)=""
+5 ;
+6 ;=== Get the name of the routine that contains the
+7 ;=== version control table for the client
+8 SET MAGRTN=$PIECE($$CLADESC(CLNAME),U)
if MAGRTN<0
QUIT MAGRTN
+9 ;
+10 ;=== Get the server version from the second line of the
+11 ;=== routine that contains the version control table
+12 SET BUF=$PIECE($TEXT(@("+2^"_MAGRTN)),";;",2,999)
+13 if BUF=""
QUIT $$ERROR^MAGUERR(-25,,MAGRTN)
+14 ;--- Get the package version
+15 SET SV=$TRANSLATE($PIECE(BUF,";")," ")
+16 ;--- Get the patch number (the last one) from the list
+17 SET TMP=$TRANSLATE($PIECE($PIECE(BUF,";",3),"**",2)," ")
+18 SET SV=SV_"."_(+$PIECE(TMP,",",$LENGTH(TMP,",")))
+19 ;
+20 ;=== Load the version control table
+21 FOR I=1:1
SET BUF=$$GETVCL(I)
if BUF=""
QUIT
Begin DoDot:1
+22 SET BUF=$TRANSLATE(BUF,"| ",U)
SET VER=$PIECE(BUF,U,2)
+23 if VER>0
SET VCD(CLNAME,"ST",VER)=+$PIECE(BUF,U,3)
+24 QUIT
End DoDot:1
+25 ;
+26 ;=== Get the build number and remove the server version from the list
+27 SET VCD(CLNAME,"SV")=SV
+28 SET VCD(CLNAME,"ST")=+$GET(VCD(CLNAME,"ST",SV))
+29 KILL VCD(CLNAME,"ST",SV)
+30 QUIT 0
+31 ;
+32 ;+++++ APPENDS THE CLIENT-SPECIFIC WARNING TO THE ARRAY
+33 ;
+34 ; .MAGRES Reference to the RPC result array that
+35 ; the warning is apppended to.
+36 ;
+37 ; CLNAME Client name
+38 ;
+39 ; CLVER Client application version (Major.Minor.Patch.Build)
+40 ;
+41 ; CVRC Version check code returned by the $$CHKVER1^MAGGTU41
+42 ;
WARNING(MAGRES,CLNAME,CLVER,CVRC) ;
+1 ;--- Do not append the warning if the RPC result array already
+2 ;--- contains an error message that will terminate the client.
+3 if +$GET(MAGRES(0),1)=2
QUIT
+4 ;
+5 NEW EP,MAGBUF,RI,SPI
+6 if $PIECE(CLVER,".",4)=""
SET $PIECE(CLVER,".",4)=0
+7 ;--- Get the name of the client's version control routine
+8 SET EP=$PIECE($$CLADESC(CLNAME),U)
if EP<0
QUIT
+9 SET EP="WARNING^"_EP
if $TEXT(@EP)=""
QUIT
+10 ;--- Get the client-specific warning
+11 XECUTE "D "_EP_"(.MAGBUF,CLVER,CVRC)"
+12 SET SPI=$QUERY(MAGBUF)
if SPI=""
QUIT
+13 ;--- Append the 1st line of the warning text to the result array
+14 ;--- and make sure that the client will diplay the warning
+15 SET RI=$ORDER(MAGRES(""),-1)
+16 IF RI'=""
Begin DoDot:1
+17 SET RI=RI+1
SET MAGRES(RI)=" "
+18 SET RI=RI+1
SET MAGRES(RI)=@SPI
+19 QUIT
End DoDot:1
if +$GET(MAGRES(0),1)=1
SET $PIECE(MAGRES(0),U)=0
+20 IF '$TEST
SET MAGRES(0)="1^"_@SPI
+21 ;--- Append the remaining lines
+22 FOR
SET SPI=$QUERY(@SPI)
if SPI=""
QUIT
SET RI=RI+1
SET MAGRES(RI)=@SPI
+23 QUIT