source: EWD/r/KBANEWD1.m@ 1214

Last change on this file since 1214 was 1202, checked in by Sam Habiel, 13 years ago

Added routines; reorganized dirs

File size: 2.5 KB
Line 
1KBANEWD1 ; KBAN/SMH - Custom Tag Processor ; 6/8/11 4:01pm
2 ;;
3SS(nodeOID,attrValues,docOID,technology) ; <fm:session /> to get VISTA Session Variables
4 N attr
5 S attr("method")="SS2^KBANEWD1"
6 S attr("param1")="#ewd_sessid"
7 S attr("type")="procedure"
8 N xOID s xOID=$$addElementToDOM^%zewdDOM("ewd:execute",nodeOID,"",.attr)
9 D removeIntermediateNode^%zewdDOM(nodeOID)
10 quit
11SS2(sessid)
12 d mergeArrayFromSession^%zewdAPI(.DUZ,"DUZ",sessid)
13 d mergeArrayFromSession^%zewdAPI(.IO,"IO",sessid)
14 s U=$$getSessionValue^%zewdAPI("U",sessid)
15 quit
16EDIT(nodeOID,attrValues,docOID,technology) ; Fileman Field Edit tag
17 ; Get Attributes supplied to us: dd, fields, iens
18 ;
19 N attrs
20 D getAttributeValues^%zewdCustomTags(nodeOID,.attrs)
21 N DD S DD=$g(attrs("dd")) ; Data Dictionary
22 N FIELDS S FIELDS=$g(attrs("fields")) ; Fields to Edit
23 N IENS S IENS=$g(attrs("iens")) ; IENs to Edit
24 ;
25 ; Does our Form Tag Exist?
26 N fOID S fOID=$$getElementById^%zewdDOM("fmEdit",docOID)
27 ; -----
28 ; If it doesn't exist, create it
29 IF fOID="" DO
30 . ; Create the Form Tag
31 . ; Attributes
32 . N attr
33 . S attr("name")="fmEdit"
34 . S attr("id")="fmEdit"
35 . S attr("action")="ewd"
36 . S attr("method")="post"
37 . ;
38 . ; Add form
39 . S fOID=$$addElementToDOM^%zewdDOM("form",nodeOID,"",.attr,"")
40 ; -----
41 ; Destination Input Name
42 N dst S dst="DD"_$TR(DD,".","_")_"F"_$TR(FIELDS,".","_")
43 ;
44 ; Build <ewd:execute> to set the value of the default; child of form in fOID
45 K attr
46 S attr("method")="XTARGET^KBANEWD1"
47 S attr("param1")="#ewd_sessid"
48 S attr("param2")=dst
49 S attr("param3")=DD
50 S attr("param4")=$$stripSpaces^%zewdAPI(phpVars($P(IENS,"&php;",2))) ; becomes #DUZ
51 S attr("param5")=FIELDS
52 S attr("type")="procedure"
53 N xOID s xOID=$$addElementToDOM^%zewdDOM("ewd:execute",fOID,"",.attr)
54 ;
55 ; Add label
56 N text S text=$$GET1^DID(DD,FIELDS,"","LABEL") ; this should be i18n in MSC FM
57 S text=text_": "
58 K attr S attr("for")=dst
59 N lOID s lOID=$$addElementToDOM^%zewdDOM("label",fOID,"",.attr,text)
60 ; ------------
61 ;
62 ; Add Input Tag
63 ; Attributes
64 K attr
65 S attr("type")="text" ; Should be dynamic based on FM DataType
66 S attr("name")=dst
67 S attr("value")="*"
68 ;
69 ; Add input Tag under form tag
70 N iOID S iOID=$$addElementToDOM^%zewdDOM("input",fOID,"",.attr,"")
71 ;
72 ; Remove custom tag
73 D removeIntermediateNode^%zewdDOM(nodeOID)
74 ;break
75 QUIT
76 ;
77 ; ---
78 ;
79XTARGET(sessid,fieldName,DD,IENS,FIELDS) ; Proc - Xecute Target - Adds Default Value to Sess
80 N VAL S VAL=$$GET1^DIQ(DD,IENS,FIELDS)
81 D setSessionValue^%zewdAPI(fieldName,VAL,sessid)
82 QUIT
Note: See TracBrowser for help on using the repository browser.