XQORD ; SLC/KCM - Dialog Utility ;11/19/92 08:27 [ 05/08/95 4:16 PM ]
;;8.0;KERNEL;;Jul 10, 1995
EN D NUL^XQOR2 N DLG,ITM,X,XQORDX ;Process individual prompt
S DLG=+^TMP("XQORS",$J,XQORS-1,"VPT"),ITM=+^TMP("XQORS",$J,XQORS-1,"ITM",^TMP("XQORS",$J,XQORS-1,"ITM"),"IEN")
S X=$G(^ORD(101,DLG,10,ITM,1)),XQORDX("PRMT")=$P(X,"^",1),XQORDX("DFLT")=$P(X,"^",2),XQORDX("HELP")=$P(X,"^",3),XQORDX("MODE")=$P(X,"^",4)
S X=$G(^ORD(101,+XQORNOD,101.04)),XQORDX("DOM")=$P(X,"^",1),XQORDX("PARM")=$P(X,"^",5)
S:'$L(XQORDX("PRMT")) XQORDX("PRMT")=$P(X,"^",2) S:'$L(XQORDX("DFLT")) XQORDX("DFLT")=$P(X,"^",3) S:'$L(XQORDX("HELP")) XQORDX("HELP")=$P(X,"^",4)
S XQORDLG(ITM,"PRMT")=XQORDX("PRMT")_"^"_XQORDX("MODE"),XQORDLG("SEQ",+^TMP("XQORS",$J,XQORS-1,"ITM"))=ITM
I XQORDX("MODE")["E",$D(XQORMSG),XQORMSG="NEW" D G XEN
. I '$D(XQORDLG(ITM,1)),$L(XQORDX("DFLT")) S XQORDLG(ITM,1,"I")="",XQORDLG(ITM,1,"E")=XQORDX("DFLT")
;
; -- case prompt type (XQORDX("DOM"))
I "DFLNPSY"[XQORDX("DOM") D RDR^XQORD1 G C1
I XQORDX("DOM")="W" D WP^XQORD1 G C1
I XQORDX("DOM")="M" D MENU^XQORD1 G C1
C1 ; -- end case prompt type
;
; -- case up-arrow status (X)
I $E(X)'="^" D SETANS G C2 ;valid entry
S X=$P(X,"^",2) I '$L(X) S XQORPOP=1,XQORDLG=-1 G C2 ;up arrow out
I $D(^TMP("XQORS",$J,XQORS-1,"PMT",$$UP(X))) S ^TMP("XQORS",$J,XQORS-1,"ITM")=$O(^($$UP(X),0))-1 G C2 ;full name jump
S Y=$O(^TMP("XQORS",$J,XQORS-1,"PMT",$$UP(X))) ;partial name jump
I $E(Y,1,$L(X))=$$UP(X) S ^TMP("XQORS",$J,XQORS-1,"ITM")=$O(^TMP("XQORS",$J,XQORS-1,"PMT",Y,0))-1 G C2
W " ??" S ^TMP("XQORS",$J,XQORS-1,"ITM")=^TMP("XQORS",$J,XQORS-1,"ITM")-1 ;otherwise...
C2 ; -- end case up-arrow status
;
XEN Q ;Exit: XQORDLG(n)=external value of response
;
SETANS ;Setup answers in array according to type, calling info in X,Y
;Entry: .X is external value, .Y is internal value, XQORDX("DOM") is prompt type
S XQORDLG(ITM)=""
I $L(Y) DO
. ; -- case prompt type (XQORDX("DOM"))
. I XQORDX("DOM")="D" D DD^%DT S XQORDLG(ITM)=Y G C3 ;date/Time
. I XQORDX("DOM")="F" S XQORDLG(ITM)=Y G C3 ;free Text
. I XQORDX("DOM")="L" S XQORDLG(ITM)=X G C3 ;list/Range
. I XQORDX("DOM")="N" S XQORDLG(ITM)=Y G C3 ;numeric
. I XQORDX("DOM")="P" S XQORDLG(ITM)=$P(Y,"^",2) G C3 ;pointer
. I XQORDX("DOM")="S" S XQORDLG(ITM)=Y(0) G C3 ;set
. I XQORDX("DOM")="Y" S XQORDLG(ITM)=$S(Y=0:"NO",Y=1:"YES",1:"") G C3 ;yes/no
. I XQORDX("DOM")="W" S XQORDLG(ITM)=Y G C3 ;word processing
. I XQORDX("DOM")="M" DO G C3 ;menu
. . N I S I=0 F S I=$O(Y(I)) Q:I<1 DO
. . . S XQORDLG(ITM)=$P(Y(I),"^",3)_","
. . S XQORDLG(ITM)=$E(XQORDLG(ITM),1,$L(XQORDLG(ITM))-1)
C3 . ; -- end case prompt type
. ;
Q
UP(X) Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXQORD 2780 printed Oct 16, 2024@18:07:01 Page 2
XQORD ; SLC/KCM - Dialog Utility ;11/19/92 08:27 [ 05/08/95 4:16 PM ]
+1 ;;8.0;KERNEL;;Jul 10, 1995
EN ;Process individual prompt
DO NUL^XQOR2
NEW DLG,ITM,X,XQORDX
+1 SET DLG=+^TMP("XQORS",$JOB,XQORS-1,"VPT")
SET ITM=+^TMP("XQORS",$JOB,XQORS-1,"ITM",^TMP("XQORS",$JOB,XQORS-1,"ITM"),"IEN")
+2 SET X=$GET(^ORD(101,DLG,10,ITM,1))
SET XQORDX("PRMT")=$PIECE(X,"^",1)
SET XQORDX("DFLT")=$PIECE(X,"^",2)
SET XQORDX("HELP")=$PIECE(X,"^",3)
SET XQORDX("MODE")=$PIECE(X,"^",4)
+3 SET X=$GET(^ORD(101,+XQORNOD,101.04))
SET XQORDX("DOM")=$PIECE(X,"^",1)
SET XQORDX("PARM")=$PIECE(X,"^",5)
+4 if '$LENGTH(XQORDX("PRMT"))
SET XQORDX("PRMT")=$PIECE(X,"^",2)
if '$LENGTH(XQORDX("DFLT"))
SET XQORDX("DFLT")=$PIECE(X,"^",3)
if '$LENGTH(XQORDX("HELP"))
SET XQORDX("HELP")=$PIECE(X,"^",4)
+5 SET XQORDLG(ITM,"PRMT")=XQORDX("PRMT")_"^"_XQORDX("MODE")
SET XQORDLG("SEQ",+^TMP("XQORS",$JOB,XQORS-1,"ITM"))=ITM
+6 IF XQORDX("MODE")["E"
IF $DATA(XQORMSG)
IF XQORMSG="NEW"
Begin DoDot:1
+7 IF '$DATA(XQORDLG(ITM,1))
IF $LENGTH(XQORDX("DFLT"))
SET XQORDLG(ITM,1,"I")=""
SET XQORDLG(ITM,1,"E")=XQORDX("DFLT")
End DoDot:1
GOTO XEN
+8 ;
+9 ; -- case prompt type (XQORDX("DOM"))
+10 IF "DFLNPSY"[XQORDX("DOM")
DO RDR^XQORD1
GOTO C1
+11 IF XQORDX("DOM")="W"
DO WP^XQORD1
GOTO C1
+12 IF XQORDX("DOM")="M"
DO MENU^XQORD1
GOTO C1
C1 ; -- end case prompt type
+1 ;
+2 ; -- case up-arrow status (X)
+3 ;valid entry
IF $EXTRACT(X)'="^"
DO SETANS
GOTO C2
+4 ;up arrow out
SET X=$PIECE(X,"^",2)
IF '$LENGTH(X)
SET XQORPOP=1
SET XQORDLG=-1
GOTO C2
+5 ;full name jump
IF $DATA(^TMP("XQORS",$JOB,XQORS-1,"PMT",$$UP(X)))
SET ^TMP("XQORS",$JOB,XQORS-1,"ITM")=$ORDER(^($$UP(X),0))-1
GOTO C2
+6 ;partial name jump
SET Y=$ORDER(^TMP("XQORS",$JOB,XQORS-1,"PMT",$$UP(X)))
+7 IF $EXTRACT(Y,1,$LENGTH(X))=$$UP(X)
SET ^TMP("XQORS",$JOB,XQORS-1,"ITM")=$ORDER(^TMP("XQORS",$JOB,XQORS-1,"PMT",Y,0))-1
GOTO C2
+8 ;otherwise...
WRITE " ??"
SET ^TMP("XQORS",$JOB,XQORS-1,"ITM")=^TMP("XQORS",$JOB,XQORS-1,"ITM")-1
C2 ; -- end case up-arrow status
+1 ;
XEN ;Exit: XQORDLG(n)=external value of response
QUIT
+1 ;
SETANS ;Setup answers in array according to type, calling info in X,Y
+1 ;Entry: .X is external value, .Y is internal value, XQORDX("DOM") is prompt type
+2 SET XQORDLG(ITM)=""
+3 IF $LENGTH(Y)
Begin DoDot:1
+4 ; -- case prompt type (XQORDX("DOM"))
+5 ;date/Time
IF XQORDX("DOM")="D"
DO DD^%DT
SET XQORDLG(ITM)=Y
GOTO C3
+6 ;free Text
IF XQORDX("DOM")="F"
SET XQORDLG(ITM)=Y
GOTO C3
+7 ;list/Range
IF XQORDX("DOM")="L"
SET XQORDLG(ITM)=X
GOTO C3
+8 ;numeric
IF XQORDX("DOM")="N"
SET XQORDLG(ITM)=Y
GOTO C3
+9 ;pointer
IF XQORDX("DOM")="P"
SET XQORDLG(ITM)=$PIECE(Y,"^",2)
GOTO C3
+10 ;set
IF XQORDX("DOM")="S"
SET XQORDLG(ITM)=Y(0)
GOTO C3
+11 ;yes/no
IF XQORDX("DOM")="Y"
SET XQORDLG(ITM)=$SELECT(Y=0:"NO",Y=1:"YES",1:"")
GOTO C3
+12 ;word processing
IF XQORDX("DOM")="W"
SET XQORDLG(ITM)=Y
GOTO C3
+13 ;menu
IF XQORDX("DOM")="M"
Begin DoDot:2
+14 NEW I
SET I=0
FOR
SET I=$ORDER(Y(I))
if I<1
QUIT
Begin DoDot:3
+15 SET XQORDLG(ITM)=$PIECE(Y(I),"^",3)_","
End DoDot:3
+16 SET XQORDLG(ITM)=$EXTRACT(XQORDLG(ITM),1,$LENGTH(XQORDLG(ITM))-1)
End DoDot:2
GOTO C3
C3 ; -- end case prompt type
+1 ;
End DoDot:1
+2 QUIT
UP(X) QUIT $TRANSLATE(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")