source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIALOG.m@ 1582

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1DIALOG ;SFISC/TKW - BUILD FILEMAN DIALOGUE ;10:29 AM 14 May 2001
2V ;;22.0;VA FileMan;**28,87**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4BLD(D0,DIPI,DIPE,DIALOGO,DIFLAG) ;BUILD FILEMAN DIALOG
5 ;1)DIALOG file IEN, 2)Internal params, 3)External params, 4)Output array name, 5)S=Suppress blank line between messages, F=Format output like ^TMP
6 N DINAKED S DINAKED=$$LGR^%ZOSV
7 I $G(^DI(.84,+$G(D0),0))="" G Q1
8 N E,I,J,K,L,M,N,P,R,S,X,O,DILANG S DILANG=+$G(DUZ("LANG")),DIFLAG=$G(DIFLAG)
9 I $G(DIPE)]"",$O(DIPE(""))="" S DIPE(1)=DIPE
10 I '$O(^DI(.84,D0,4,DILANG,1,0))!('DILANG) S DILANG=1
11 S P=$P(^DI(.84,+D0,0),U,3)["y",R=$P(^(0),U,2) S:'R R=1
12 S O=$G(DIALOGO) S:O="" O="^TMP(",DIFLAG=DIFLAG_"F" D S DIALOGO=O
13 . S I=$E(O,$L(O)) I $E(O,1,4)="DIR(" S DIFLAG=$TR(DIFLAG,"F","")
14 . I DIFLAG'["F" S O=$E(O,1,($L(O)-1))_$S(I="(":"",I=",":")",1:I) Q
15 . S O=$P(O,")",1)_$S("(,"[I:"",O'["(":"(",1:",")_""""_$P("DIERR^DIMSG^DIHELP",U,R)_""""_$P(","_$J,U,O["^TMP(")_")"
16 . Q
17 S N=$O(@DIALOGO@(":"),-1)
18 S N=N+1,(I,J,M)=0 S:R>1!(DIFLAG'["F") J=N-1
19 I R=1,DIFLAG["F" S O=$P(O,")",1)_","_N_",""TEXT"")"
20 I DILANG>1 F S I=$O(^DI(.84,D0,4,DILANG,1,I)) Q:'I S M=M+1,K(M)=$G(^(I,0)) I P S L=0 D PARAM
21 I DILANG'>1 F S I=$O(^DI(.84,D0,2,I)) Q:'I S M=M+1,K(M)=$G(^(I,0)) I P S L=0 D PARAM
22 G:'M Q2 D
23 . N X S X=M
24 . I N>1,DIFLAG'["S" I DIFLAG'["F"!(R>1) S J=J+1,@O@(J)=" ",X=X+1
25 . I DIALOGO'["DIR" S:R=1 DIERR=($P($G(DIERR),U)+1)_U_($P($G(DIERR),U,2)+X) S:R=2 DIMSG=$G(DIMSG)+X S:R=3 DIHELP=$G(DIHELP)+X
26 . D BTXT Q
27 I (DIALOGO["DIR")!(R'=1)!(DIFLAG'["F") G Q2
28 S @DIALOGO@(N)=D0
29 S I="",J=0 F S I=$O(DIPE(I)) Q:I="" I $G(DIPE(I))]"" S @DIALOGO@(N,"PARAM",I)=DIPE(I),J=J+1
30 I J S @DIALOGO@(N,"PARAM",0)=J
31 S @DIALOGO@("E",D0,N)=""
32 ;
33Q2 I $G(^DI(.84,D0,6))]"" X ^(6)
34Q1 Q:DINAKED="" I DINAKED["(" Q:$O(@(DINAKED))]"" Q
35 I $D(@(DINAKED))
36 Q
37 ;
38PARAM S S=$F(K(M),"|",L) G:'S QP S E=$F(K(M),"|",S) G:'E QP
39 S X=$E(K(M),S,E-2) G:X="" PARAM
40 S DIPI(X)=$S($G(DIPI(X))]"":DIPI(X),1:$G(DIPI)),L=S+$L(DIPI(X))-$L(X)
41 I ($L(K(M))+$L(DIPI(X)))<245 S K(M)=$E(K(M),1,S-2)_DIPI(X)_$E(K(M),E,9999) G:K(M)]"" PARAM K K(M) S M=M-1 G QP
42 I $L($E(K(M),1,S-2))+$L(DIPI(X))<245 S K(M+1)=$E(K(M),E,9999),K(M)=$E(K(M),1,S-2)_DIPI(X),M=M+1,L=0 G PARAM
43 I $L(DIPI(X))+$L($E(K(M),E,9999))<245 S K(M+1)=DIPI(X)_$E(K(M),E,9999),K(M)=$E(K(M),1,S-2),M=M+1,L=0 G PARAM
44 S K(M+1)=DIPI(X),K(M+2)=$E(K(M),E,9999),K(M)=$E(K(M),1,S-2),M=M+2,L=0
45 G PARAM
46QP Q
47 ;
48BTXT N M
49 F M=0:0 S M=$O(K(M)) Q:'M S J=J+1 D
50 .I DIALOGO'["DIR" S @O@(J)=K(M) Q
51 .I '$O(K(M)),'$O(^DI(.84,D0,2,I)) S @DIALOGO=K(M) Q
52 .S @DIALOGO@(J)=K(M) Q
53 Q
54 ;
55EZBLD(D0,DIPI) ;RETURN SINGLE LINE OF TEXT FROM DIALOG FILE.
56 ;D0 = DIALOG file IEN, DIPI = Input Params
57 N DINAKED S DINAKED=$$LGR^%ZOSV I $G(^DI(.84,+$G(D0),0))="" D Q1 Q ""
58 N DILANG S DILANG=+$G(DUZ("LANG"))
59 N X I DILANG>1 S X=$O(^DI(.84,+D0,4,DILANG,1,0)) S:X X=$G(^(X,0))
60 I $G(X)']"" S X=$O(^DI(.84,+D0,2,0)) S:X X=$G(^(X,0))
61 I ($P(^DI(.84,+D0,0),"^",3)'["y"!($G(X)="")) S X=$G(X) G QEZ
62 N K,S,L,M,I,E S M=1,L=0,K(M)=X
63 I $G(DIPI)]"",$O(DIPI(""))="" S DIPI(1)=DIPI
64 D PARAM S X=$G(K(1))
65QEZ D Q X
66 . N X D Q2 Q
67 ;
68 ;
69MSG(DIFLGS,DIOUT,DIMARGIN,DICOLUMN,DIINNAME) ;WRITE MESSAGES OR MOVE THEM TO SIMPLE ARRAY.
70 ;1)Flags, 2)Output array name, 3)Margin width of text, 4)Starting column no., 5)Input array name.
71 N Z,%,X,Y,I,J,K,N,DITYP,DIWIDTH,DITMP,DIIN,DINAKED S DINAKED=$$LGR^%ZOSV
72 S:$G(DIFLGS)="" DIFLGS="W" D
73 . S DITMP=0 I $G(DIINNAME)="" S DIINNAME="^TMP(",DITMP=1 Q
74 . N % S %=DIINNAME I %'["(" S DIINNAME=DIINNAME_"(" Q
75 . Q:$E(%,$L(%))=","
76 . I $E(%,$L(%))=")" S DIINNAME=$P(%,")",1)_"," Q
77 . S DIINNAME=%_"," Q
78 S DITYP="",%=0 D
79 . F Z="E","H","M" S %=%+1 I DIFLGS[Z,$D(@(DIINNAME_""""_$P("DIERR^DIHELP^DIMSG",U,%)_""""_$P(","_$J,U,(DITMP>0))_")")) S $P(DITYP,U,%)=$P("DIERR^DIHELP^DIMSG",U,%)
80 . I DITYP="",$D(@(DIINNAME_"""DIERR"""_$P(","_$J,U,(DITMP>0))_")")) S DITYP="DIERR"
81 . Q
82 S DIWIDTH=$S($G(DIMARGIN):DIMARGIN,$G(IOM):(IOM-5),1:75),DICOLUMN=+$G(DICOLUMN)
83 K:DIFLGS["A" DIOUT S (K,Z)=0
84AWS S K=K+1 I K>3 G Q1
85 G:$P(DITYP,U,K)="" AWS
86 S DIIN=DIINNAME_""""_$P(DITYP,U,K)_"""" S:DITMP DIIN=DIIN_","_$J
87 S (I,N)=0
88 F S N=$O(@(DIIN_")")@(N)) Q:'N S:K>1 X=$G(@(DIIN_","_N_")")) D:K>1 I K=1 D:I&(DIFLGS'["B") LN S I=1,J=0 F S J=$O(@(DIIN_")")@(N,"TEXT",J)) Q:'J S X=$G(@(DIIN_","_N_",""TEXT"","_J_")")) D
89 . I DIFLGS["A",'$G(DIMARGIN) S Z=Z+1,DIOUT(Z)=X
90 . I DIFLGS'["W",'$G(DIMARGIN) Q
91 . S Y=X D:X="" F Q:X="" F %=$L(X," "):-1:1 S:%=1&($L($P(X," ",1,%))>DIWIDTH) X=$E(X,1,(DIWIDTH-1))_" "_$E(X,DIWIDTH,$L(X)),%=%+1 I $L($P(X," ",1,%))'>DIWIDTH S Y=$P(X," ",1,%) D S X=$P(X," ",%+1,$L(X," ")) Q
92 .. W:DIFLGS["W" !?DICOLUMN,Y S:DIFLGS["A"&$G(DIMARGIN) Z=Z+1,DIOUT(Z)=Y
93 .. Q
94 . Q
95 F I=K:1:2 I $P(DITYP,U,I+1)]"" D LN Q
96 I DIFLGS["A",DIFLGS["T" S DIOUT=Z
97 I DIFLGS'["S" K @(DIIN_")"),@($P(DITYP,U,K))
98 G AWS
99 ;
100LN W:DIFLGS["W" ! S:(DIFLGS["A")&Z Z=Z+1,DIOUT(Z)="" Q
Note: See TracBrowser for help on using the repository browser.