Wiki broncode van homeopathsSheet
Version 3.180 by Jip-jan Alunkel on maart 11, 17:46
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{include reference="assets.pagemaker.macros"/}} |
2 | |||
3 | {{velocity}} | ||
![]() |
3.2 | 4 | #set($discard = $services.localization.use('document', 'assets.global.translations')) |
![]() |
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'})) | ||
![]() |
3.165 | 8 | #set($subjectTitle = $doc.getFullName().split('\.')[0]) |
![]() |
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). |
![]() |
3.154 | 10 | ## Specify a class name below to override this. |
![]() |
3.148 | 11 | #set($theClass = "") |
![]() |
3.143 | 12 | #set($docObjects = $doc.getxWikiObjects()) |
![]() |
3.133 | 13 | #foreach($docObjectKey in $docObjects.keySet()) |
![]() |
3.154 | 14 | #if($docObjectKey.indexOf($subjectTitle) == 0) ## |
![]() |
3.150 | 15 | #if($theClass == "") |
16 | #set($theClass = $docObjectKey) | ||
17 | #end | ||
![]() |
3.134 | 18 | #end |
![]() |
3.133 | 19 | #end |
![]() |
3.154 | 20 | #set($theDocObj = $doc.getObject($theClass, true)) |
![]() |
3.149 | 21 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('doc_owner').value == $context.getUser() || $hasAdmin)) |
![]() |
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()) | ||
26 | #if($theDocObj.getProperty("$item")) | ||
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. | ||
31 | ## 'disabled': 1 --> Will not show up in the form at all. | ||
32 | ## 'extraAttributes': {"disabled": "disabled"} --> Will show up in the form as a disabled input. | ||
33 | #set($classProperties = { | ||
34 | 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}}, | ||
![]() |
3.180 | 35 | 'pmAddress': {'type': 'address', 'parent': 'editAddress', '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", "help-block" : 'Input street and number, then select the address of your practice.'}}, |
![]() |
3.178 | 36 | 'practiceName': {'type': 'text', 'disabled': 0, 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}}, |
![]() |
3.166 | 37 | 'pmStreet': {'type': 'text', 'disabled': 1}, |
38 | 'pmHousenumber': {'type': 'text', 'disabled': 1}, | ||
39 | 'pmPostcode': {'type': 'text', 'disabled': 1}, | ||
40 | 'pmCity': {'type': 'text', 'disabled': 1}, | ||
41 | 'pmCounty': {'type': 'text', 'disabled': 1}, | ||
42 | 'pmState': {'type': 'text', 'disabled': 1}, | ||
43 | 'pmCountry': {'type': 'text', 'disabled': 1}, | ||
44 | 'nrOfHomeopaths': {'type': 'number'}, | ||
45 | 'certification': {'type': 'checkbox', 'opener': 1}, | ||
46 | 'certificationFrom': {'type': 'text', 'parent': 'certification'} | ||
47 | }) | ||
![]() |
3.154 | 48 | $doc.getTranslatedDocument().getContent() |
![]() |
1.4 | 49 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 50 | #if(!$isGuest) |
![]() |
1.4 | 51 | <script> |
![]() |
3.61 | 52 | var pmMenuCreate = "disable"; |
![]() |
1.4 | 53 | </script> |
![]() |
1.7 | 54 | #end |
55 | #if($hasRight) | ||
![]() |
1.1 | 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="fa fa-pencil"></span> | ||
![]() |
3.9 | 59 | <span class="btn-label">Edit content</span> |
![]() |
1.1 | 60 | </a> |
61 | </p> | ||
![]() |
1.7 | 62 | #end |
![]() |
1.1 | 63 | <div class="clearfix"></div> |
64 | #if($xcontext.action == "view") | ||
![]() |
3.50 | 65 | <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2> |
![]() |
3.126 | 66 | <div id="${subjectTitle}" class="sheet_properties inline-data-summary"> |
![]() |
3.94 | 67 | #createAddress($theClass 1) |
![]() |
3.99 | 68 | #set($properties = ['nrOfHomeopaths','certification','certificationFrom']) |
![]() |
3.58 | 69 | #foreach($property in $properties) |
![]() |
3.10 | 70 | #if($theDocObj.getProperty($property)) |
![]() |
2.1 | 71 | <p class="property"> |
![]() |
3.177 | 72 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}.label")</span> <span class="property-value">$doc.display($property)</span> |
![]() |
3.10 | 73 | </p> |
74 | #end | ||
![]() |
2.1 | 75 | #end |
![]() |
1.90 | 76 | #if($hasRight) |
77 | <p class="buttons text-align-right"> | ||
78 | <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow"> | ||
79 | <span class="btn-label">Edit details</span> | ||
80 | </a> | ||
81 | </p> | ||
82 | #end | ||
83 | </div> | ||
![]() |
3.1 | 84 | #if($hasRight) |
![]() |
1.90 | 85 | #set($form_start = { |
86 | "id": "homeopaths_form", | ||
87 | "product": "homeopath details", | ||
88 | "method": "post", | ||
89 | "url": "", | ||
90 | "use_captcha": "false" | ||
91 | }) | ||
![]() |
1.109 | 92 | #set($submit = { |
93 | "id" : "edit_details", | ||
94 | "button-text" : "Save changes", | ||
95 | "clean": "true", | ||
96 | "help-block" : "" | ||
97 | }) | ||
98 | #set($form_end = { | ||
99 | "use_captcha": "false" | ||
100 | }) | ||
101 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
102 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
103 | <div class="modal-content"> | ||
104 | #createFormStart($form_start) | ||
105 | <div class="modal-header"> | ||
106 | <h3 class="modal-title">Details</h3> | ||
107 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
108 | <span aria-hidden="true">×</span> | ||
109 | </button> | ||
110 | </div> | ||
111 | <div class="modal-body"> | ||
![]() |
3.88 | 112 | #createAddress($theClass 1) |
![]() |
3.78 | 113 | #set($lastChild = "") |
114 | #foreach($propertyName in $classProperties.keySet()) | ||
![]() |
3.110 | 115 | #set($value = "") |
![]() |
3.78 | 116 | #set($item = $classProperties["$propertyName"]) |
![]() |
3.179 | 117 | #if(!$item.containsKey("disabled") || $item["disabled"] == 0) |
![]() |
3.102 | 118 | #set($checkBool = ["false","true"]) |
![]() |
3.174 | 119 | #if(!$item.extraAttributes) |
120 | #set($item.extraAttributes = {}) | ||
121 | #end | ||
![]() |
3.170 | 122 | #set($translatedProperties = {}) |
![]() |
3.112 | 123 | #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) |
![]() |
3.175 | 124 | #if($theDocObj.getProperty($propertyName).value) |
125 | #set($value = $theDocObj.getProperty($propertyName).value) | ||
126 | #end | ||
![]() |
3.166 | 127 | #if($item.type == "checkbox" || $item.type == "radio") |
![]() |
3.102 | 128 | #set($item.extraAttributes["data-checked"] = "$checkBool[$value]") |
![]() |
3.100 | 129 | #end |
![]() |
3.102 | 130 | #else |
![]() |
3.103 | 131 | #if($item.type == "checkbox") |
132 | #set($value = "1") | ||
![]() |
3.104 | 133 | #if(!$item.extraAttributes.containsKey("data-checked")) |
![]() |
3.102 | 134 | #set($item.extraAttributes["data-checked"] = "$checkBool[0]") |
![]() |
3.103 | 135 | #end |
![]() |
3.78 | 136 | #end |
![]() |
3.71 | 137 | #end |
![]() |
3.166 | 138 | #if($item.type != "checkbox" && $item.type != "radio" && !$item.containsKey("disabled")) |
139 | #set($translatedProperties = { | ||
140 | 'aria_label': 'data-aria-label', | ||
![]() |
3.173 | 141 | 'placeholder': 'placeholder' |
![]() |
3.166 | 142 | }) |
143 | #end | ||
144 | #set($translatedProperties['label'] = 'label') | ||
![]() |
3.176 | 145 | #foreach($key in $translatedProperties.keySet()) |
146 | #set($item.extraAttributes["$translatedProperties[$key]"] = $services.localization.render("homeopaths.classproperty.${propertyName}.${key}")) | ||
![]() |
3.166 | 147 | #end |
![]() |
3.78 | 148 | #if($item.containsKey("classless")) |
149 | #set($newElem = { | ||
150 | "id" : "$propertyName", | ||
![]() |
3.100 | 151 | "type" : $item.type, |
![]() |
3.78 | 152 | "required" : "false", |
153 | "label" : "$label", | ||
154 | "value" : "$value" | ||
155 | }) | ||
156 | #else | ||
157 | #set($newElem = { | ||
158 | "id" : "$propertyName", | ||
![]() |
3.100 | 159 | "type" : $item.type, |
![]() |
3.78 | 160 | "required" : "false", |
161 | "label" : "$label", | ||
162 | "data-create-xobj" : "true", | ||
163 | "data-xobj-classname" : $theClass, | ||
164 | "data-xobj-fieldname" : "$propertyName", | ||
165 | "value" : "$value" | ||
166 | }) | ||
167 | #end | ||
![]() |
3.102 | 168 | #if($item.extraAttributes.keySet().size() > 0) |
169 | #foreach($attr in $item.extraAttributes.keySet()) | ||
170 | #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr])) | ||
![]() |
3.78 | 171 | #end |
172 | #end | ||
![]() |
3.102 | 173 | #if($item.opener) |
![]() |
3.78 | 174 | #set($discard = $newElem.put("data-opener", "true")) |
175 | #end | ||
![]() |
3.102 | 176 | #if($item.parent) |
![]() |
3.78 | 177 | #set($lastChild = "$key") |
178 | #elseif($lastChild != "") | ||
179 | #set($lastChild = "") | ||
180 | #createExpandEnd() | ||
181 | #end | ||
182 | #createFormElement($newElem) | ||
![]() |
3.102 | 183 | #if($item.opener) |
![]() |
3.78 | 184 | #createExpandStart($newElem $value) |
185 | #end | ||
![]() |
3.61 | 186 | #end |
187 | #end | ||
![]() |
1.1 | 188 | </div> |
189 | <div class="modal-footer"> | ||
190 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
![]() |
3.78 | 191 | #createSubmit($submit) |
![]() |
1.1 | 192 | </div> |
193 | #createFormEnd($form_end) | ||
194 | </div> | ||
195 | </div> | ||
196 | </div> | ||
197 | #end | ||
![]() |
3.150 | 198 | #elseif($xcontext.action == 'edit' && $request.get('editor') == 'inline') |
![]() |
3.60 | 199 | <p> |
![]() |
3.150 | 200 | This page can not be edited in inline mode. [[Back>>$doc.fullName]] |
![]() |
3.60 | 201 | </p> |
![]() |
1.1 | 202 | #end |
![]() |
3.88 | 203 | #macro(createAddress $className $withLabel) |
![]() |
3.55 | 204 | #set($docObj = $doc.getObject($className)) |
![]() |
3.52 | 205 | #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry']) |
206 | #set($x = {}) | ||
207 | #foreach($datapart in $addressArray) | ||
![]() |
3.55 | 208 | #if($docObj.getProperty($datapart)) |
209 | #set($datapart4Publish = $docObj.getProperty($datapart).value) | ||
![]() |
3.52 | 210 | #if($datapart == 'pmCountry') |
211 | #set($datapart4Publish = $datapart4Publish.toUpperCase()) | ||
212 | #end | ||
213 | #set($discard = $x.put("$datapart", $datapart4Publish)) | ||
214 | #end | ||
215 | #end | ||
![]() |
3.91 | 216 | <div class="formElement"> |
![]() |
3.89 | 217 | #if($withLabel) |
![]() |
3.177 | 218 | <label>$services.localization.render("homeopaths.classproperty.pmAddress.label")</label> |
![]() |
3.89 | 219 | #end |
![]() |
3.88 | 220 | <address> |
221 | $doc.getTitle()<br /> | ||
222 | $x['pmStreet'] $x['pmHousenumber']<br /> | ||
223 | $x['pmPostcode'] $x['pmCity']<br /> | ||
224 | $x['pmCounty'] $x['pmState']<br /> | ||
225 | $x['pmCountry'] | ||
226 | </address> | ||
![]() |
3.91 | 227 | </div> |
![]() |
3.52 | 228 | #end |
![]() |
3.91 | 229 | |
![]() |
1.1 | 230 | {{/html}} |
231 | {{/velocity}} |