Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FSCLMPM

FSCLMPM.m

Go to the documentation of this file.
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