1 | C0CCMT ; CCDCCR/GPL - CCR/CCD PROCESSING FOR COMMENTS ; 05/21/10
|
---|
2 | ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
|
---|
3 | ;Copyright 2010 George Lilly, University of Minnesota and others.
|
---|
4 | ;
|
---|
5 | ; This program is free software: you can redistribute it and/or modify
|
---|
6 | ; it under the terms of the GNU Affero General Public License as
|
---|
7 | ; published by the Free Software Foundation, either version 3 of the
|
---|
8 | ; License, or (at your option) any later version.
|
---|
9 | ;
|
---|
10 | ; This program is distributed in the hope that it will be useful,
|
---|
11 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | ; GNU Affero General Public License for more details.
|
---|
14 | ;
|
---|
15 | ; You should have received a copy of the GNU Affero General Public License
|
---|
16 | ; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | ;
|
---|
18 | ;
|
---|
19 | W "NO ENTRY FROM TOP",!
|
---|
20 | Q
|
---|
21 | ;
|
---|
22 | EXTRACT(NOTEXML,DFN,NOTEOUT) ; EXTRACT NOTES INTO XML TEMPLATE
|
---|
23 | ; NOTEXML AND NOTEOUT ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
---|
24 | ;
|
---|
25 | D SETVARS^C0CPROC ; SET UP VARIABLES FOR PROCEDUCRES, ENCOUNTERS, AND NOTES
|
---|
26 | ;I '$D(@C0CNTE) Q ; NO NOTES AVAILABLE
|
---|
27 | D MAP(NOTEXML,C0CNTE,NOTEOUT) ;MAP RESULTS FOR NOTES
|
---|
28 | Q
|
---|
29 | ;
|
---|
30 | MAP(NOTEXML,C0CNTE,NOTEOUT) ; MAP PROCEDURES XML
|
---|
31 | ;
|
---|
32 | N ZTEMP S ZTEMP=$NA(^TMP("C0CCCR",$J,DFN,"NOTETEMP")) ;WORK AREA FOR TEMPLATE
|
---|
33 | K @ZTEMP
|
---|
34 | N ZBLD
|
---|
35 | S ZBLD=$NA(^TMP("C0CCCR",$J,DFN,"NOTEBLD")) ; BUILD LIST AREA
|
---|
36 | D QUEUE^C0CXPATH(ZBLD,NOTEXML,1,1) ; FIRST LINE
|
---|
37 | N ZINNER
|
---|
38 | D QUERY^C0CXPATH(NOTEXML,"//Comments/Comment","ZINNER") ;ONE NOTE
|
---|
39 | N ZTMP,ZVAR,ZI
|
---|
40 | S ZI=""
|
---|
41 | F S ZI=$O(@C0CNTE@(ZI)) Q:ZI="" D ;FOR EACH NOTE
|
---|
42 | . S ZTMP=$NA(@ZTEMP@(ZI)) ;THIS NOTE XML
|
---|
43 | . S ZVAR=$NA(@C0CNTE@(ZI)) ;THIS NOTE VARIABLES
|
---|
44 | . D MAP^C0CXPATH("ZINNER",ZVAR,ZTMP) ; MAP THE PROCEDURE
|
---|
45 | . N ZNOTE,ZN
|
---|
46 | . D CLEAN($NA(@C0CNTE@(ZI,"TEXT"))) ;REMOVE CONTROL CHARS AND XML RESERVED
|
---|
47 | . M ZNOTE=@C0CNTE@(ZI,"TEXT") ;THE NOTE TO ADD TO THE BUILD
|
---|
48 | . S ZNOTE(0)=$O(ZNOTE(""),-1) ;LENGTH OF THE NOTE
|
---|
49 | . D INSERT^C0CXPATH(ZTMP,"ZNOTE","//Comment/Description/Text")
|
---|
50 | . D QUEUE^C0CXPATH(ZBLD,ZTMP,1,@ZTMP@(0)) ;QUE FOR BUILD
|
---|
51 | D QUEUE^C0CXPATH(ZBLD,NOTEXML,@NOTEXML@(0),@NOTEXML@(0))
|
---|
52 | N ZZTMP
|
---|
53 | D BUILD^C0CXPATH(ZBLD,NOTEOUT) ;BUILD FINAL XML
|
---|
54 | K @ZTEMP,@ZBLD,@C0CNTE
|
---|
55 | Q
|
---|
56 | ;
|
---|
57 | CLEAN(INARY) ; INARY IS PASSED BY NAME
|
---|
58 | ; REMOVE CONTROL CHARACTERS AND XML RESERVED SYMBOLS FROM THE ARRAY
|
---|
59 | N ZI,ZJ S ZI=""
|
---|
60 | F S ZI=$O(@INARY@(ZI)) Q:ZI="" D ;
|
---|
61 | . S @INARY@(ZI)=$$CLEAN^C0CXPATH(@INARY@(ZI)) ; CONTROL CHARS
|
---|
62 | . S @INARY@(ZI)=$$SYMENC^MXMLUTL(@INARY@(ZI)) ; XML RESERVED SYMBOLS
|
---|
63 | Q
|
---|
64 | ;
|
---|