Wiki source code of homeopathsSheet

Last modified by Jip-jan Alunkel on March 26, 17:31

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