FSCLMPM ;SLC/STAFF-NOIS List Manager Protocol Modify ;1/13/98 12:46
;;1.1;NOIS;;Sep 06, 1998
;
EDIT ; from FSCLMPE
N CHOICE,CNT,DEF,DESC,LINE,NEWDEF,NEWLINE,OK,PREOP,QDESC K DEF,DESC,NEWDEF,QDESC
W !,"Edit line:"
S CHOICE="1-"_+@VALMAR D SELECT^FSCUL(CHOICE,"S^Select line","","MVALUES",.OK)
I 'OK Q
S CHOICE=+$O(^TMP("FSC SELECT",$J,"MVALUES",0))
I $$ALL D REPLACE^FSCLDR(FSCLNAME,FSCLNUM) Q
D GETDEF^FSCLMPME(FSCLNUM,.DEF)
S PREOP="" I CHOICE=1 S PREOP="ADD"
W !,"Replace line ",^TMP("FSC MODIFY LISTS",$J,+$O(^TMP("FSC MODIFY LISTS",$J,"IDX",CHOICE,0)),0)
D EDIT^FSCLMPME(.NEWLINE,PREOP,.OK)
I 'OK Q
S CHOICE=+$O(^TMP("FSC SELECT",$J,"MVALUES",0)),(CNT,LINE)=0 F S LINE=$O(DEF(LINE)) Q:LINE<1 D
.S CNT=CNT+1 I CNT=CHOICE S NEWDEF(CNT)=CNT_U_NEWLINE Q
.S NEWDEF(CNT)=DEF(LINE),$P(NEWDEF(CNT),U)=CNT
D STUFF^FSCLMPMS
Q
;
INSERT ; from FSCLMPE
N CHOICE,CNT,DEF,LINE,NEWCNT,NEWDEF,NEWLINE,NEWLINES,OK,PREOP K DEF,NEWDEF,NEWLINES
W !,"Insert lines after:"
S CHOICE="0-"_+@VALMAR D SELECT^FSCUL(CHOICE,"S^Select line","","MVALUES",.OK)
I 'OK Q
S CHOICE=+$O(^TMP("FSC SELECT",$J,"MVALUES",0))
D GETDEF^FSCLMPME(FSCLNUM,.DEF)
S PREOP="" I CHOICE=0 S PREOP="ADD"
I CHOICE W !,"Insert after line ",^TMP("FSC MODIFY LISTS",$J,+$O(^TMP("FSC MODIFY LISTS",$J,"IDX",CHOICE,0)),0)
D ADD(CHOICE,PREOP,.DEF)
Q
;
ADD(CHOICE,PREOP,DEF) ; from FSCLDR
; not scoped
S CNT=0 F D Q:'OK
.D EDIT^FSCLMPME(.NEWLINE,PREOP,.OK)
.I OK S CNT=CNT+1,NEWLINES(CNT)=NEWLINE,PREOP="" W !,"Next line:"
I '$O(NEWLINES(0)) Q
S CHOICE=+$O(^TMP("FSC SELECT",$J,"MVALUES",0)),CNT=0
I CHOICE=0 D
.S NEWCNT=0 F S NEWCNT=$O(NEWLINES(NEWCNT)) Q:NEWCNT<1 S NEWLINE=NEWLINES(NEWCNT) D
..S CNT=CNT+1,NEWDEF(CNT)=CNT_U_NEWLINE
S LINE=0 F S LINE=$O(DEF(LINE)) Q:LINE<1 D
.S CNT=CNT+1,NEWDEF(CNT)=DEF(LINE),$P(NEWDEF(CNT),U)=CNT
.I CNT=CHOICE D
..S NEWCNT=0 F S NEWCNT=$O(NEWLINES(NEWCNT)) Q:NEWCNT<1 S NEWLINE=NEWLINES(NEWCNT) D
...S CNT=CNT+1,NEWDEF(CNT)=CNT_U_NEWLINE
D STUFF^FSCLMPMS
Q
;
DELETE ; from FSCLMPE
N CHOICE,CNT,DEF,LINE,OK,NEWDEF K DEF,NEWDEF
W !,"Delete lines:"
S CHOICE="1-"_+@VALMAR D SELECT^FSCUL(CHOICE,"^Select line(s)","","MVALUES",.OK)
I 'OK Q
I $$ALL D WARNING^FSCMU(FSCLNAME,.OK) D:OK DELETE^FSCLDR(FSCLNAME,FSCLNUM) Q
D GETDEF^FSCLMPME(FSCLNUM,.DEF)
I $O(^TMP("FSC SELECT",$J,"MVALUES",0))=1,$P($G(DEF(+$O(DEF(0)))),U,2)'="A" D Q
.W !,"You cannot delete these lines."
.W !,"The remaining query must begin with an 'Add' operation.",$C(7) H 2
S (CNT,LINE)=0 F S LINE=$O(DEF(LINE)) Q:LINE<1 D
.I $D(^TMP("FSC SELECT",$J,"MVALUES",LINE)) Q
.S CNT=CNT+1,NEWDEF(CNT)=DEF(LINE),$P(NEWDEF(CNT),U)=CNT
D STUFF^FSCLMPMS
Q
;
CHECK(LIST,USER) ; $$(list,user) -> 1 allows editing or 0 does not allow editing
; to edit a list you must be a NOIS specialist and either own the list or be a supervisor
Q:'$D(^FSC("SPEC",USER,0)) 0 Q:$P(^(0),U,7) 1 Q:$P($G(^FSC("LIST",LIST,0)),U,2)=USER 1 Q 0
;
ALL() ; $$() -> 1 if all selections in list are chosen, else 0
N CNT,SEL
S (CNT,SEL)=0 F S SEL=$O(^TMP("FSC SELECT",$J,"MVALUES",SEL)) Q:SEL<1 S CNT=CNT+1
I CNT=+@VALMAR Q 1
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCLMPM 3195 printed Oct 16, 2024@18:18:54 Page 2
FSCLMPM ;SLC/STAFF-NOIS List Manager Protocol Modify ;1/13/98 12:46
+1 ;;1.1;NOIS;;Sep 06, 1998
+2 ;
EDIT ; from FSCLMPE
+1 NEW CHOICE,CNT,DEF,DESC,LINE,NEWDEF,NEWLINE,OK,PREOP,QDESC
KILL DEF,DESC,NEWDEF,QDESC
+2 WRITE !,"Edit line:"
+3 SET CHOICE="1-"_+@VALMAR
DO SELECT^FSCUL(CHOICE,"S^Select line","","MVALUES",.OK)
+4 IF 'OK
QUIT
+5 SET CHOICE=+$ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",0))
+6 IF $$ALL
DO REPLACE^FSCLDR(FSCLNAME,FSCLNUM)
QUIT
+7 DO GETDEF^FSCLMPME(FSCLNUM,.DEF)
+8 SET PREOP=""
IF CHOICE=1
SET PREOP="ADD"
+9 WRITE !,"Replace line ",^TMP("FSC MODIFY LISTS",$JOB,+$ORDER(^TMP("FSC MODIFY LISTS",$JOB,"IDX",CHOICE,0)),0)
+10 DO EDIT^FSCLMPME(.NEWLINE,PREOP,.OK)
+11 IF 'OK
QUIT
+12 SET CHOICE=+$ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",0))
SET (CNT,LINE)=0
FOR
SET LINE=$ORDER(DEF(LINE))
if LINE<1
QUIT
Begin DoDot:1
+13 SET CNT=CNT+1
IF CNT=CHOICE
SET NEWDEF(CNT)=CNT_U_NEWLINE
QUIT
+14 SET NEWDEF(CNT)=DEF(LINE)
SET $PIECE(NEWDEF(CNT),U)=CNT
End DoDot:1
+15 DO STUFF^FSCLMPMS
+16 QUIT
+17 ;
INSERT ; from FSCLMPE
+1 NEW CHOICE,CNT,DEF,LINE,NEWCNT,NEWDEF,NEWLINE,NEWLINES,OK,PREOP
KILL DEF,NEWDEF,NEWLINES
+2 WRITE !,"Insert lines after:"
+3 SET CHOICE="0-"_+@VALMAR
DO SELECT^FSCUL(CHOICE,"S^Select line","","MVALUES",.OK)
+4 IF 'OK
QUIT
+5 SET CHOICE=+$ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",0))
+6 DO GETDEF^FSCLMPME(FSCLNUM,.DEF)
+7 SET PREOP=""
IF CHOICE=0
SET PREOP="ADD"
+8 IF CHOICE
WRITE !,"Insert after line ",^TMP("FSC MODIFY LISTS",$JOB,+$ORDER(^TMP("FSC MODIFY LISTS",$JOB,"IDX",CHOICE,0)),0)
+9 DO ADD(CHOICE,PREOP,.DEF)
+10 QUIT
+11 ;
ADD(CHOICE,PREOP,DEF) ; from FSCLDR
+1 ; not scoped
+2 SET CNT=0
FOR
Begin DoDot:1
+3 DO EDIT^FSCLMPME(.NEWLINE,PREOP,.OK)
+4 IF OK
SET CNT=CNT+1
SET NEWLINES(CNT)=NEWLINE
SET PREOP=""
WRITE !,"Next line:"
End DoDot:1
if 'OK
QUIT
+5 IF '$ORDER(NEWLINES(0))
QUIT
+6 SET CHOICE=+$ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",0))
SET CNT=0
+7 IF CHOICE=0
Begin DoDot:1
+8 SET NEWCNT=0
FOR
SET NEWCNT=$ORDER(NEWLINES(NEWCNT))
if NEWCNT<1
QUIT
SET NEWLINE=NEWLINES(NEWCNT)
Begin DoDot:2
+9 SET CNT=CNT+1
SET NEWDEF(CNT)=CNT_U_NEWLINE
End DoDot:2
End DoDot:1
+10 SET LINE=0
FOR
SET LINE=$ORDER(DEF(LINE))
if LINE<1
QUIT
Begin DoDot:1
+11 SET CNT=CNT+1
SET NEWDEF(CNT)=DEF(LINE)
SET $PIECE(NEWDEF(CNT),U)=CNT
+12 IF CNT=CHOICE
Begin DoDot:2
+13 SET NEWCNT=0
FOR
SET NEWCNT=$ORDER(NEWLINES(NEWCNT))
if NEWCNT<1
QUIT
SET NEWLINE=NEWLINES(NEWCNT)
Begin DoDot:3
+14 SET CNT=CNT+1
SET NEWDEF(CNT)=CNT_U_NEWLINE
End DoDot:3
End DoDot:2
End DoDot:1
+15 DO STUFF^FSCLMPMS
+16 QUIT
+17 ;
DELETE ; from FSCLMPE
+1 NEW CHOICE,CNT,DEF,LINE,OK,NEWDEF
KILL DEF,NEWDEF
+2 WRITE !,"Delete lines:"
+3 SET CHOICE="1-"_+@VALMAR
DO SELECT^FSCUL(CHOICE,"^Select line(s)","","MVALUES",.OK)
+4 IF 'OK
QUIT
+5 IF $$ALL
DO WARNING^FSCMU(FSCLNAME,.OK)
if OK
DO DELETE^FSCLDR(FSCLNAME,FSCLNUM)
QUIT
+6 DO GETDEF^FSCLMPME(FSCLNUM,.DEF)
+7 IF $ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",0))=1
IF $PIECE($GET(DEF(+$ORDER(DEF(0)))),U,2)'="A"
Begin DoDot:1
+8 WRITE !,"You cannot delete these lines."
+9 WRITE !,"The remaining query must begin with an 'Add' operation.",$CHAR(7)
HANG 2
End DoDot:1
QUIT
+10 SET (CNT,LINE)=0
FOR
SET LINE=$ORDER(DEF(LINE))
if LINE<1
QUIT
Begin DoDot:1
+11 IF $DATA(^TMP("FSC SELECT",$JOB,"MVALUES",LINE))
QUIT
+12 SET CNT=CNT+1
SET NEWDEF(CNT)=DEF(LINE)
SET $PIECE(NEWDEF(CNT),U)=CNT
End DoDot:1
+13 DO STUFF^FSCLMPMS
+14 QUIT
+15 ;
CHECK(LIST,USER) ; $$(list,user) -> 1 allows editing or 0 does not allow editing
+1 ; to edit a list you must be a NOIS specialist and either own the list or be a supervisor
+2 if '$DATA(^FSC("SPEC",USER,0))
QUIT 0
if $PIECE(^(0),U,7)
QUIT 1
if $PIECE($GET(^FSC("LIST",LIST,0)),U,2)=USER
QUIT 1
QUIT 0
+3 ;
ALL() ; $$() -> 1 if all selections in list are chosen, else 0
+1 NEW CNT,SEL
+2 SET (CNT,SEL)=0
FOR
SET SEL=$ORDER(^TMP("FSC SELECT",$JOB,"MVALUES",SEL))
if SEL<1
QUIT
SET CNT=CNT+1
+3 IF CNT=+@VALMAR
QUIT 1
+4 QUIT 0