Wiki source code of homeopathsSheet

Version 3.258 by Jip-jan Alunkel on March 15, 21:02

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