source: cprs/branches/tmg-cprs/m_files/TMGRPC1D.m@ 895

Last change on this file since 895 was 895, checked in by Kevin Toppenberg, 14 years ago

fixing soft links

File size: 8.5 KB
Line 
1TMGRPC1D ;TMG/kst-RPC Functions ;07/21/10
2 ;;1.0;TMG-LIB;**1**;07/21/10
3
4 ;"TMG RPC FUNCTIONS especially related to imaging.
5
6 ;"Kevin Toppenberg MD
7 ;"GNU General Public License (GPL) applies
8 ;"7/21/10
9
10 ;"=======================================================================
11 ;" RPC -- Public Functions.
12 ;"=======================================================================
13 ;"CONFIG -- Set up imaging site parameters, so that TMG-CPRS works.
14 ;"TESTCFG -- Test configuration
15 ;"=======================================================================
16 ;"PRIVATE API FUNCTIONS
17 ;"=======================================================================
18 ;"PINST1 - entry point for POST-INSTALL routine for patch TMG-CPRS-IMAGING*1.0*1
19 ;
20 ;"=======================================================================
21 ;"Dependancies: TMGKERNL,TMGUSRIF
22 ;"=======================================================================
23 ;
24CONFIG ;
25 ;"Purpose: Set up imaging site parameters, so that TMG-CPRS works.
26 ;"Input: None
27 ;"Results: none
28 ;
29 WRITE " ------------------------------------------",!
30 WRITE " - Configuration of TMG Imaging -",!
31 WRITE " ------------------------------------------",!,!
32 ;
33 ;"First get default INSTITUTION, stored in KERNEL SYSTEM PARAMETERS file.
34 NEW %,DA,DR,DIE,DIC,X,Y,DIK
35 NEW TMGFDA,TMGMSG,TMGDIV,TMGDROP,TMGSTORE,TMGNODIV
36 NEW INSTPTR,IMGSPPTR
37CF1 SET INSTPTR=+$PIECE($GET(^XTV(8989.3,1,"XUS")),"^",17) ;"Ptr to file $4 (Institution)
38 IF INSTPTR>0 DO GOTO CF2
39 . WRITE "Using DEFAULT INSTITUTION: ",$$GET1^DIQ(4,INSTPTR,.01),!
40 WRITE "No value for DEFAULT INSTITUTION found in field 217 in file KERNEL SYSTEM PARAMETERS",!
41 WRITE "Edit settings now to correct this"
42 SET %=1 DO YN^DICN WRITE !
43 IF %'=1 GOTO CFDN
44 SET DA=1,DR="[XUSITEPARM]",DIE=8989.3
45 DO XUDIE^XUS5 ;"Launch screenman form to edit KERNEL SYSTEM PARAMETERS.
46 GOTO CF1
47 ;
48CF2 ;"Now get IMAGING SITE PARAMETERS for Institution Name
49 SET IMGSPPTR=+$ORDER(^MAG(2006.1,"B",INSTPTR,0))
50 IF IMGSPPTR>0 DO GOTO CF3
51 . WRITE "Using IMAGING SITE PARAMETERS IEN #",IMGSPPTR,", "
52 . WRITE $$GET1^DIQ(2006.1,IMGSPPTR,.01),!
53 WRITE "Next, a entry in IMAGING SITE PARAMENTERS file must be linked in.",!
54 WRITE "Please select entry to use, or add a new one if needed.",!
55 DO PRESSTOCONT^TMGUSRIF
56 SET DIC=2006.1,DIC(0)="MAEQL"
57 DO ^DIC WRITE !
58 IF Y>-1 SET IMGSPPTR=+Y GOTO CF2B
59 WRITE "Valid entry in IMAGING SITE PARAMETERS file not selected.",!
60 SET %=1
61 WRITE "Start over" DO YN^DICN WRITE !
62 IF %=1 GOTO CF1
63 GOTO ABORT
64CF2B KILL TMGFDA,TMGMSG
65 SET TMGFDA(2006.1,IMGSPPTR_",",.01)=INSTPTR
66 DO FILE^DIE("K","TMGFDA","TMGMSG")
67 IF $DATA(TMGMSG("DIERR")) DO GOTO ABORT
68 . DO ShowDIERR^TMGDEBUG(.TMGMSG)
69 GOTO CF2 ;"loop back just be sure the B index is setup.
70 ;
71CF3 ;"Now get NETWORK LOCATION stored in IMAGING SITE PARAMETERS record
72 NEW LOCPTR SET LOCPTR=+$PIECE($GET(^MAG(2006.1,IMGSPPTR,0)),"^",3)
73 IF LOCPTR>0 DO GOTO CF4
74 . WRITE "Using NETWORK LOCATION IEN #",LOCPTR,", "
75 . WRITE $$GET1^DIQ(2005.2,LOCPTR,.01),!
76 WRITE "Next, a entry in NETWORK LOCATION file must be linked in.",!
77 WRITE "Please select entry to use, or add a new one if needed.",!
78 DO PRESSTOCONT^TMGUSRIF
79 SET DIC=2005.1,DIC(0)="MAEQL"
80 IF Y>-1 SET LOCPTR=+Y GOTO CF4
81 WRITE "Valid entry in NETWORK LOCATION file not selected.",!
82 SET %=1
83 WRITE "Start over" DO YN^DICN WRITE !
84 IF %=1 GOTO CF1
85 GOTO ABORT
86 ;
87CF4 ;"Now set up NETWORK LOCATION file.
88 WRITE !,"A NODE DIVIDER is the symbol used to separt folders in a path",!
89 WRITE "E.g. for UNIX, with a sample path of '/opt/var/me', uses '/'",!
90 WRITE "For Windows, with sample path of 'c:\temp\me', uses '\'",!
91 SET %=1,TMGNODIV=0
92 SET TMGDIV=$$GET1^DIQ(2005.2,LOCPTR,22701)
93 IF TMGDIV'="" DO
94 . WRITE "Current Node divider= '",TMGDIV,"'"
95 . SET %=2
96 . IF TMGDIV="/" WRITE " (UNIX filesystem)",!
97 . ELSE IF TMGDIV="\" WRITE " (WINDOWS filesystem)",!
98 . ELSE WRITE " (?? filesystem)",! SET %=1
99 WRITE "Do you want to specify a NODE DIVIDER" DO YN^DICN WRITE !
100 IF %=-1 GOTO ABORT
101 IF %=2 SET TMGNODIV=1 GOTO CF4A
102 ;
103 WRITE "Is the server running on a Linux/Unix box" DO YN^DICN WRITE !
104 IF %=-1 GOTO ABORT
105 IF %=1 SET TMGDIV="/"
106 ELSE SET TMGDIV="\"
107 ;
108CF4A WRITE !,"A DROPBOX is a file folder where the server may place files for",!
109 WRITE "pick up by a client (i.e. CPRS). This folder could be on a ",!
110 WRITE "separate file system (e.g. a windows file system mounted into",!
111 WRITE "the server file system.) This is a security measure that negates",!
112 WRITE "a need for the client to have read access to the entire images",!
113 WRITE "folder. A dropbox path is only required if client is configured",!
114 WRITE "to use it.",!
115 SET %=1
116 SET TMGDROP=$$GET1^DIQ(2005.2,LOCPTR,22702)
117 IF TMGDROP'="" DO
118 . WRITE "Current DROPBOX: ",TMGDROP,!,!
119 . SET %=2
120 WRITE "Do you want to specify a DROPBOX FOLDER" DO YN^DICN WRITE !
121 IF %=-1 GOTO ABORT
122 IF %=2 SET TMGDROP="" GOTO CF4C
123 ;
124CF4B WRITE "Enter full path of the DROPBOX is it would be accessed on the ",!
125 WRITE "server (**NOT the path that the client would use**)",!
126 READ "Enter full DROPBOX path (^ to abort): ",TMGDROP:DTIME,!
127 IF TMGDROP="^" GOTO ABORT
128 IF TMGDROP="" WRITE ! GOTO CF4A
129 IF $$IsDir^TMGKERNL(TMGDROP,TMGDIV)=1 GOTO CF4B
130 WRITE "ERROR: Path specified is not valid. Does folder exist?",!,!
131 GOTO CF4B
132 ;
133CF4C WRITE !,"A STORE PATH is the file folder that the server will use to",!
134 WRITE "store images. This should be a complete and valid path.",!
135 SET %=1
136 SET TMGSTORE=$$GET1^DIQ(2005.2,LOCPTR,22700)
137 IF TMGSTORE'="" DO
138 . WRITE "Current image file storage path: ",TMGSTORE,!
139 . SET %=2
140 WRITE "Do you want to specify a STORE FOLDER" DO YN^DICN WRITE !
141 IF %=-1 GOTO ABORT
142 IF %=2 SET TMGSTORE="" GOTO CF4D
143 ;
144 READ "Enter store path (^ to abort): ",TMGSTORE:DTIME,!
145 IF TMGDROP="^" GOTO ABORT
146 IF TMGSTORE="" WRITE ! GOTO CF4C
147 IF $$IsDir^TMGKERNL(TMGSTORE,TMGDIV)=1 GOTO CF4D
148 WRITE "ERROR: Path specified is not valid. Does folder exist?",!,!
149 GOTO CF4C
150 ;
151CF4D ;"Next force field 1 (PHYSICAL REFERENCE) to be same as TMGDIV
152 IF $PIECE($GET(^MAG(2005.2,LOCPTR,0)),"^",2)=TMGDIV GOTO CF4E
153 SET DIK="^MAG(2005.2,"
154 SET DA=LOCPTR
155 DO ^DIK ;"Kill prior entry. Leaves DIK and DA unchanged
156 ;"Note: Input transform doesn't allow the value I put in here.
157 SET $PIECE(^MAG(2005.2,LOCPTR,0),"^",2)=TMGDIV ;"NOTE!! Low-level write
158 SET DIK(1)=1 ;"Field 1 = PHYSICAL REFERENCE
159 DO EN^DIK ;"Reindex field, to populate crossrefences with new value.
160 ;
161CF4E KILL TMGFDA,TMGMSG
162 IF TMGSTORE'="" SET TMGFDA(2005.2,LOCPTR_",",22700)=TMGSTORE
163 IF TMGNODIV=0 SET TMGFDA(2005.2,LOCPTR_",",22701)=TMGDIV
164 IF TMGDROP'="" SET TMGFDA(2005.2,LOCPTR_",",22702)=TMGDROP
165 IF $DATA(TMGFDA) DO FILE^DIE("K","TMGFDA","TMGMSG")
166 IF $DATA(TMGMSG("DIERR")) DO GOTO ABORT
167 . DO ShowDIERR^TMGDEBUG(.TMGMSG)
168 WRITE !,"Done with configuration.",!,!
169 DO TESTCFG
170 GOTO CFDN
171 ;
172ABORT WRITE "Aborting configuration process.",!
173 WRITE "Try again later, using 'DO CONFIG^TMGRPC1D'",!
174CFDN QUIT
175 ;
176 ;
177TESTCFG ;
178 ;"Purpose: Test configuration
179 NEW LOCPTR SET LOCPTR=$$GETDEFNL^TMGRPC1C()
180 IF LOCPTR'>0 DO QUIT
181 . WRITE "ERROR: Can't find NETWORK LOCATION to use",!
182 WRITE "Storage path: ",$$GETLOCFPATH^TMGRPC1C("/"),!
183 NEW DROPPATH
184 IF $$GETDROPPATH^TMGRPC1C(LOCPTR,.DROPPATH)=-1 DO QUIT
185 . WRITE "ERROR: Unable to get Dropbox path",!
186 WRITE "Dropbox path: ",DROPPATH,!
187 QUIT
188 ;
189PINST1 ;
190 ;"Purpose: This is an entry point for POST-INSTALL routine for patch
191 ;" TMG-CPRS-IMAGING*1.0*1
192 DO ENSUREAL^TMGRPC1B
193 DO CONFIG
194 QUIT
195 ;
Note: See TracBrowser for help on using the repository browser.