XQHLP ;SEA/MJM - Menu Helper ;07/21/09 11:37
;;8.0;KERNEL;**46,514**;Jul 10, 1995;Build 8
;
PAUSE R !!," **> Press 'RETURN' to continue, '^' to stop, or '?[option text]' for more",!?25,"help: ",XQL:DTIME D:XQL?1"?"1AN.ANP HELP S XQL=$S(XQL[U:-1,1:XQLN) W @IOF Q
;
PAUSE1 R !!," **> Press 'RETURN' to continue, '^' to stop: ",XQL:DTIME S XQL=$S(XQL[U:-1,1:XQLN) W @IOF Q
;
SHOW F S XQX=$O(^XUTL("XQO",XQDIC,XQX)) Q:XQX=U!(XQL<0)!(XQX="") I $P(^(XQX),U,2) D
.S XQHY=^(XQX)
.D PRNT
.Q ;G SHOW
Q
;
PRNT ;Print out the description of the option XQHY
I '$L($P(XQHY,U,2))!'$D(^DIC(19,+XQHY,0)) Q
I XQL<5 D PAUSE Q:XQL<0
S XQHY0=^XUTL("XQO",XQDIC,"^",+XQHY) W !!,"'"_$P(XQHY0,U,3)_"' Option name: ",$P(XQHY0,U,2) S XQL=XQL-2 S %=$P(XQHY0,U) I %]"" W " Synonym: ",%
I '$D(XQHLP),$P(XQHY0,U,8)'="" S %=$P($P(XQHY0,U,3)," "),%=$S($L(%)>3:%,1:$P($P(XQHY0,U,3)," ",1,2)) W !," **> Extended help available. Type ","""","?"_%,""""," to see it." S XQL=XQL-1
F XQNXTOP=0:0 S XQNXTOP=$O(^DIC(19,+XQHY,1,XQNXTOP)) Q:XQNXTOP="" S XQA=^(XQNXTOP,0) W !?5,XQA S XQL=XQL-1 D PAUSE:'XQL
Q
;
HELP ;Display a help screen
N XQHY,XQX S XQHSV=XQY_U_XQDIC_U_XQY0,XQUR=$P(XQL,"?",2) D DIC^XQ71
I XQY<0 W " ??",*7 S XQY=+XQHSV,XQDIC=$P(XQHSV,U,2),XQY0=$P(XQHSV,U,3,99) Q
S XQH=$P(XQY0,U,7) I '$L(XQH) W !!,"**> Sorry, no help text available for this option." S XQY=+XQHSV,XQDIC=$P(XQHSV,U,2),XQY0=$P(XQHSV,U,3,99) Q
D EN^XQH S XQY=+XQHSV,XQDIC=$P(XQHSV,U,2),XQY0=$P(XQHSV,U,3,99),XQL=0
Q
;
EN ;Show descriptions from Option File Entry point from EN^XQ2
;S XQHSV=XQY_U_XQDIC_U_XQY0
S XQX=0,(XQL,XQLN)=$S($D(IOSL):IOSL-2,1:22),XQSAV=XQDIC D:$S('($D(^XUTL("XQO",XQDIC,0))#2):1,'$D(^DIC(19,XQDIC,99)):1,1:^DIC(19,XQDIC,99)'=$P(^XUTL("XQO",XQDIC,0),U,2)) ^XQSET D SHOW W !! G:XQL<0 OUT
S DIR(0)="Y",DIR("A")=" Shall I show you your secondary menus too",DIR("B")="No" D ^DIR G:$D(DUOUT) OUT
I Y W @IOF S XQDIC="U"_DUZ D:$S('($D(^XUTL("XQO",XQDIC,0))#2):1,'$D(^VA(200,DUZ,203.1)):1,1:^VA(200,DUZ,203.1)'=$P(^XUTL("XQO",XQDIC,0),U,2)) ^XQSET S XQL=XQLN,XQX=0 W ?25,"**> Your secondary options <**",!! D SHOW W !!
G:XQL<0 OUT
S DIR(0)="Y",DIR("A")=" Would you like to see the Common Options",DIR("B")="No" D ^DIR G:$D(DUOUT) OUT
I Y W @IOF S XQL=XQLN,XQX=0,XQDIC=$O(^DIC(19,"B","XUCOMMAND",0))
I Y D:$S('($D(^XUTL("XQO",XQDIC,0))#2):1,'$D(^DIC(19,XQDIC,99)):1,1:^DIC(19,XQDIC,99)'=$P(^XUTL("XQO",XQDIC,0),U,2)) ^XQSET W ?17,"**> The Common Options, options available to everyone <**",!! D SHOW
;
OUT ;Exit here
W !!
;S:$D(XQSAV) XQDIC=XQSAV
K DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,XQA,XQHSV,XQHY,XQHY0,XQNXTOP,XQL,XQLN,XQN,XQSAV,XQX,Y
I $D(XQHLP) K XQHLP Q
G M2^XQ
;
OPT ;Respond to a user entering "?Option_text"
;Enter with XQUR from XQ. Find option, show help, return to XQ
S XQHSV=XQY_U_XQDIC_U_XQY0
S (XQL,XQLN)=$S($D(IOSL):IOSL-2,1:22)
I XQUR["?" F S XQUR=$P(XQUR,"?",2) Q:XQUR'["?"
S XQHLP="" ;Set a flag so we know it isn't a jump
D S^XQ75
I XQY>0 D
.W @IOF W !!!
.S XQHY=XQY_U_XQY0
.D PRNT,PAUSE1
.I $P(XQY0,U,7)'="" D
..S XQH=$P(XQY0,U,7) D EN^XQH
..Q
.Q
S (XQY,XQDIC)=$P(XQHSV,U),XQY0=$P(XQHSV,U,3,99)
G OUT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXQHLP 3212 printed Oct 16, 2024@18:06:34 Page 2
XQHLP ;SEA/MJM - Menu Helper ;07/21/09 11:37
+1 ;;8.0;KERNEL;**46,514**;Jul 10, 1995;Build 8
+2 ;
PAUSE READ !!," **> Press 'RETURN' to continue, '^' to stop, or '?[option text]' for more",!?25,"help: ",XQL:DTIME
if XQL?1"?"1AN.ANP
DO HELP
SET XQL=$SELECT(XQL[U:-1,1:XQLN)
WRITE @IOF
QUIT
+1 ;
PAUSE1 READ !!," **> Press 'RETURN' to continue, '^' to stop: ",XQL:DTIME
SET XQL=$SELECT(XQL[U:-1,1:XQLN)
WRITE @IOF
QUIT
+1 ;
SHOW FOR
SET XQX=$ORDER(^XUTL("XQO",XQDIC,XQX))
if XQX=U!(XQL<0)!(XQX="")
QUIT
IF $PIECE(^(XQX),U,2)
Begin DoDot:1
+1 SET XQHY=^(XQX)
+2 DO PRNT
+3 ;G SHOW
QUIT
End DoDot:1
+4 QUIT
+5 ;
PRNT ;Print out the description of the option XQHY
+1 IF '$LENGTH($PIECE(XQHY,U,2))!'$DATA(^DIC(19,+XQHY,0))
QUIT
+2 IF XQL<5
DO PAUSE
if XQL<0
QUIT
+3 SET XQHY0=^XUTL("XQO",XQDIC,"^",+XQHY)
WRITE !!,"'"_$PIECE(XQHY0,U,3)_"' Option name: ",$PIECE(XQHY0,U,2)
SET XQL=XQL-2
SET %=$PIECE(XQHY0,U)
IF %]""
WRITE " Synonym: ",%
+4 IF '$DATA(XQHLP)
IF $PIECE(XQHY0,U,8)'=""
SET %=$PIECE($PIECE(XQHY0,U,3)," ")
SET %=$SELECT($LENGTH(%)>3:%,1:$PIECE($PIECE(XQHY0,U,3)," ",1,2))
WRITE !," **> Extended help available. Type ","""","?"_%,""""," to see it."
SET XQL=XQL-1
+5 FOR XQNXTOP=0:0
SET XQNXTOP=$ORDER(^DIC(19,+XQHY,1,XQNXTOP))
if XQNXTOP=""
QUIT
SET XQA=^(XQNXTOP,0)
WRITE !?5,XQA
SET XQL=XQL-1
if 'XQL
DO PAUSE
+6 QUIT
+7 ;
HELP ;Display a help screen
+1 NEW XQHY,XQX
SET XQHSV=XQY_U_XQDIC_U_XQY0
SET XQUR=$PIECE(XQL,"?",2)
DO DIC^XQ71
+2 IF XQY<0
WRITE " ??",*7
SET XQY=+XQHSV
SET XQDIC=$PIECE(XQHSV,U,2)
SET XQY0=$PIECE(XQHSV,U,3,99)
QUIT
+3 SET XQH=$PIECE(XQY0,U,7)
IF '$LENGTH(XQH)
WRITE !!,"**> Sorry, no help text available for this option."
SET XQY=+XQHSV
SET XQDIC=$PIECE(XQHSV,U,2)
SET XQY0=$PIECE(XQHSV,U,3,99)
QUIT
+4 DO EN^XQH
SET XQY=+XQHSV
SET XQDIC=$PIECE(XQHSV,U,2)
SET XQY0=$PIECE(XQHSV,U,3,99)
SET XQL=0
+5 QUIT
+6 ;
EN ;Show descriptions from Option File Entry point from EN^XQ2
+1 ;S XQHSV=XQY_U_XQDIC_U_XQY0
+2 SET XQX=0
SET (XQL,XQLN)=$SELECT($DATA(IOSL):IOSL-2,1:22)
SET XQSAV=XQDIC
if $SELECT('($DATA(^XUTL("XQO",XQDIC,0))#2)
DO ^XQSET
DO SHOW
WRITE !!
if XQL<0
GOTO OUT
+3 SET DIR(0)="Y"
SET DIR("A")=" Shall I show you your secondary menus too"
SET DIR("B")="No"
DO ^DIR
if $DATA(DUOUT)
GOTO OUT
+4 IF Y
WRITE @IOF
SET XQDIC="U"_DUZ
if $SELECT('($DATA(^XUTL("XQO",XQDIC,0))#2)
DO ^XQSET
SET XQL=XQLN
SET XQX=0
WRITE ?25,"**> Your secondary options <**",!!
DO SHOW
WRITE !!
+5 if XQL<0
GOTO OUT
+6 SET DIR(0)="Y"
SET DIR("A")=" Would you like to see the Common Options"
SET DIR("B")="No"
DO ^DIR
if $DATA(DUOUT)
GOTO OUT
+7 IF Y
WRITE @IOF
SET XQL=XQLN
SET XQX=0
SET XQDIC=$ORDER(^DIC(19,"B","XUCOMMAND",0))
+8 IF Y
if $SELECT('($DATA(^XUTL("XQO",XQDIC,0))#2)
DO ^XQSET
WRITE ?17,"**> The Common Options, options available to everyone <**",!!
DO SHOW
+9 ;
OUT ;Exit here
+1 WRITE !!
+2 ;S:$D(XQSAV) XQDIC=XQSAV
+3 KILL DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,XQA,XQHSV,XQHY,XQHY0,XQNXTOP,XQL,XQLN,XQN,XQSAV,XQX,Y
+4 IF $DATA(XQHLP)
KILL XQHLP
QUIT
+5 GOTO M2^XQ
+6 ;
OPT ;Respond to a user entering "?Option_text"
+1 ;Enter with XQUR from XQ. Find option, show help, return to XQ
+2 SET XQHSV=XQY_U_XQDIC_U_XQY0
+3 SET (XQL,XQLN)=$SELECT($DATA(IOSL):IOSL-2,1:22)
+4 IF XQUR["?"
FOR
SET XQUR=$PIECE(XQUR,"?",2)
if XQUR'["?"
QUIT
+5 ;Set a flag so we know it isn't a jump
SET XQHLP=""
+6 DO S^XQ75
+7 IF XQY>0
Begin DoDot:1
+8 WRITE @IOF
WRITE !!!
+9 SET XQHY=XQY_U_XQY0
+10 DO PRNT
DO PAUSE1
+11 IF $PIECE(XQY0,U,7)'=""
Begin DoDot:2
+12 SET XQH=$PIECE(XQY0,U,7)
DO EN^XQH
+13 QUIT
End DoDot:2
+14 QUIT
End DoDot:1
+15 SET (XQY,XQDIC)=$PIECE(XQHSV,U)
SET XQY0=$PIECE(XQHSV,U,3,99)
+16 GOTO OUT
+17 QUIT