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