source: WorldVistAEHR/trunk/r/ONCOLOGY-ONC/ONCSAPIU.m@ 1154

Last change on this file since 1154 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1ONCSAPIU ;Hines OIFO/SG - COLLABORATIVE STAGING (UTILITIES) ; 12/7/06 9:08am
2 ;;2.11;ONCOLOGY;**40,47**;Mar 07, 1995;Build 19
3 ;
4 Q
5 ;
6 ;***** RETURNS THE CS WEB-SERVICE URL
7 ;
8 ; Return values:
9 ; <0 Error Descriptor
10 ; ... The CS URL
11 ;
12GETCSURL() ;
13 N DIV,HOST,IEN,ONCMSG,PATH,PORT,RC,URL
14 ;--- Try to get the URL from the site parameters
15 S DIV=+$G(DUZ(2)),IEN=+$O(^ONCO(160.1,"C",DIV,""))
16 I IEN'>0 S IEN=+$O(^ONCO(160.1,0)) Q:IEN'>0 $$ERROR^ONCSAPIE(-22)
17 S URL=$$GET1^DIQ(160.1,IEN,19,,,"ONCMSG")
18 Q:URL="" $$ERROR^ONCSAPIE(-22)
19 ;--- Parse the URL and supply the missing parts
20 S RC=$$PARSE^ONCXURL(URL,.HOST,.PORT,.PATH)
21 Q:RC<0 $$ERROR^ONCSAPIE(-11,URL)
22 S:$G(PORT)'>0 PORT=7005
23 S:$G(PATH)="" PATH="/cgi-bin/CStage"
24 ;--- Construct the resulting URL
25 Q $$CREATE^ONCXURL(HOST,PORT,PATH)
26 ;
27 ;***** PAUSES THE OUTPUT AT PAGE END
28 ;
29 ; Return values:
30 ; -2 Timeout
31 ; -1 User entered a '^'
32 ; 0 Continue
33 ;
34PAGE() ;
35 I $E(IOST,1,2)'="C-" S $Y=0 Q 0
36 N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
37 S DIR(0)="E" D ^DIR S $Y=0
38 Q $S($D(DUOUT):-1,$D(DTOUT):-2,1:0)
39 ;
40 ;***** UPDATES THE CS WEB-SERVICE URL
41 ;
42 ; URL New URL of the CS web-service
43 ;
44 ; Return values:
45 ;
46 ; <0 Error Descriptor
47 ; 0 Ok
48 ;
49UPDCSURL(URL) ;
50 N IEN,IENS,ONCFDA,ONCMSG,RC
51 Q:$G(URL)?." " $$ERROR^ONCSAPIE(-6,,"URL",$G(URL))
52 ;--- Lock the ONCOLOGY SITE PARAMETERS file
53 L +^ONCO(160.1):1 E D Q RC
54 . S RC=$$ERROR^ONCSAPIE(-15,,"ONCOLOGY SITE PARAMETERS file")
55 ;--- Update the record(s)
56 S (IEN,RC)=0
57 F S IEN=$O(^ONCO(160.1,IEN)) Q:IEN'>0 D Q:RC<0
58 . S IENS=IEN_"," K ONCFDA,ONCMSG
59 . S ONCFDA(160.1,IENS,19)=URL
60 . D FILE^DIE(,"ONCFDA","ONCMSG")
61 . S:$G(DIERR) RC=$$DBS^ONCSAPIE("ONCMSG",-9,160.1,IENS)
62 ;--- Cleanup and error processing
63 L -^ONCO(160.1)
64 Q $S(RC<0:RC,1:0)
65 ;
66 ;***** WRAPS THE STRING AND PRINTS IT
67 ;
68 ; X Source string
69 ; [DIWR] Output width (IOM, by default)
70 ;
71WW(X,DIWR) ;
72 N DIWF,DIWL,I,TMP
73 S:$G(DIWR)'>0 DIWR=$G(IOM,80)
74 K ^UTILITY($J,"W")
75 ;--- Wrap the string
76 S DIWL=1,DIWF="|" D ^DIWP
77 ;--- Print the text
78 S I=""
79 F S I=$O(^UTILITY($J,"W",DIWL,I)) Q:I="" D
80 . S TMP=$G(^UTILITY($J,"W",DIWL,I,0))
81 . D EN^DDIOL($$TRIM^XLFSTR(TMP,"R"))
82 ;--- Cleanup
83 K ^UTILITY($J,"W")
84 Q
85 ;
86 ;***** EMULATES AND EXTENDS THE ZWRITE COMMAND :-)
87 ;
88 ; ROR8NODE Closed root of the sub-tree to display
89 ; (either local array or global variable)
90 ; [TITLE] Title of the output
91 ; [NONAME] Do not print node names
92 ;
93ZW(ONC8NODE,TITLE,NONAME) ;
94 Q:ONC8NODE="" Q:'$D(@ONC8NODE)
95 N FLT,L,PI W !
96 W:$G(TITLE)'="" TITLE,!!
97 S NONAME=+$G(NONAME)
98 W:$D(@ONC8NODE)#10 ONC8NODE_"="""_@ONC8NODE_"""",!
99 S L=$L(ONC8NODE) S:$E(ONC8NODE,L)=")" L=L-1
100 S FLT=$E(ONC8NODE,1,L),PI=ONC8NODE
101 F S PI=$Q(@PI) Q:$E(PI,1,L)'=FLT D
102 . W:'NONAME PI_"=" W """"_@PI_"""",!
103 Q
Note: See TracBrowser for help on using the repository browser.