Wiki source code of homeopathsSheet

Version 1.90 by Jip-jan Alunkel on março 08, 15:14

Show last authors
1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
4 #set($discard = $services.localization.use('document', 'homeopaths.Code.translations'))
5 #set($discard = $services.localization.use('document', 'assets.pagemaker.translations'))
6 #set($discard = $xwiki.ssx.use('assets.pagemaker.WebHome', {'minify': false}))
7 #set($discard = $xwiki.jsx.use('assets.pagemaker.WebHome', {'minify': false, 'language': $context.language, 'myParameter': 'value'}))
8 #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument())
9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
10 #set($theClass = "homeopaths.Code.homeopathsClass")
11 ## Create object (important for sheet binding, do not remove)
12 #set($theDocObj = $doc.getObject($theClass, true))
13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
14 $theDoc.getContent()
15 {{html wiki="true" clean="false"}}
16 #if(!$isGuest)
17 <script>
18 var pagemakerOffspring = "disable";
19 </script>
20 #end
21 #if($hasRight)
22 <p class="buttons text-align-right">
23 <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow">
24 <span class="fa fa-pencil"></span>
25 <span class="btn-label">Edit contents</span>
26 </a>
27 </p>
28 #end
29 #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent)
30 #set($spaceTitle = $spaceReference.getName())
31 <div class="clearfix"></div>
32 #if($xcontext.action == "view")
33 <div id="${spaceTitle}" class="box sheet_properties">
34 <h2>Details</h2>
35 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
36 #set($classProperties = [
37 {'practiceName': {'type': 'text'}},
38 {'pmStreet': {'type': 'text'}},
39 {'pmHousenumber': {'type': 'text', 'parent': 'certification'}},
40 {'pmPostcode': {'type': 'text'}},
41 {'pmCity': {'type': 'text'}},
42 {'pmCounty': {'type': 'text', 'parent': 'certification'}},
43 {'pmState': {'type': 'text'}},
44 {'pmCountry': {'type': 'text'}},
45 {'certification': {'type': 'checkbox', 'opener': 1}},
46 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
47 ])
48
49 #if($hasRight)
50 <p class="buttons text-align-right">
51 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
52 <span class="btn-label">Edit details</span>
53 </a>
54 </p>
55 #end
56 </div>
57 #if($hasRight)
58 #set($form_start = {
59 "id": "homeopaths_form",
60 "product": "homeopath details",
61 "method": "post",
62 "url": "",
63 "use_captcha": "false"
64 })
65 #* #set($thisObj = {})
66 #set($children = {})
67 #set($nonChildren = {})
68 #foreach($item in $classProperties.keySet())
69 #if($classProperties[$item].opener == 1)
70 #set($parentID = $classProperties[$item].parent)
71 #if(!$children[$parentID])
72 #set($discard = $children.put("$parentID", {}))
73 #end
74 #set($discard = $children["$parentID"].put($item, $classProperties[$item]))
75 #elseif($classProperties[$item].parent)## ???? Ws fout
76 #else
77 #set($discard = $nonChildren.put($item, $classProperties[$item]))
78 #end
79 #end
80 ## #createElementObjects($nonChildren)
81 *#
82 #set($lastChild = "")
83 #foreach($property in $classProperties)
84 #foreach($item in $property.keySet())
85 #set($key = $item)
86 #end
87 #foreach($item in $property.values())
88 #set($propertyType = $item.type)
89 #set($propertyOpener = $item.opener)
90 #set($propertyParent = $item.parent)
91 #set($extraAttributes = $item.extraAttributes)
92 #end
93 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
94
95 #if($theDocObj.getProperty($key))
96 #set($value = $theDocObj.getProperty($key).value)
97 #set($newElem = {
98 "id" : "$key",
99 "type" : $propertyType,
100 "required" : "false",
101 "label" : "$label",
102 "data-create-xobj" : "true",
103 "data-xobj-classname" : $theClass,
104 "data-xobj-fieldname" : "$key",
105 "value" : "$value"
106 })
107 #if($extraAttributes)
108 #set($attrMap = $extraAttributes)
109 #foreach($attr in $attrMap.keySet())
110 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
111 #end
112 #end
113 #if($propertyOpener)
114 #set($discard = $newElem.put("data-opener", "true"))
115 #end
116 #if($propertyParent)
117 #set($lastChild = $key)
118 #elseif($lastChild != "")
119 #createExpandEnd()
120 #end
121 #createFormElement($newElem)
122 #if($propertyOpener)
123 #createExpandStart($newElem $newElem["value"])
124 #end
125 #end
126
127 #*
128 #if($theDocObj.getProperty($property))
129 <p class="property">
130 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
131 #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout.
132 <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span>
133 #else
134 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
135 #end
136 </p>
137 #end
138 #end
139 *#
140
141 #end
142
143 #set($submit = {
144 "id" : "edit_details",
145 "button-text" : "Save changes",
146 "clean": "true",
147 "help-block" : ""
148 })
149 #set($form_end = {
150 "use_captcha": "false"
151 })
152 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
153 <div class="modal-dialog modal-dialog-centered" role="document">
154 <div class="modal-content">
155 #createFormStart($form_start)
156 <div class="modal-header">
157 <h3 class="modal-title">Details</h3>
158 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
159 <span aria-hidden="true">&times;</span>
160 </button>
161 </div>
162 <div class="modal-body">
163 #foreach($obj in $thisObj)
164 #createFormElement($obj)
165 #end
166 </div>
167 <div class="modal-footer">
168 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
169 #createSubmit($submit)
170 </div>
171 #createFormEnd($form_end)
172 </div>
173 </div>
174 </div>
175 #end
176 #else
177 This page can not be viewed in inline mode.
178 #end
179
180 #macro(createElementObject $properties)
181 #foreach($item in $properties.keySet())
182 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
183 #if($theDocObj.getProperty($item))
184 #set($value = $theDocObj.getProperty($item).value)
185 #set($newElem = {
186 "id" : "$item",
187 "type" : $classProperties[$item].type,
188 "required" : "false",
189 "label" : "$label",
190 "data-create-xobj" : "true",
191 "data-xobj-classname" : $theClass,
192 "data-xobj-fieldname" : "$item",
193 "value" : "$value"
194 })
195 #if($classProperties[$item].opener == 1)
196 #set($discard = $newElem.put("data-opener", "true"))
197 #end
198 #if($classProperties[$item].extraAttributes)
199 #set($attrMap = $classProperties[$item].extraAttributes)
200 #foreach($attr in $attrMap.keySet())
201 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
202 #end
203 #end
204 #set($thisObj["$item"] = $newElem)
205 #end
206 #end
207 #end
208
209 {{/html}}
210 {{/velocity}}