source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUFH1.m@ 862

Last change on this file since 862 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1TIUFH1 ; SLC/MAM - LM Template H (DDEF Hierarchy) Actions Expand/Collapse, Jump to DDEF (EXPDEF(ASK,FILEDA)), EXPAND1(EINFO), COLLAPSE(EINFO) ;10/2/97 21:44
2 ;;1.0;TEXT INTEGRATION UTILITIES;**11**;Jun 20, 1997
3 ;
4EXPCOLL ; Template A Action Expand/Collapse
5 N INFO,OXPDLCNT,MISSITEM,FILEDA,MSG,TIUFXNOD,DTOUT,DIRUT,DIROUT
6 S VALMBCK="R",TIUFXNOD=$G(XQORNOD(0))
7 D EN^VALM2(TIUFXNOD,"SO") I '$O(VALMY(0)) S VALMBCK="" G EXPCX
8 S INFO=$G(^TMP("TIUF1IDX",$J,$O(VALMY(0)))) I 'INFO W !!," Missing List Manager Data; See IRM",! D PAUSE^TIUFXHLX S VALMBCK="Q" G EXPCX
9 S FILEDA=$P(INFO,U,2)
10 D PARSE^TIUFLLM(.INFO) S OXPDLCNT=INFO("XPDLCNT") ;Old XPDLCNT
11 I OXPDLCNT D COLLAPSE(.INFO) S VALMCNT=VALMCNT-OXPDLCNT G EXPCX
12 I '$O(^TIU(8925.1,FILEDA,10,0)) S VALMBCK="",MSG=" Entry has no Items to Expand/Collapse" W !!,MSG,! H 1 G EXPCX
13 S MISSITEM=$$MISSITEM^TIUFLF4(FILEDA) I MISSITEM W !!," Can't Expand/Collapse: File Entry "_FILEDA_" Has Nonexistent Item "_MISSITEM_"; See IRM.",! D PAUSE^TIUFXHLX S VALMBCK="" G EXPCX
14 D EXPAND1(.INFO)
15 S VALMCNT=VALMCNT+INFO("XPDLCNT")
16 I (+INFO+INFO("XPDLCNT"))>(VALMBG+VALM("LINES")-1) S VALMBG=+INFO
17EXPCX I $D(DTOUT) S VALMBCK="Q"
18 Q
19 ;
20EXPDEF(ASK,FILEDA) ; If ASK, Template H action Jump to Document Def; else Expand to show entry FILEDA
21 ; Assumes Docmt Def except Shared Components have at most 1 parent
22 ; Requires ASK=1 to ask which entry to jump to, = 0 to not ask.
23 ; Requires FILEDA if ASK = 0.
24 N DIC,X,Y,INFO,NODE0,ORPHAN,PARENT,MSG,OXPDLCNT,TIUJ,ENTRYNO
25 N EINFO,PFILEDA,MISSITEM,TIUFXNOD,MSG1,LINENO,DTOUT,DIRUT,DIROUT
26 S TIUFXNOD=$G(XQORNOD(0))
27 I 'ASK G NOASK
28 N FILEDA S VALMBCK="R"
29 D FULL^VALM1
30 S DIC=8925.1,DIC(0)="AEMNQ"
31ASK K PARENT,Y,MSG D ^DIC I Y=-1 G EXPDX
32 S FILEDA=+Y,NODE0=^TIU(8925.1,FILEDA,0)
33 S ORPHAN=$$ORPHAN^TIUFLF4(FILEDA,NODE0,.PARENT)
34 I $P(NODE0,U,4)="O" S MSG=" Objects are not in the Hierarchy: Use SORT Option"
35 I $P(NODE0,U,10) S MSG=" Shared Components can occur more than once in the hierarchy; Can't Jump to",MSG1="them. To find them, use SORT Option. Edit/View shows their parents."
36 I ORPHAN="YES" S MSG=" Orphans are not in the Hierarchy: Use SORT Option"
37 I $D(MSG) W !!,MSG,! W:$D(MSG1) MSG1 K MSG,MSG1 G ASK
38NOASK S INFO=^TMP("TIUF1IDX",$J,1) D PARSE^TIUFLLM(.INFO)
39 I 'ASK S NODE0=^TIU(8925.1,FILEDA,0),ORPHAN=$$ORPHAN^TIUFLF4(FILEDA,NODE0,.PARENT)
40 S OXPDLCNT=INFO("XPDLCNT") ;Original XPDLCNT
41 D COLLAPSE(.INFO) S VALMCNT=VALMCNT-OXPDLCNT
42 F TIUJ=$O(PARENT(1000),-1):-1:1 D I MISSITEM G EXPDX
43 . S ENTRYNO=$O(^TMP("TIUF1IDX",$J,"DAF",PARENT(TIUJ),0))
44 . S EINFO=^TMP("TIUF1IDX",$J,ENTRYNO)
45 . D PARSE^TIUFLLM(.EINFO) S PFILEDA=$P(EINFO,U,2)
46 . S MISSITEM=$$MISSITEM^TIUFLF4(PFILEDA)
47 . I MISSITEM W !! W $S(ASK:" Can't Jump",1:"Can't expand to show "_$P(NODE0,U)),": File Entry "_PFILEDA_" Has Nonexistent Item "_MISSITEM_"; See IRM",! D PAUSE^TIUFXHLX Q
48 . D EXPAND1(.EINFO) S VALMCNT=VALMCNT+EINFO("XPDLCNT")
49 . Q
50 S LINENO=$O(^TMP("TIUF1IDX",$J,"DAF",PARENT(0),0))
51 I ASK,LINENO<VALMBG!(LINENO>(VALMBG+VALM("LINES")-1)) S VALMBG=LINENO
52EXPDX I ASK D RESET^TIUFXHLX S VALMBCK="R" I $D(DTOUT) S VALMBCK="Q"
53 Q
54 ;
55COLLAPSE(EINFO) ; Collapse ENTRYNO
56 ; Requires EINFO array, where EINFO = ^TMP("TIUFIDX,$J,ENTRYNO), and
57 ;where EINFO array is as set in PARSE^TIUFLLM(EINFO).
58 ; Requires TIUFTMPL.
59 ; Updates array EINFO; Does NOT update VALMCNT.
60 I ($D(EINFO)'=11) G COLLX
61 I 'EINFO("XPDLCNT") G COLLX
62 D UPDATE^TIUFLLM1(TIUFTMPL,-EINFO("XPDLCNT"),+EINFO,.EINFO)
63COLLX ;
64 Q
65 ;
66EXPAND1(EINFO) ; Set items of List Manager array entry ENTRYNO into
67 ;LM array (ie., expands entry); Updates Plus in front of ENTRYNO.
68 ; Does NOT update IN USE Column.
69 ; Requires EINFO array, where EINFO = ^TMP("TIUFIDX,$J,ENTRYNO), and
70 ;where EINFO array is as set in PARSE^TIUFLLM(EINFO).
71 ; Requires TIUFTMPL.
72 ; Requires TIUFWHO, set in Options TIUF/A/C/H EDIT/SORT/CREATE DDEFS CLIN/MGR/NATL.
73 ; Updates array EINFO.
74 ; Must check that items exist in file BEFORE calling EXPAND1
75 N OLDLNO,LINENO,TIUREC
76 S (OLDLNO,LINENO)=+EINFO
77 D BUFITEMS^TIUFLT(TIUFTMPL,.EINFO,.LINENO)
78 ;If no items, update +, QUIT:
79 I LINENO=OLDLNO Q:TIUFTMPL="C" S TIUREC=^TMP("TIUF1",$J,+EINFO,0),TIUREC=$$PLUSUP^TIUFLLM(.EINFO,TIUREC),^TMP("TIUF1",$J,+EINFO,0)=TIUREC Q
80 ; Set Buffer items into LM Template array, update entry being expanded:
81 D UPDATE^TIUFLLM1(TIUFTMPL,LINENO-OLDLNO,OLDLNO,.EINFO)
82EXPAX ;
83 Q
84 ;
Note: See TracBrowser for help on using the repository browser.