XUTMUSE ;SEA/RDS - TaskMan: Option, XUTMUSER, Part 1 (Driver) ;11/30/94 11:43
;;8.0;KERNEL;;Jul 10, 1995
;
ENV ;Establish Routine Environment
N DIR,XUTMT,ZTKEY,ZTNAME,ZTENV,ZTF,ZTUCI,ZTSK K DTOUT,DIRUT
D ENV^XUTMUTL Q:'$D(ZTENV)
S XUTMT(0)="A"_$E("U",'ZTKEY),XUTMT("?")="^D HELP1^XUTMUSE",XUTMT("??")="^D HELP2^XUTMUSE" D ^XUTMT Q:ZTSK=""
;
SELECT ;Prompt User For Action
S DIR(0)="SAOM^D:Display status.;ST:Stop task.;E:Edit task.;P:Print task.;L:List own tasks.;SE:Select another task.",DIR("?")="^D HELP1^XUTMUSE3",DIR("??")="^D HELP2^XUTMUSE3"
S DIR("A",1)="",DIR("A",2)=" Taskman User Option",DIR("A",3)="",DIR("A",4)=" Display status.",DIR("A",5)=" Stop task.",DIR("A",6)=" Edit task."
S DIR("A",7)=" Print task.",DIR("A",8)=" List own tasks.",DIR("A",9)=" Select another task.",DIR("A",10)="",DIR("A")=" Select Action (Task # "_ZTSK_"): "
D ^DIR Q:$D(DIRUT) D ACT I ZTSK="" K ^TMP($J) Q
G SELECT
;
ACT ;SELECT Subroutine--Act On User's Selection
N DIR,DIRUT,DTOUT,DUOUT,XUTMT
I Y="D" W ! D EN^XUTMTP(ZTSK,"",1) Q
I Y="ST" W ! S XUTMT=ZTSK,XUTMT(0)="R2" D ^XUTMT Q
I Y="E" S XUTMT=ZTSK D ^XUTMUSE2 Q
I Y="P" D ^XUTMUSE1 Q
I Y="L" D HELP2 Q
W ! S XUTMT(0)="A"_$E("U",'ZTKEY),XUTMT("B")=ZTSK,XUTMT("?")="^D HELP3^XUTMUSE",XUTMT("??")="^D HELP2^XUTMUSE" D ^XUTMT Q
Q
;
HELP1 ;ENV Subroutine--Help Message For Initial Task Selection For "?"
W !!,"This option will allow you to look at and manipulate your queued jobs, and is",!?5,"only useful for you when you have such jobs to work with."
W !!,"You must begin this option by entering the task number of the queued job that",!?5,"you want to work with first."
W !!,"If you don't know the task number of any of your queued jobs then enter",!?5,"two question marks ('??') and you will be shown all of your queued jobs",!?5,"on this computer."
W " The task number of each task is the number listed on the",!?5,"first line of the display, before the colon (':')."
W !!,"After you pick a task to work with, you will be shown a list of the things",!?5,"you can do with that task, and will be asked to pick one.",!
Q
;
HELP2 ;Subroutine--Help Message For Initial Task Selection For "??"
N %ZTI,DTOUT,DUOUT,X,Y,ZT,ZTD1,ZTD2,ZTDTH,XUTMT,ZTOUT,ZTREC,ZTS,ZTSK
K ^TMP($J)
W @IOF,"Please wait while I find your tasks...searching..."
S %ZTI=0,ZTOUT=0
H1 S ZTS=0 F S ZTS=$O(^%ZTSK(ZTS)) Q:'ZTS D
. S ZTREC=$G(^%ZTSK(ZTS,0)) Q:ZTREC=""
. I $P(ZTREC,U,3)'=DUZ Q
. I $P(ZTREC,U,10)]"",$P(ZTREC,U,10)'=ZTNAME Q
. S ZTDTH=$$H3^%ZTM($P(ZTREC,U,6))
. D SORT
. Q
H2 S ZTS=0,ZTDTH=$$H3^%ZTM($H)
F S ZTS=$O(^%ZTSCH("TASK",ZTS)) Q:'ZTS D
. I $D(^%ZTSK(ZTS,0))#2 Q
. S ZTREC=$G(^%ZTSCH("TASK",ZTS)) Q:ZTREC=""
. I $P(ZTREC,U,9)'=DUZ,$P(ZTREC,U,9)'=ZTNAME Q
. D SORT
. Q
H3 W "finished!",!
I '%ZTI W !,"There are no tasks listed that were queued by you.",!
E S ZTD1="0",%ZTI=0 F S ZTD1=$O(^TMP($J,ZTD1)) Q:ZTD1'>0 D I ZTOUT Q
. S ZTS=0
. F S ZTS=$O(^TMP($J,ZTD1,ZTS)) Q:'ZTS D HPRINT I ZTOUT Q
I 'ZTOUT D EOL W !
;K ^TMP($J)
Q
;
HPRINT ;HELP2 Subroutine--Print A Task
N XUTMT,ZTSK
S %ZTI=%ZTI+1,^TMP($J,0,%ZTI)=ZTS
S ZTF=0 D EN^XUTMTP(ZTS,%ZTI)
W !,"-------------------------------------------------------------------------------"
I $Y>18 S ZTF=1 D EOP S ZTOUT=$D(DTOUT)!$D(DUOUT) Q:ZTOUT W @IOF
Q
;
SORT ;HELP2--sort tasks by start time, in reverse order
;input: start time, task number
;output: new cross reference in ^TMP($J)
S %ZTI=%ZTI+1
S ^TMP($J,ZTDTH,ZTS)=%ZTI
Q
;
HELP3 ;ACT Subroutine--Help Message For Task Reselection For "?"
W !!,"Enter the task number of the queued job you want to work with."
W !!,"Enter '??' to see the list of tasks you can choose from.",! Q
;
EOP ;Simulate DIR(0)="E" Call To DIR (For Use Within DIR calls)
S Y="" F ZT=0:0 R !,"Press RETURN to continue or '^' to exit: ",Y:$S($D(DTIME)#2:DTIME,1:60) S:'$T DTOUT="" S:Y="^" DUOUT="" Q:Y=""!(Y="^") W !!,"Enter either RETURN or '^'",! W:Y'["?" $C(7)
Q
;
EOL ;Simulate DIR(0)="E" call to DIR for end of listings
S Y="" F ZT=0:0 R !,"End of listing. Press RETURN to continue: ",Y:$S($D(DTIME)#2:DTIME,1:60) S:'$T DTOUT="" S:Y="^" DUOUT="" Q:Y=""!(Y="^") W !!,"Enter either RETURN or '^'",! W:Y'["?" $C(7)
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUTMUSE 4435 printed Nov 22, 2024@17:24:14 Page 2
XUTMUSE ;SEA/RDS - TaskMan: Option, XUTMUSER, Part 1 (Driver) ;11/30/94 11:43
+1 ;;8.0;KERNEL;;Jul 10, 1995
+2 ;
ENV ;Establish Routine Environment
+1 NEW DIR,XUTMT,ZTKEY,ZTNAME,ZTENV,ZTF,ZTUCI,ZTSK
KILL DTOUT,DIRUT
+2 DO ENV^XUTMUTL
if '$DATA(ZTENV)
QUIT
+3 SET XUTMT(0)="A"_$EXTRACT("U",'ZTKEY)
SET XUTMT("?")="^D HELP1^XUTMUSE"
SET XUTMT("??")="^D HELP2^XUTMUSE"
DO ^XUTMT
if ZTSK=""
QUIT
+4 ;
SELECT ;Prompt User For Action
+1 SET DIR(0)="SAOM^D:Display status.;ST:Stop task.;E:Edit task.;P:Print task.;L:List own tasks.;SE:Select another task."
SET DIR("?")="^D HELP1^XUTMUSE3"
SET DIR("??")="^D HELP2^XUTMUSE3"
+2 SET DIR("A",1)=""
SET DIR("A",2)=" Taskman User Option"
SET DIR("A",3)=""
SET DIR("A",4)=" Display status."
SET DIR("A",5)=" Stop task."
SET DIR("A",6)=" Edit task."
+3 SET DIR("A",7)=" Print task."
SET DIR("A",8)=" List own tasks."
SET DIR("A",9)=" Select another task."
SET DIR("A",10)=""
SET DIR("A")=" Select Action (Task # "_ZTSK_"): "
+4 DO ^DIR
if $DATA(DIRUT)
QUIT
DO ACT
IF ZTSK=""
KILL ^TMP($JOB)
QUIT
+5 GOTO SELECT
+6 ;
ACT ;SELECT Subroutine--Act On User's Selection
+1 NEW DIR,DIRUT,DTOUT,DUOUT,XUTMT
+2 IF Y="D"
WRITE !
DO EN^XUTMTP(ZTSK,"",1)
QUIT
+3 IF Y="ST"
WRITE !
SET XUTMT=ZTSK
SET XUTMT(0)="R2"
DO ^XUTMT
QUIT
+4 IF Y="E"
SET XUTMT=ZTSK
DO ^XUTMUSE2
QUIT
+5 IF Y="P"
DO ^XUTMUSE1
QUIT
+6 IF Y="L"
DO HELP2
QUIT
+7 WRITE !
SET XUTMT(0)="A"_$EXTRACT("U",'ZTKEY)
SET XUTMT("B")=ZTSK
SET XUTMT("?")="^D HELP3^XUTMUSE"
SET XUTMT("??")="^D HELP2^XUTMUSE"
DO ^XUTMT
QUIT
+8 QUIT
+9 ;
HELP1 ;ENV Subroutine--Help Message For Initial Task Selection For "?"
+1 WRITE !!,"This option will allow you to look at and manipulate your queued jobs, and is",!?5,"only useful for you when you have such jobs to work with."
+2 WRITE !!,"You must begin this option by entering the task number of the queued job that",!?5,"you want to work with first."
+3 WRITE !!,"If you don't know the task number of any of your queued jobs then enter",!?5,"two question marks ('??') and you will be shown all of your queued jobs",!?5,"on this computer."
+4 WRITE " The task number of each task is the number listed on the",!?5,"first line of the display, before the colon (':')."
+5 WRITE !!,"After you pick a task to work with, you will be shown a list of the things",!?5,"you can do with that task, and will be asked to pick one.",!
+6 QUIT
+7 ;
HELP2 ;Subroutine--Help Message For Initial Task Selection For "??"
+1 NEW %ZTI,DTOUT,DUOUT,X,Y,ZT,ZTD1,ZTD2,ZTDTH,XUTMT,ZTOUT,ZTREC,ZTS,ZTSK
+2 KILL ^TMP($JOB)
+3 WRITE @IOF,"Please wait while I find your tasks...searching..."
+4 SET %ZTI=0
SET ZTOUT=0
H1 SET ZTS=0
FOR
SET ZTS=$ORDER(^%ZTSK(ZTS))
if 'ZTS
QUIT
Begin DoDot:1
+1 SET ZTREC=$GET(^%ZTSK(ZTS,0))
if ZTREC=""
QUIT
+2 IF $PIECE(ZTREC,U,3)'=DUZ
QUIT
+3 IF $PIECE(ZTREC,U,10)]""
IF $PIECE(ZTREC,U,10)'=ZTNAME
QUIT
+4 SET ZTDTH=$$H3^%ZTM($PIECE(ZTREC,U,6))
+5 DO SORT
+6 QUIT
End DoDot:1
H2 SET ZTS=0
SET ZTDTH=$$H3^%ZTM($HOROLOG)
+1 FOR
SET ZTS=$ORDER(^%ZTSCH("TASK",ZTS))
if 'ZTS
QUIT
Begin DoDot:1
+2 IF $DATA(^%ZTSK(ZTS,0))#2
QUIT
+3 SET ZTREC=$GET(^%ZTSCH("TASK",ZTS))
if ZTREC=""
QUIT
+4 IF $PIECE(ZTREC,U,9)'=DUZ
IF $PIECE(ZTREC,U,9)'=ZTNAME
QUIT
+5 DO SORT
+6 QUIT
End DoDot:1
H3 WRITE "finished!",!
+1 IF '%ZTI
WRITE !,"There are no tasks listed that were queued by you.",!
+2 IF '$TEST
SET ZTD1="0"
SET %ZTI=0
FOR
SET ZTD1=$ORDER(^TMP($JOB,ZTD1))
if ZTD1'>0
QUIT
Begin DoDot:1
+3 SET ZTS=0
+4 FOR
SET ZTS=$ORDER(^TMP($JOB,ZTD1,ZTS))
if 'ZTS
QUIT
DO HPRINT
IF ZTOUT
QUIT
End DoDot:1
IF ZTOUT
QUIT
+5 IF 'ZTOUT
DO EOL
WRITE !
+6 ;K ^TMP($J)
+7 QUIT
+8 ;
HPRINT ;HELP2 Subroutine--Print A Task
+1 NEW XUTMT,ZTSK
+2 SET %ZTI=%ZTI+1
SET ^TMP($JOB,0,%ZTI)=ZTS
+3 SET ZTF=0
DO EN^XUTMTP(ZTS,%ZTI)
+4 WRITE !,"-------------------------------------------------------------------------------"
+5 IF $Y>18
SET ZTF=1
DO EOP
SET ZTOUT=$DATA(DTOUT)!$DATA(DUOUT)
if ZTOUT
QUIT
WRITE @IOF
+6 QUIT
+7 ;
SORT ;HELP2--sort tasks by start time, in reverse order
+1 ;input: start time, task number
+2 ;output: new cross reference in ^TMP($J)
+3 SET %ZTI=%ZTI+1
+4 SET ^TMP($JOB,ZTDTH,ZTS)=%ZTI
+5 QUIT
+6 ;
HELP3 ;ACT Subroutine--Help Message For Task Reselection For "?"
+1 WRITE !!,"Enter the task number of the queued job you want to work with."
+2 WRITE !!,"Enter '??' to see the list of tasks you can choose from.",!
QUIT
+3 ;
EOP ;Simulate DIR(0)="E" Call To DIR (For Use Within DIR calls)
+1 SET Y=""
FOR ZT=0:0
READ !,"Press RETURN to continue or '^' to exit: ",Y:$SELECT($DATA(DTIME)#2:DTIME,1:60)
if '$TEST
SET DTOUT=""
if Y="^"
SET DUOUT=""
if Y=""!(Y="^")
QUIT
WRITE !!,"Enter either RETURN or '^'",!
if Y'["?"
WRITE $CHAR(7)
+2 QUIT
+3 ;
EOL ;Simulate DIR(0)="E" call to DIR for end of listings
+1 SET Y=""
FOR ZT=0:0
READ !,"End of listing. Press RETURN to continue: ",Y:$SELECT($DATA(DTIME)#2:DTIME,1:60)
if '$TEST
SET DTOUT=""
if Y="^"
SET DUOUT=""
if Y=""!(Y="^")
QUIT
WRITE !!,"Enter either RETURN or '^'",!
if Y'["?"
WRITE $CHAR(7)
+2 QUIT
+3 ;