[613] | 1 | XUTMUSE2 ;SEA/RDS - TaskMan: Option, XUTMUSER, Part 3 (Edit) ;05/26/98 16:46
|
---|
| 2 | ;;8.0;KERNEL;**36,86**;Jul 10, 1995
|
---|
| 3 | ;
|
---|
| 4 | TASK ;Handle Unusual Tasks
|
---|
| 5 | N ZTD,ZTDEFALT,ZTL,ZTX
|
---|
| 6 | I $D(^%ZTSK(XUTMT,0))[0 W !,"This task's record is missing critical data. There's nothing to edit." Q
|
---|
| 7 | I $D(^%ZTSCH("TASK",XUTMT)) W !,"This task is currently running. You should either wait for the task to stop",!?5,"running, or use the Stop Task action to try to stop it sooner." Q
|
---|
| 8 | ;
|
---|
| 9 | STOP ;Report Need To Stop Task, Prompt For Confirmation
|
---|
| 10 | W ! S DIR(0)="YO",DIR("A")="Before you edit the task I must unschedule it, is this okay",DIR("B")="YES",DIR("?")="Yes - task will be unscheduled and you can edit it. No - don't edit."
|
---|
| 11 | D ^DIR K DIR I $D(DIRUT)!'Y W !,"Task not changed." Q
|
---|
| 12 | D ^XUTMTS I ZTSK<1 W !!,"Task not available for editing."
|
---|
| 13 | W !,"Task ready for editing."
|
---|
| 14 | ;
|
---|
| 15 | OUTPUT ;Report Whether Task Involved Output
|
---|
| 16 | W ! W:$P(ZTSK(.2),U)="" !,"Currently, this task does not request an output device." W:$P(ZTSK(.2),U)]"" !,"Currently, this task requests output device ",$P($P(ZTSK(.2),U),";"),"."
|
---|
| 17 | S DIR(0)="YO",DIR("A")="Do you want to change the output device for this task",DIR("B")="NO"
|
---|
| 18 | D ^DIR Q:$D(DIRUT) K DIR I 'Y G RUNTIME
|
---|
| 19 | ;
|
---|
| 20 | DEVICE ;Allow User To Change Output Device Request
|
---|
| 21 | S ZTSK(.2)="",ZTSK(.25)="" K ZTIO
|
---|
| 22 | S %ZIS="NQS",%ZIS("A")="Select Task's Output Device (^ for none): ",%ZIS("B")=$P(ZTSK(.2),U) D ^%ZIS G:POP RUNTIME
|
---|
| 23 | S ZTIO=ION_";"_IOST_";"_$S($D(IO("DOC"))#2:IO("DOC"),1:IOM_";"_IOSL)_$S($D(IO("P"))[0:"",IO("P")="":"",1:";/"_IO("P")),ZTSK(.2)=ZTIO_U_IO_U_IOT_U_IOST_U_$P(ZTSK(.2),U,5)_U
|
---|
| 24 | I $D(IO("HFSIO"))#2,$D(IOPAR)#2 S $P(ZTSK(.2),U,6)=IO("HFSIO"),ZTSK(.25)=IOPAR
|
---|
| 25 | D HOME^%ZIS
|
---|
| 26 | ;
|
---|
| 27 | RUNTIME ;Allow User To Change Task's Next Run Time
|
---|
| 28 | W ! S ZTDEFALT=$$HTFM^XLFDT($P(ZTSK(0),U,6))
|
---|
| 29 | S DIR(0)="D^::ERS^N ZTRSTRCT D SCREEN^XUTMUSE2 K:ZTRSTRCT X"
|
---|
| 30 | S DIR("A")="When should this task run?"
|
---|
| 31 | S DIR("B")=$$HTE^XLFDT($P(ZTSK(0),U,6))
|
---|
| 32 | S DIR("?",1)=" Your response must be a date, @ sign, and time."
|
---|
| 33 | S DIR("?",2)=" "
|
---|
| 34 | S DIR("?")=" Enter ?? for more help."
|
---|
| 35 | S DIR("??")="^D HELP2^XUTMUSE2"
|
---|
| 36 | D ^DIR K DIR
|
---|
| 37 | R1 ;
|
---|
| 38 | I $D(DTOUT) W " ** TIME-OUT **",$C(7)
|
---|
| 39 | I $D(DUOUT) W " ** ^-ESCAPE **"
|
---|
| 40 | I $D(DIRUT) Q
|
---|
| 41 | S $P(ZTSK(0),U,6)=$$FMTH^XLFDT(Y)
|
---|
| 42 | ;
|
---|
| 43 | PURPOSE ;Allow User To Edit Description Of Task's Purpose
|
---|
| 44 | W ! S DIR(0)="FO^1:200",DIR("A")="Task's purpose" S:ZTSK(.03)]"" DIR("B")=ZTSK(.03) D ^DIR Q:$D(DIRUT) K DIR S ZTSK(.03)=Y
|
---|
| 45 | ;
|
---|
| 46 | BRIEF ;Show User Brief Of Task
|
---|
| 47 | W !!,ZTSK,": ",$E(ZTSK(.03),1,70)
|
---|
| 48 | S ZTD=$E(ZTSK(.03),$L(ZTSK(.03)))=".",ZTX=$L(ZTSK)+2+$L(ZTSK(.03))+3-ZTD,ZTL=$S($P($P(ZTSK(.2),U),";")]"":$L($P($P(ZTSK(.2),U),";")),1:16)
|
---|
| 49 | W:ZTL+ZTX'>80 $E(".",'ZTD)," " I ZTL+ZTX>80 W:ZTX<80&'ZTD "." W ! S ZTX=0
|
---|
| 50 | W $S($P($P(ZTSK(.2),U),";")]"":$P($P(ZTSK(.2),U),";"),1:"No output device") S ZTX=ZTL+ZTX+3,%H=$P(ZTSK(0),U,6)
|
---|
| 51 | S ZTD=$S(%H="":"Next run time unknown",1:"Next run time: "_$$TIME^XUTMTP(%H)),ZTL=$L(ZTD) W:ZTL+ZTX'>80 ". " I ZTL+ZTX>80 W:ZTL<80 "." W ! S ZTX=0
|
---|
| 52 | W ZTD I ZTL+ZTX<80 W "."
|
---|
| 53 | ;
|
---|
| 54 | REQ ;Allow User To Reschedule Task
|
---|
| 55 | W ! S DIR(0)="YO",DIR("A")="Shall I reschedule this task as shown",DIR("B")="YES" D ^DIR K DIR I $D(DIRUT)!'Y W !,"Task not rescheduled." Q
|
---|
| 56 | S $P(ZTSK(.1),U,10,11)="^"
|
---|
| 57 | S $P(ZTSK(0),U,3)=DUZ
|
---|
| 58 | S $P(ZTSK(0),U,5)=$H
|
---|
| 59 | S $P(ZTSK(0),U,10)=ZTNAME
|
---|
| 60 | W !,"Task rescheduled."
|
---|
| 61 | L +^%ZTSK(ZTSK) S ^%ZTSK(ZTSK,0)=ZTSK(0),^(.03)=ZTSK(.03),^(.1)=ZTSK(.1),^(.2)=ZTSK(.2),^(.25)=ZTSK(.25)
|
---|
| 62 | K ZTDESC,ZTIO,ZTRTN S ZTDTH=$P(ZTSK(0),U,6) D REQ^%ZTLOAD L -^%ZTSK(ZTSK)
|
---|
| 63 | Q
|
---|
| 64 | ;
|
---|
| 65 | HELP2 ;RUNTIME--provide ?? help in selecting a start time for this task
|
---|
| 66 | N ZTREC
|
---|
| 67 | W !!?5,"This will be the time TaskMan starts your task."
|
---|
| 68 | I $P(ZTSK(0),U,8)="" Q
|
---|
| 69 | S ZTREC=$G(^DIC(19,+$P(ZTSK(0),U,8),0))
|
---|
| 70 | I ZTREC="" Q
|
---|
| 71 | I $P(ZTREC,U,2)="" Q
|
---|
| 72 | W !!?5,"The option you used to queue this task was:"
|
---|
| 73 | W !?5,$P(ZTREC,U,2)
|
---|
| 74 | H1 ;
|
---|
| 75 | I $O(^DIC(19,+$P(ZTSK(0),U,8),3.92,0))="" D Q
|
---|
| 76 | .W !!?5,"It has no restricted times, so you may run this task any time"
|
---|
| 77 | .W !?5,"you wish." Q
|
---|
| 78 | W !!?5,"It may only be run at certain times."
|
---|
| 79 | W !?5,"This option will notify you if you select a restricted time."
|
---|
| 80 | Q
|
---|
| 81 | ;
|
---|
| 82 | SCREEN ;RUNTIME--screen out start times prohibited according to the option
|
---|
| 83 | ;...that queued the task (or the option itself, if the task is a
|
---|
| 84 | ;...queued option).
|
---|
| 85 | I Y=ZTDEFALT S ZTRSTRCT=0 Q
|
---|
| 86 | N X,XQY S X=Y N Y
|
---|
| 87 | S XQY=+$P(ZTSK(0),U,8)
|
---|
| 88 | D ^XQ92
|
---|
| 89 | S ZTRSTRCT=X=""
|
---|
| 90 | S1 ;
|
---|
| 91 | I ZTRSTRCT D
|
---|
| 92 | .W !!?5,"You may not start your task at that time."
|
---|
| 93 | .W !!?5,"The option you used to queue this task does not allow the task"
|
---|
| 94 | .W !?5,"to run at that time. Please select a different time to start"
|
---|
| 95 | .W !?5,"the task."
|
---|
| 96 | .Q
|
---|
| 97 | Q
|
---|
| 98 | ;
|
---|