| 1 | DIALOGU ;SFISC/MMW - FUNCTIONS FOR DIALOGS ;11/21/94  13:26
 | 
|---|
| 2 |  ;;22.0;VA FileMan;;Mar 30, 1999
 | 
|---|
| 3 |  ;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  Q  ;not for interactive use
 | 
|---|
| 5 | OUT(Y,DIALF,%F) ;convert FileMan Data to language dependant output format
 | 
|---|
| 6 |  ;Y is the value to transform, DIALF is the type of data
 | 
|---|
| 7 |  ;%F Only for "FMTE" node. Passed from FMTE^DILIBF, indicates date format.
 | 
|---|
| 8 |  ;DIALF must correspond to at least a subscript in the language file
 | 
|---|
| 9 |  ;for the english language (entry #1) but may also have corresponding
 | 
|---|
| 10 |  ;entries for other languages
 | 
|---|
| 11 |  I $D(Y)[0!($G(DIALF)="") Q ""
 | 
|---|
| 12 |  N DINAKED,DIY S DINAKED=$$LGR^%ZOSV
 | 
|---|
| 13 |  N DILANG S DILANG=+$G(DUZ("LANG")) S:DILANG<1 DILANG=1
 | 
|---|
| 14 |  S DIY=$G(^DI(.85,DILANG,DIALF)) I DIY="" S:DILANG'=1 DIY=$G(^DI(.85,1,DIALF)) I DIY="" S Y="" G Q
 | 
|---|
| 15 |  X DIY
 | 
|---|
| 16 | Q D:DINAKED]""
 | 
|---|
| 17 |  . I DINAKED["(" Q:$O(@(DINAKED))  Q
 | 
|---|
| 18 |  . I $D(@(DINAKED))
 | 
|---|
| 19 |  . Q
 | 
|---|
| 20 |  Q Y
 | 
|---|
| 21 |  ;
 | 
|---|
| 22 | PRS(D0,X) ;parse language dependant user input
 | 
|---|
| 23 |  ;D0 is an entry in the DIALOG file
 | 
|---|
| 24 |  ;X is the user input
 | 
|---|
| 25 |  ;the function returns the number of the matching command word
 | 
|---|
| 26 |  ;plus the corresponding english text. If no match was found -1 will
 | 
|---|
| 27 |  ;be returned. If there is no user input the function returns the
 | 
|---|
| 28 |  ;null string.
 | 
|---|
| 29 |  N DINAKED,Y S DINAKED=$$LGR^%ZOSV
 | 
|---|
| 30 |  I '$D(^DI(.84,+$G(D0)))!($G(X)']"") S Y=0 G Q
 | 
|---|
| 31 |  N R,I,I1,IL,T,W,%,DILANG
 | 
|---|
| 32 |  S DILANG=+$G(DUZ("LANG")) S:DILANG<1 DILANG=1
 | 
|---|
| 33 |  I DILANG>1,'$O(^DI(.84,D0,4,DILANG,1,0)) S DILANG=1
 | 
|---|
| 34 |  S X=$$OUT(X,"UC"),U="^"
 | 
|---|
| 35 |  S R=$S(DILANG=1:"^DI(.84,"_D0_",2)",1:"^DI(.84,"_D0_",4,"_DILANG_",1)")
 | 
|---|
| 36 |  S (I,I1,%)=0 F  S I=$O(@R@(I)) Q:'I!%  S T=$$OUT(@R@(I,0),"UC") D
 | 
|---|
| 37 |  .F IL=1:1 S W=$P(T,U,IL) Q:W=""!%  S I1=I1+1 S:$E(W,1,$L(X))=X %=I1_U_$P(@R@(I,0),U,IL)
 | 
|---|
| 38 |  I '% S Y=-1 G Q
 | 
|---|
| 39 |  I DILANG=1 S Y=% G Q
 | 
|---|
| 40 |  S (I,I1)=0,%=+% F  S I=$O(^DI(.84,D0,2,I)) Q:'I!(I1=%)  S T=^(I,0) D
 | 
|---|
| 41 |  .F IL=1:1 Q:$P(T,U,IL)=""!(I1=%)  S I1=I1+1,W=$P(T,U,IL)
 | 
|---|
| 42 |  S Y=%_U_$G(W) G Q
 | 
|---|