source: FOIAVistA/trunk/r/LIST_MANAGER-VALM/VALM.m@ 812

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1VALM ;MJK/ALB - List Manager ;05/13/2003 12:09
2 ;;1.0;List Manager;**1,5,6,7**;Aug 13, 1993
3EN(NAME,PARMS) ; -- main entry point
4 ; input: NAME := free text name of list template or routine call
5 ; PARMS := parameter list
6 I $G(PARMS)["T" K VALMEVL ; kill if 'T'op level
7 D INIT^VALM0(.NAME,$G(PARMS)) G ENQ:$D(VALMQUIT)
8 ; -- build list of items
9 I $G(^TMP("VALM DATA",$J,VALMEVL,"INIT"))]"" X ^("INIT") G ENQ:$D(VALMQUIT)
10 ; -- start event loop
11 S VALMBCK="R" D ASK
12 X:$G(^TMP("VALM DATA",$J,VALMEVL,"FNL"))]"" ^("FNL")
13ENQ D POP^VALM0
14 Q
15ASK ; -- event loop
16 S X=VALM("PROTOCOL") D XQORM,EN^XQOR
17 I $D(VALMBCK),VALMBCK'="Q" G ASK
18 K XQORM,DTOUT,DIROUT,DUOUT
19 Q
20COL ; -- set up column dd array
21 K VALMDDF
22 S I=0 F S I=$O(^SD(409.61,VALM("IFN"),"COL",I)) Q:'I I $D(^(I,0)) S VALMDDF($P(^(0),U))=^(0)
23 Q
24CAPTION() ; -- set up caption line of header
25 N X,COL,FLD,CHR
26 S CHR=$S(VALMCC:" ",1:"-")
27 S $P(X,CHR,VALM("RM")+1)=""
28 S COL="" F S COL=$O(VALMDDF(COL)) Q:COL="" S FLD=VALMDDF(COL) D
29 . S X=$$SETSTR^VALM1($P(FLD,U,4),X,+$P(FLD,U,2),$S($L($P(FLD,U,4))<$P(FLD,U,3):$L($P(FLD,U,4)),1:+$P(FLD,U,3)))
30 Q X
31CHGCAP(FLD,LABEL) ; -- change label on caption
32 ; input: FLD := name of field
33 ; LABEL := text for column header
34 S $P(VALMDDF(FLD),U,4)=LABEL,VALMCAP=$$CAPTION
35 Q
36REFRESH ; -- refresh display
37 S VALMPGE=$$PAGE^VALM4(VALMBG,VALM("LINES"))
38 S X=0 X ^%ZOSF("RM")
39 D HDR:$G(VALMBCK)'["P",TBAR,LIST,LBAR
40 S VALMBCK=""
41 Q
42HDR ; -- prt/display header
43 N X,I
44 I '$D(VALMHDR) X:$G(VALM("HDR"))]"" VALM("HDR")
45 ; -- prt hdr line
46 W:'$D(VALMPG1) @IOF K VALMPG1
47 W:VALMCC $C(13)_IOUON_$C(13)_IOINHI_$C(13) ; -- turn on undln/hi
48 I $E(IOST,1,2)="C-" D IOXY^VALM4(0,0) ; -- position cursor
49 W $E(VALM("TITLE"),1,30) ; -- prt title
50 W:VALMCC IOINORM,IOUON ; -- turn off hi
51 W $J("",30-$L(VALM("TITLE"))) ; -- fill in w/blanks
52 I $E(IOST,1,2)="C-" W $C(13) D IOXY^VALM4(30,0) ; -- position cursor
53 W $J("",((VALMWD-80)/2)),$$HTE^XLFDT($H,1),$J("",10+((VALMWD-80)/2)),"Page: ",$J(VALMPGE,4)," of ",$J($$PAGE^VALM4(VALMCNT,VALM("LINES")),4)_$S($D(VALMORE):"+",1:" ") ; -- prt rest of hdr
54 W:VALMCC IOUOFF I $E(IOST,1,2)="C-" D IOXY^VALM4(0,0) ; -- turn off undln
55 F I=1:1:VALM("TM")-3 W !,$S('$D(VALMHDR(I)):"",$L(VALMHDR(I))>(VALMWD-1):$$EXTRACT^VALM4($G(VALMHDR(I))),1:VALMHDR(I)) ; -- prt hdr
56 Q
57TBAR ; -- print caption/top bar
58 N X
59 D CRT(0,VALM("TM")-3)
60 S VALMUP=(VALMBG>1),VALMCAP=$S(VALMUP:"+",VALMCC:" ",1:"-")_$E(VALMCAP,2,VALM("RM"))
61 S X=$E(VALMCAP,1,VALM("FIXED"))_$E(VALMCAP,VALMLFT,VALMLFT+VALMWD-1-VALM("FIXED"))
62 I VALM("TM")>2 D
63 . S:VALMCC X=IOUON_$C(13)_X_$C(13)_IOUOFF_$C(13)
64 . W !,X
65 Q
66LIST ; -- list items
67 N I,LN,DY,DX
68 S DY=0
69 I $E(IOST,1,2)="C-" W ! S DX=0,DY=VALM("TM")-2 X IOXY
70 S I=VALMBG,VALMLST=I+VALM("LINES")-1 S:VALMLST>VALMCNT VALMLST=VALMCNT
71 F LN=1:1:VALM("LINES") D WRITE^VALM4(I,1,1,DY+LN) S I=I+1
72 Q
73LBAR ; -- print low bar
74 N CHR,X
75 D CRT(0,VALM("BM")-1)
76 S CHR=$S(VALMCC:" ",1:"-")
77 K X S $P(X,CHR,VALMWD+1)=""
78 S X=$E(X,1,10)_$E($E($S($G(VALMSG)="":$$MSG(),1:VALMSG),1,50)_$E(X,11,75),1,65)_$E(X,76,VALMWD) K VALMSG
79 S VALMDN=(VALMLST<VALMCNT)
80 S X=$S(VALMDN:"+",1:CHR)_CHR_$S(VALMLFT>(VALM("FIXED")+1):"<<<",1:CHR_CHR_CHR)_$E(X,6,VALMWD-3)_$S((VALMLFT+(VALMWD-VALM("FIXED")))<VALM("RM"):">>>",1:CHR_CHR_CHR)
81 S:VALMCC X=$C(13)_IORVON_$C(13)_X_$C(13)_IORVOFF_$C(13)
82 W !,X
83 I $E(IOST,1,2)="C-" W !
84 Q
85MSG() ;
86 Q "Enter ?? for more actions"
87CRT(DX,DY) ;
88 I DX'<0,DY'<0,$E(IOST,1,2)="C-" W $C(13) D IOXY^VALM4(.DX,.DY)
89 Q
90SHOW ; -- show items to user / main call back
91 W VALMCOFF
92 N DX,DY
93 S:'$D(VALMBG) VALMBG=1
94 S:'$D(VALMLFT) VALMLFT=VALM("FIXED")+1
95 S VALMPGE=$$PAGE^VALM4(VALMBG,VALM("LINES"))
96 I $G(VALMBCK)="R" D REFRESH
97 I $D(VALMSG) D MSG^VALM10(VALMSG) K VALMSG
98 I '$D(XQORM("B")),VALM("DEFS") S XQORM("B")=$S(VALMLST<VALMCNT:"Next Screen",1:"Quit")
99 I VALMCC D RESET^VALM4
100 S DX=0,DY=VALM("BM")-$S(VALM("TYPE")=2:0,1:VALMMENU) X IOXY
101 I VALMMENU D
102 . S X="?" D DISP^XQORM1
103 . W:VALMCC IOEDEOP
104 W VALMCON
105 D XQORM,KEYS K VALMBCK,VALMDY
106 Q
107WP1(VALMREF) ; -- quick setup
108 S VALMCNT=+$P(@VALMREF@(0),U,4)
109 S VALM("ARRAY")=VALMREF
110 S:$D(VALMWPTL) VALM("TITLE")=VALMWPTL
111 Q
112WP(VALMREF,VALMWPTL) ; -- quick entry to List Manager (c)
113 D EN("WP1^VALM(VALMREF)")
114 Q
115XQORM ; -- set XQOR init vars
116 S XQORM(0)=VALM("MAX")_"AR\"
117 S XQORM("??")="D HELP^VALM2"
118 K DTOUT,DIROUT,DUOUT
119 Q
120KEYS ; -- set XQOR auto-protocols
121 N I S I=0
122 F S I=$O(VALMKEY(I)) Q:'I S X=VALMKEY(I) S:$P(X,U,2)]"" XQORM("KEY",$P(X,U,2))=+X_"^1"
123 S XQORM("XLATE","LEFT")="<=1",XQORM("XLATE","RIGHT")=">=1"
124 S XQORM("XLATE","FIND")="SE",XQORM("XLATE","HELP")="??"
125 S XQORM("XLATE","DOWN")="DN",XQORM("XLATE","UP")="UP"
126 Q
Note: See TracBrowser for help on using the repository browser.