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

TIUFD3.m

Go to the documentation of this file.
  1. TIUFD3 ; SLC/MAM - LM Template D Actions Edit Items, Edit Boilerplate Text ;4/17/97 11:02
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**17**;Jun 20, 1997
  1. ;
  1. EDITEMS ; Templates H, C, A, D Action Edit Items. Calls LM Template TIUFT.
  1. ; Requires TIUFTMPL.
  1. ; Requires TIUFWHO, set in Options TIUF/A/C/H EDIT/SORT/CREATE DDEFS CLIN/MGR/NATL.
  1. ; Sets TIUFACTT for Subtemplate T. Sets TIUFSTMP = T.
  1. I $G(TIUFSTMP)="D" G EDITEMS1
  1. N TIUFINFO,TIUFNOD0,TIUFVCN1,MISSITEM,TIUFXNOD,DTOUT,DIRUT,DIROUT
  1. S VALMBCK="",TIUFVCN1=VALMCNT,TIUFXNOD=$G(XQORNOD(0))
  1. I TIUFXNOD'["=" W !!," You may edit the Items of ONE Entry. Please select an Entry from the List.",!!
  1. D EN^VALM2(TIUFXNOD,"SO") Q:'$O(VALMY(0)) S TIUFINFO=$G(^TMP("TIUF1IDX",$J,$O(VALMY(0)))) I 'TIUFINFO W !!," Missing List Manager Data; See IRM",! D PAUSE^TIUFXHLX S VALMBCK="Q" G EDITX
  1. S FILEDA=$P(TIUFINFO,U,2),MISSITEM=$$MISSITEM^TIUFLF4(FILEDA) I MISSITEM W !!," Can't Edit Items: File Entry "_FILEDA_" Has Nonexistent Item "_MISSITEM_" ; See IRM.",! D PAUSE^TIUFXHLX S VALMBCK="Q" G EDITX
  1. D PARSE^TIUFLLM(.TIUFINFO)
  1. D NODE0ARR^TIUFLF(TIUFINFO("FILEDA"),.TIUFNOD0) G:$D(DTOUT) EDITX
  1. EDITEMS1 ; Entry point called by Edit Items of Template D.
  1. ; Requires CURRENT array TIUFINFO, CURRENT variable TIUFVCN1
  1. ;as set in EDVIEW^TIUFHA, updated (if Template A has changed)
  1. ;in AUPDATE^TIUFLA1, or (if Template H has changed) in UPDATE^TIUFLLM1.
  1. ;WARNING: +TIUFINFO may = 0 if Template A has changed!
  1. ; Requires array TIUFNOD0; Updates TIUFNOD0 upon return from Template T.
  1. ; If called from D, requires TIUFILIN as set in DSITEMS^TIUFD.
  1. ; If called from D, requires TIUFSTMP="D"
  1. N SUBTEMPL
  1. S SUBTEMPL=$G(TIUFSTMP)
  1. S VALMBCK=""
  1. N FILEDA,TYPE,STATUS,MSG,SHARED,USROWNS
  1. S FILEDA=TIUFINFO("FILEDA"),TYPE=$P(TIUFNOD0,U,4),SHARED=$P(TIUFNOD0,U,10)
  1. S USROWNS=$$PERSOWNS^TIUFLF2(FILEDA,DUZ)
  1. I TIUFWHO="C",'$$HASITEMS^TIUFLF1(FILEDA) D I $D(MSG) G EDITX
  1. . I USROWNS Q:TYPE="DOC" Q:TYPE="CO"&'SHARED
  1. . S MSG=" Entry has no Items",VALMBCK=""
  1. I TYPE="O" S MSG=" Objects do not have Items",VALMBCK="" G EDITX
  1. N TIUREC,TIUFVCN3,TIUFBG3,TIUFSTMP,TIUFACTT,TIUFIXED,EXPAND
  1. S TIUFSTMP="T" ;Items
  1. S TIUFACTT=$S("NM"[TIUFWHO:"A",TIUFWHO="C":"E",1:"V") ;Add, Edit, View
  1. S STATUS=$$STATWORD^TIUFLF5($P(TIUFNOD0,U,7)) ; e.g. INACTIVE
  1. D
  1. . I TYPE="" S TIUFACTT="V",MSG=" Entry has no Type; View Only" Q
  1. . I SHARED,TIUFTMPL'="A" S TIUFACTT="V",MSG=" Shared Components can be edited only through the SORT Option: View Only." Q
  1. . I 'SHARED,TYPE="DOC"!(TYPE="CO"),STATUS'="INACTIVE" S TIUFACTT="V",MSG=" Can't edit Items of a Title/Component unless entry is Inactive; View Only." Q
  1. . I SHARED,'$$CANEDIT^TIUFLF6(FILEDA) S TIUFACTT="V",MSG=" Shared Component with parent that isn't Inactive; View Only." Q
  1. . I USROWNS="" S TIUFACTT="V",MSG=" Entry has no Owner; View Only" Q
  1. . I USROWNS=0,TIUFWHO="C" S TIUFACTT="V",MSG=" Non-Owner; View Only" Q
  1. . I USROWNS=0,TIUFWHO'="C",SHARED S TIUFACTT="V",MSG=" Only the Owner can edit a Shared Component; View Only"
  1. K DIRUT I $D(MSG) W !!,MSG,! D PAUSE^TIUFXHLX K MSG I $D(DIRUT) Q
  1. ; If came from Template H rather than A AND If Edited Items directly from H rather than thru Edit/View (D), AND If H entry was expanded, then collapse entry (reexpand to items only when return):
  1. I TIUFTMPL="H",SUBTEMPL'="D" S EXPAND=TIUFINFO("XPDLCNT") I EXPAND D COLLAPSE^TIUFH1(.TIUFINFO) S VALMCNT=VALMCNT-EXPAND
  1. S TIUFVCN3=VALMCNT,TIUFBG3=VALMBG,TIUFIXED=$G(VALM("FIXED"))
  1. I TIUFACTT="A" D
  1. . I "NM"[TIUFWHO D EN^VALM("TIUFT ITEMS ADD/EDIT/VIEW MGR")
  1. D:TIUFACTT="E" EN^VALM("TIUFT ITEMS EDIT/VIEW CLIN")
  1. D:TIUFACTT="V" EN^VALM("TIUFT ITEMS VIEW MGR/CLIN")
  1. S VALMCNT=TIUFVCN3,VALMBG=TIUFBG3
  1. D NODE0ARR^TIUFLF(FILEDA,.TIUFNOD0) G:$D(DTOUT) EDITX
  1. ; If came from Template H rather than A AND If Edited Items directly from H rather than thru Edit/View (D), then update + for H and If H entry was expanded, reexpand to items only:
  1. I TIUFTMPL="H",SUBTEMPL'="D" D
  1. . ;Since Template is H, then need +. If 'Expand, just update +:
  1. . I 'EXPAND S TIUREC=^TMP("TIUF1",$J,+TIUFINFO,0),TIUREC=$$PLUSUP^TIUFLLM(.TIUFINFO,TIUREC),^TMP("TIUF1",$J,+TIUFINFO,0)=TIUREC
  1. . ;If Expand, that will automatically update + for template H:
  1. . I EXPAND D EXPAND1^TIUFH1(.TIUFINFO) S VALMCNT=VALMCNT+$P(TIUFINFO,U,3)
  1. ; Edit Items affects parentage: if came from Template A and sort by parentage, redo all of A:
  1. I TIUFTMPL="A" D:$E(TIUFATTR)="P" INIT^TIUFA G:$D(DTOUT) EDITX
  1. ; If not sort by parentage, don't update A here: Template A has been updated with each change to Template T.
  1. I SUBTEMPL="D" D DSITEMS^TIUFD(.TIUFILIN) S VALMCNT=TIUFILIN ;Update Items to end on Template D.
  1. S VALMBCK="R"
  1. EDITX ;
  1. I $D(MSG) W !!,MSG,! H 2
  1. I $D(DTOUT) S VALMBCK="Q"
  1. Q
  1. ;
  1. EDBOILTX ;Templates D, X Action Edit Boilerplate Text
  1. ; Requires CURRENT arrays TIUFINFO, TIUFNOD0.
  1. ; Requires TIUFBLIN as set in DSBOILTX^TIUFD.
  1. N FILEDA,LINENO,CNTCHNG,TIUFXNOD,MSG,STATUS,DTOUT,DIRUT,DIROUT
  1. S FILEDA=TIUFINFO("FILEDA")
  1. S VALMBCK="R",TIUFXNOD=$G(XQORNOD(0))
  1. S STATUS=$$STATWORD^TIUFLF5($P(^TIU(8925.1,FILEDA,0),U,7))
  1. I STATUS'="INACTIVE" W !!,"Entry is not Inactive: Can't edit Boilerplate Text" D PAUSE^TIUFXHLX S VALMBCK="" G EDBOX
  1. I $P(TIUFNOD0,U,10) D G:$D(MSG) EDBOX
  1. . I '$$PERSOWNS^TIUFLF2(FILEDA,DUZ) S MSG=" Shared Component: Only Owner can Edit Boilerplate Text"
  1. . I '$$CANEDIT^TIUFLF6(FILEDA) S MSG=" Shared Component with parent that isn't Inactive: Can't Edit Boilerplate Text"
  1. . I $D(MSG) W !!,MSG D PAUSE^TIUFXHLX S VALMBCK=""
  1. I TIUFSTMP="X" L +^TIU(8925.1,FILEDA):1 I '$T W !!," Another user is editing this entry.",! H 2 G EDBOX
  1. D EDBOIL^TIUFLD1(FILEDA,TIUFNOD0) G:$D(DTOUT) EDBOX
  1. D DEDBOIL^TIUFLD1(FILEDA) G:$D(DTOUT) EDBOX
  1. D NODE0ARR^TIUFLF(FILEDA,.TIUFNOD0) G:$D(DTOUT) EDBOX
  1. ; Update template D or X:
  1. S LINENO=TIUFBLIN D DSBOILTX^TIUFD(.LINENO) G:$D(DTOUT) EDBOX S VALMCNT=LINENO
  1. I TIUFTMPL="A" D AUPDATE^TIUFLA1(TIUFNOD0,FILEDA,.CNTCHNG) S:CNTCHNG TIUFVCN1=TIUFVCN1-1 ;doesn't match.
  1. I "HC"[TIUFTMPL D LINEUP^TIUFLLM1(.TIUFINFO,TIUFTMPL)
  1. EDBOX ;
  1. I TIUFSTMP="X" L -^TIU(8925.1,+$G(FILEDA))
  1. I $D(DTOUT) S VALMBCK="Q"
  1. Q
  1. ;