Wiki source code of homeopathsSheet

Version 3.263 by Jip-jan Alunkel on March 16, 01:57

Show last authors
1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
4 #set($discard = $services.localization.use('document', 'assets.global.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($subjectTitle = $doc.getFullName().split('\.')[0])
9 ## Find the correct class name. This is if the class name starts with the name of the top parent space (referenced here by $subjectTitle).
10 ## Specify a class name below to override this.
11 $subjectTitle
12 #set($theClass = "")
13 #set($docObjects = $doc.getxWikiObjects())
14 #foreach($docObjectKey in $docObjects.keySet())
15 #if($docObjectKey.indexOf($subjectTitle) == 0)
16 #if($theClass == "")
17 #set($theClass = $docObjectKey)
18 #end
19 #end
20 #end
21 #set($theDocObj = $doc.getObject($theClass, true))
22 #set($hasRight = !$isGuest && ($theDocObj.getProperty('doc_owner').value == $context.getUser() || $hasAdmin))
23 ## ADDRESS: Prepare object to provide hidden values to the address input. The keys are equal to the class property names.
24 ## The entries will be filled by the class property values.
25 #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''})
26 #foreach($item in $xa.keySet())
27 #if($theDocObj.getProperty("$item").value)
28 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
29 #end
30 #end
31 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
32 ## 'opener': 1 --> input functions as an interface control element, it 'opens' an additional block of form inputs. Only for select, input or radio inputs.
33 ## 'classless': 1 --> input is not bound to any XClass or XClass property.
34 ## 'disabled': 1 --> Will not show up in the form at all.
35 ## 'extraAttributes': {"disabled": "disabled"} --> Will show up in the form as a disabled input.
36 #set($classProperties = {
37 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}},
38 'pmAddress': {'type': 'address', 'parent': 'editAddress', "help-block": 1, 'extraAttributes': {"pmLatlong": "$xa['pmLatlong']", "pmCountry": "$xa['pmCountry']", "pmState": "$xa['pmState']", "pmCounty": "$xa['pmCounty']", "pmPostcode": "$xa['pmPostcode']", "pmCity": "$xa['pmCity']", "pmStreet": "$xa['pmStreet']", "pmHousenumber": "$xa['pmHousenumber']", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass"}},
39 'practiceName': {'type': 'text', 'disabled': 0, "help-block": 1, 'extraAttributes': {"disabled": "disabled"}},
40 'pmStreet': {'type': 'text', 'disabled': 1},
41 'pmHousenumber': {'type': 'text', 'disabled': 1},
42 'pmPostcode': {'type': 'text', 'disabled': 1},
43 'pmCity': {'type': 'text', 'disabled': 1},
44 'pmCounty': {'type': 'text', 'disabled': 1},
45 'pmState': {'type': 'text', 'disabled': 1},
46 'pmCountry': {'type': 'text', 'disabled': 1},
47 'nrOfHomeopaths': {'type': 'number'},
48 'certification': {'type': 'checkbox', 'opener': 1},
49 'certificationFrom': {'type': 'text', 'parent': 'certification'}
50 })
51 $doc.getTranslatedDocument().getContent()
52
53 {{html wiki="true" clean="false"}}
54 ## Show the content edit button
55 #if($hasRight)
56 <p class="buttons text-align-right">
57 <a class="btn btn-primary" title="Edit" href="$doc.getURL('edit','editor=wysiwyg')" role="button" rel="nofollow">
58 <span class="btn-label">$services.localization.render("global.multiword.edit_content")</span>
59 </a>
60 </p>
61 #end
62 #if(!$isGuest)<p><script>var pmMenuCreate = "disable";</script></p>#end
63 <div class="clearfix"></div>
64
65 ## Show properties from the classProperties Map.
66 #if($xcontext.action == "view")
67 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
68 <div id="${subjectTitle}" class="sheet_properties inline-data-summary">
69 ## Show the address
70 #createAddress($theClass 1)
71 ## Set the XClass properties which you would like to be displayed.
72 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
73 ## Show the above chosen properties
74 #foreach($property in $properties)
75 #set($hide = 0)
76 ## All form elements that are hidden in the form should also be hidden in the page.
77 #if($classProperties["$property"].containsKey('parent'))
78 #set($parentKey = $classProperties["$property"].parent)
79 #if((($classProperties["$parentKey"].type == "checkbox" || $classProperties["$parentKey"].type == "radio") && $theDocObj.getProperty($parentKey).value == 0) || !$theDocObj.getProperty($parentKey).value)
80 #set($hide = 1)
81 #end
82 #end
83 #if($hide == 0)
84 <p class="property">
85 ## Show value only if there is a value to show, otherwise set to 'unknown'.
86 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}.label")</span>#if($theDocObj.getProperty($property).value && $theDocObj.getProperty($property).value != "") <span class="property-value">$doc.display($property)</span>#else <span class="property-value ghost">$services.localization.render("global.word.unknown")</span>#end
87 </p>
88 #end
89 #end
90 #if($hasRight)
91 <p class="buttons text-align-right">
92 <a class="btn btn-secondary" title="$services.localization.render("edit")" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
93 <span class="btn-label">$services.localization.render("global.multiword.edit_content")</span>
94 </a>
95 </p>
96 #end
97 </div>
98
99 ## Show the properties edit form in a modal.
100 #if($hasRight)
101 #set($form_start = {
102 "id": "homeopaths_form",
103 "product": "homeopath details",
104 "method": "post",
105 "url": "",
106 "use_captcha": "false"
107 })
108 #set($submit = {
109 "id" : "edit_details",
110 "button-text" : "Save changes",
111 "clean": "true",
112 "help-block" : ""
113 })
114 #set($form_end = {
115 "use_captcha": "false"
116 })
117 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
118 <div class="modal-dialog modal-dialog-centered" role="document">
119 <div class="modal-content">
120 #createFormStart($form_start)
121 <div class="modal-header">
122 <h3 class="modal-title">$services.localization.render("global.word.details")</h3>
123 <button type="button" class="close" data-dismiss="modal" aria-label="$services.localization.render("close")">
124 <span aria-hidden="true">&times;</span>
125 </button>
126 </div>
127 <div class="modal-body">
128 #createAddress($theClass 1)
129 #set($lastChild = "")
130 #foreach($propertyName in $classProperties.keySet())
131 #set($value = "")
132 #set($item = $classProperties["$propertyName"])
133 #if(!$item.containsKey("disabled") || $item["disabled"] == 0)
134 #if(!$item.extraAttributes)
135 #set($item.extraAttributes = {})
136 #end
137 #set($translatedProperties = {})
138 #set($checkBool = ["false","true"])
139 #set($hasClassObj = !$item.containsKey("classless") && $theDocObj.getProperty($propertyName))
140 #if($item.type == "checkbox" || $item.type == "radio")
141 #if($hasClassObj)
142 #set($item.extraAttributes["data-checked"] = "$checkBool[$theDocObj.getProperty($propertyName).value]")
143 #else
144 #if(!$item.extraAttributes.containsKey("data-checked"))
145 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
146 #end
147 #end
148 #set($value = "1")
149 #else
150 #if($hasClassObj)
151 #if($theDocObj.getProperty($propertyName).value)
152 #set($value = $theDocObj.getProperty($propertyName).value)
153 #end
154 #end
155 #end
156 #if($item.type != "checkbox" && $item.type != "radio" && (!$item.containsKey("disabled") || $item["disabled"] == 0))
157 #set($translatedProperties = {
158 'aria_label': 'data-aria-label',
159 'placeholder': 'placeholder'
160 })
161 #end
162 #set($translatedProperties['label'] = 'label')
163 #if($item['help-block'] == 1)
164 #set($translatedProperties['help_block'] = 'help-block')
165 #end
166 #foreach($key in $translatedProperties.keySet())
167 #set($item.extraAttributes["$translatedProperties[$key]"] = $services.localization.render("homeopaths.classproperty.${propertyName}.${key}"))
168 #end
169 #if($item.containsKey("classless"))
170 #set($newElem = {
171 "id" : "$propertyName",
172 "type" : $item.type,
173 "required" : "false",
174 "label" : "$label",
175 "value" : "$value"
176 })
177 #else
178 #set($newElem = {
179 "id" : "$propertyName",
180 "type" : $item.type,
181 "required" : "false",
182 "label" : "$label",
183 "data-create-xobj" : "true",
184 "data-xobj-classname" : $theClass,
185 "data-xobj-fieldname" : "$propertyName",
186 "value" : "$value"
187 })
188 #end
189 #if($item.extraAttributes.keySet().size() > 0)
190 #foreach($attr in $item.extraAttributes.keySet())
191 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
192 #end
193 #end
194 #if($item.opener)
195 #set($discard = $newElem.put("data-opener", "true"))
196 #end
197 #if($item.parent)
198 #set($lastChild = "$key")
199 #elseif($lastChild != "")
200 #set($lastChild = "")
201 #createExpandEnd()
202 #end
203 #createFormElement($newElem)
204 #if($item.opener)
205 #createExpandStart($newElem $value)
206 #end
207 #end
208 #end
209 </div>
210 <div class="modal-footer">
211 <button type="button" class="btn btn-secondary" title="$services.localization.render("close")" data-dismiss="modal">$services.localization.render("close")</button>
212 #createSubmit($submit)
213 </div>
214 #createFormEnd($form_end)
215 </div>
216 </div>
217 </div>
218 #end
219 #elseif($xcontext.action == 'edit' && ($request.get('editor') == 'inline' || $request.get('section')))
220 <p>$services.localization.render("global.line.inline_noedit")</p>
221 <ul>
222 <li>[[$services.localization.render("global.line.edit_in_full")>>path:$doc.getURL('edit','editor=wysiwyg')]]</li>
223 <li>[[$services.localization.render("back")>>$doc.fullName]]</li>
224 </ul>
225 #end
226 #macro(createAddress $className $withLabel)
227 #set($docObj = $doc.getObject($className))
228 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
229 #set($x = {})
230 #foreach($datapart in $addressArray)
231 #if($docObj.getProperty($datapart))
232 #set($datapart4Publish = $docObj.getProperty($datapart).value)
233 #if($datapart == 'pmCountry')
234 #set($datapart4Publish = $datapart4Publish.toUpperCase())
235 #end
236 #set($discard = $x.put("$datapart", $datapart4Publish))
237 #end
238 #end
239 <div class="formElement">
240 #if($withLabel)
241 <label>$services.localization.render("homeopaths.classproperty.pmAddress.label")</label>
242 #end
243 <address>
244 $doc.getTitle()<br />
245 $x['pmStreet'] $x['pmHousenumber']<br />
246 $x['pmPostcode'] $x['pmCity']<br />
247 $x['pmCounty'] $x['pmState']<br />
248 $x['pmCountry']
249 </address>
250 </div>
251 #end
252 {{/html}}
253 {{/velocity}}