source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMJDIR.m@ 1520

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

initial load of WorldVistAEHR

File size: 4.0 KB
RevLine 
[613]1XMJDIR ;ISC-SF/GMB- MailMan's DIR ;10/31/2001 12:33
2 ;;8.0;MailMan;;Jun 28, 2002
3XMDIR(XMDIR,XMOPT,XMOX,XMY,XMABORT) ;
4 ; XMDIR("A") User prompt
5 ; XMDIR("B") Default choice
6 ; XMDIR(0) Special instructions
7 ; S - Show the choices
8 ; C - Show choices in 2 columns, if necessary
9 ; XMDIR("?") Help text for 1 ?
10 ; XMDIR("??") Help text for 2 or more ?
11 N XMX
12 K XMY
13 I +XMDIR("A")=XMDIR("A") S XMDIR("A")=$$EZBLD^DIALOG(XMDIR("A"))
14 I $D(XMDIR("B")),+XMDIR("B")=XMDIR("B") S XMDIR("B")=$$EZBLD^DIALOG(XMDIR("B"))
15 I $G(XMDIR(0))["S" D
16 . W !!,?5,$$EZBLD^DIALOG(37008),! ; Select one of the following:
17 . D HELPCMD(.XMOPT,.XMOX,$S(XMDIR(0)["C":IOSL-$Y-3,1:IOSL-4))
18 F D Q:$D(XMY)!XMABORT
19 . W !!,XMDIR("A"),$S($D(XMDIR("B")):$P(XMDIR("B"),":",2,99)_"// ",1:"")
20 . R XMX:DTIME I '$T S XMABORT=DTIME Q
21 . I XMX[U S XMABORT=1 Q
22 . I XMX="" D Q
23 . . I '$D(XMDIR("B")) S XMABORT=1 Q
24 . . S XMY=$P(XMDIR("B"),":",1)
25 . I $E(XMX)="?" D QHELP Q
26 . I $D(XMDIR("PRE")) X XMDIR("PRE")
27 . S XMY=$$COMMAND(.XMOPT,.XMOX,XMX)
28 . I $D(XMOPT(XMY)),'$D(XMOPT(XMY,"?")) Q
29 . I XMY=-1 D
30 . . W $C(7) D HELPSCR(.XMOPT,.XMOX)
31 . E D SHOWERR(.XMOPT,XMY) I $D(XMOPT(XMY,"?X")) X XMOPT(XMY,"?X") I $T Q
32 . K XMY
33 Q
34SHOWERR(XMOPT,XMY) ; Show error message
35 W $C(7),!
36 I +XMOPT(XMY,"?")=XMOPT(XMY,"?") D Q
37 . N XMTEXT
38 . D BLD^DIALOG(XMOPT(XMY,"?"),"","","XMTEXT","F")
39 . D MSG^DIALOG("WE","",IOM,"","XMTEXT")
40 I $D(XMOPT(XMY,"?",1)) D
41 . N I
42 . S I=0
43 . F S I=$O(XMOPT(XMY,"?",I)) Q:'I W !,XMOPT(XMY,"?",I)
44 W !,XMOPT(XMY,"?")
45 Q
46QHELP ;
47 I XMX="?" D HELPSCR(.XMOPT,.XMOX) Q
48 N XQH
49 S XQH=$G(XMDIR("??"),"XM-U-MO-READ")
50 I "@"[XQH D HELPSCR(.XMOPT,.XMOX) Q
51 I $E(XQH,1,2)="D " X XQH Q
52 D EN^XQH
53 Q
54HELPSCR(XMOPT,XMOX) ;
55 I $D(XMDIR("?")) D
56 . N XMTEXT
57 . W !
58 . D BLD^DIALOG(XMDIR("?"),"","","XMTEXT","F")
59 . D MSG^DIALOG("WH","",IOM,"","XMTEXT")
60 W !!,$$EZBLD^DIALOG(34054),! ; Enter a code from the list.
61 D HELPCMD(.XMOPT,.XMOX)
62 Q
63HELPCMD(XMOPT,XMOX,XMPMAX) ;
64 N XMCNT,XMCMD,XMROWS,I,XMHELP,XMLEN
65 S (XMCNT,XMLEN)=0,XMCMD=""
66 F S XMCMD=$O(XMOPT(XMCMD)) Q:XMCMD="" I '$D(XMOPT(XMCMD,"?")) S XMCNT=XMCNT+1 I $L(XMOX("O",XMCMD))>XMLEN S XMLEN=$L(XMOX("O",XMCMD))
67 I XMCNT<$G(XMPMAX,IOSL-4) D Q
68 . F S XMCMD=$O(XMOX("X",XMCMD)) Q:XMCMD="" D
69 . . Q:$D(XMOPT(XMOX("X",XMCMD),"?"))
70 . . W !,?9,$E(XMCMD_" ",1,10)_XMOPT(XMOX("X",XMCMD))
71 S XMROWS=XMCNT+1\2
72 S I=0
73 F D Q:I=XMROWS
74 . S XMCMD=$O(XMOX("X",XMCMD))
75 . Q:$D(XMOPT(XMOX("X",XMCMD),"?"))
76 . S I=I+1
77 . S XMHELP(I)=" "_$E(XMCMD_" ",1,XMLEN+2)_XMOPT(XMOX("X",XMCMD))
78 S I=0
79 F S XMCMD=$O(XMOX("X",XMCMD)) Q:XMCMD="" D
80 . Q:$D(XMOPT(XMOX("X",XMCMD),"?"))
81 . S I=I+1
82 . W !,$E(XMHELP(I)_" ",1,39)_" "_$E(XMCMD_" ",1,XMLEN+2)_$E(XMOPT(XMOX("X",XMCMD)),1,37-XMLEN)
83 S I=I+1
84 W:$D(XMHELP(I)) !,XMHELP(I)
85 Q
86COMMAND(XMOPT,XMOX,XMY) ; Check what the user enters against the list of
87 ; acceptable choices. If the user enters something ambiguous,
88 ; ^DIR is called to ask the user to choose one.
89 I XMY?.E1C.E Q -1
90 I $L(XMY)>64 Q -1
91 N XMX,XMCD,XMLEN
92 S XMX=XMY
93 S XMLEN=$L(XMX)
94 S XMY=$$UP^XLFSTR(XMY)
95 I $D(XMOX("X",XMY)) D Q XMCD
96 . S XMCD=XMOX("X",XMY)
97 . D PARROT
98 N XMTXT,XMC,XMT,XMCHOOSE
99 S XMCD=""
100 F S XMCD=$O(XMOPT(XMCD)) Q:XMCD="" S:'$D(XMOPT(XMCD,"?")) XMTXT(XMOPT(XMCD))=XMCD
101 S XMT=$CHAR($A($E(XMY))-1)_"~"
102 F S XMT=$O(XMTXT(XMT)) Q:XMT=""!($E(XMT)'=$E(XMY)) I $$UP^XLFSTR($E(XMT,1,XMLEN))=XMY S XMCHOOSE(XMT)=""
103 S XMC=$CHAR($A($E(XMY))-1)_"~"
104 F S XMC=$O(XMOX("X",XMC)) Q:XMC=""!($E(XMC)'=$E(XMY)) I $$UP^XLFSTR($E(XMC,1,XMLEN))=XMY S:'$D(XMOPT(XMOX("X",XMC),"?")) XMCHOOSE(XMOPT(XMOX("X",XMC)))=""
105 I '$D(XMCHOOSE) Q -1
106 N I,DIR,Y,X
107 S I=0,(DIR(0),XMT)=""
108 F S XMT=$O(XMCHOOSE(XMT)) Q:XMT="" S I=I+1,DIR(0)=DIR(0)_I_":"_XMT_";",XMCD(I)=XMTXT(XMT)
109 I I=1 D Q $P(XMCD," ") ; (for Q xxx)
110 . S XMCD=XMCD(I)
111 . D PARROT
112 S DIR(0)="SO^"_$E(DIR(0),1,$L(DIR(0))-1)
113 ;S DIR("A")="Choose 1-"_I
114 D ^DIR Q:$D(DIRUT) -1
115 Q $P(XMCD(Y)," ") ; (for Q xxx)
116PARROT ;
117 I $E(XMOPT(XMCD),1,XMLEN)=XMX W $E(XMOPT(XMCD),XMLEN+1,99) Q
118 W " ",XMOPT(XMCD)
119 Q
Note: See TracBrowser for help on using the repository browser.