Wiki source code of homeopathsSheet

Version 3.292 by Jip-jan Alunkel on March 18, 22:59

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