Wiki source code of homeopathsSheet
Version 3.76 by Jip-jan Alunkel on March 09, 17:26
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'})) | ||
![]() |
1.5 | 8 | #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument()) |
![]() |
1.1 | 9 | #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') |
![]() |
3.2 | 10 | #set($theClass = "homeopaths.Code.homeopathsClass") |
![]() |
1.5 | 11 | ## Create object (important for sheet binding, do not remove) |
![]() |
3.2 | 12 | #set($theDocObj = $doc.getObject($theClass, true)) |
![]() |
1.7 | 13 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) |
![]() |
1.5 | 14 | $theDoc.getContent() |
![]() |
1.4 | 15 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 16 | #if(!$isGuest) |
![]() |
1.4 | 17 | <script> |
![]() |
3.61 | 18 | var pmMenuCreate = "disable"; |
![]() |
1.4 | 19 | </script> |
![]() |
1.7 | 20 | #end |
21 | #if($hasRight) | ||
![]() |
1.1 | 22 | <p class="buttons text-align-right"> |
23 | <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow"> | ||
24 | <span class="fa fa-pencil"></span> | ||
![]() |
3.9 | 25 | <span class="btn-label">Edit content</span> |
![]() |
1.1 | 26 | </a> |
27 | </p> | ||
![]() |
1.7 | 28 | #end |
![]() |
1.1 | 29 | #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent) |
30 | #set($spaceTitle = $spaceReference.getName()) | ||
31 | <div class="clearfix"></div> | ||
32 | #if($xcontext.action == "view") | ||
![]() |
3.50 | 33 | <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2> |
![]() |
3.51 | 34 | <div id="${spaceTitle}" class="sheet_properties inline-data-summary"> |
![]() |
3.61 | 35 | #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''}) |
![]() |
3.34 | 36 | #foreach($item in $xa.keySet()) |
37 | #if($theDocObj.getProperty("$item")) | ||
![]() |
3.36 | 38 | #set($xa["$item"] = $theDocObj.getProperty("$item").value) |
![]() |
3.34 | 39 | #end |
40 | #end | ||
![]() |
3.2 | 41 | ## The classProperties Map has to be in the order of how you want the form elements to appear in the form. |
![]() |
3.10 | 42 | #set($classProperties = { |
![]() |
3.48 | 43 | 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'checked': 0}, |
![]() |
3.49 | 44 | 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "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.10 | 45 | 'practiceName': {'type': 'text', '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.20 | 46 | 'pmStreet': {'type': 'text', 'disabled': 1}, |
47 | 'pmHousenumber': {'type': 'text', 'disabled': 1}, | ||
48 | 'pmPostcode': {'type': 'text', 'disabled': 1}, | ||
49 | 'pmCity': {'type': 'text', 'disabled': 1}, | ||
50 | 'pmCounty': {'type': 'text', 'disabled': 1}, | ||
51 | 'pmState': {'type': 'text', 'disabled': 1}, | ||
52 | 'pmCountry': {'type': 'text', 'disabled': 1}, | ||
![]() |
3.61 | 53 | 'certification': {'type': 'checkbox', 'opener': 1}, |
![]() |
3.10 | 54 | 'certificationFrom': {'type': 'text', 'parent': 'certification'} |
55 | }) | ||
![]() |
3.56 | 56 | #createAddress($theClass) |
![]() |
3.58 | 57 | #set($properties = ['certification','certificationFrom']) |
58 | #foreach($property in $properties) | ||
![]() |
3.10 | 59 | #if($theDocObj.getProperty($property)) |
![]() |
2.1 | 60 | <p class="property"> |
61 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> | ||
![]() |
3.10 | 62 | </p> |
63 | #end | ||
![]() |
2.1 | 64 | #end |
![]() |
1.90 | 65 | #if($hasRight) |
66 | <p class="buttons text-align-right"> | ||
67 | <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow"> | ||
68 | <span class="btn-label">Edit details</span> | ||
69 | </a> | ||
70 | </p> | ||
71 | #end | ||
72 | </div> | ||
![]() |
3.1 | 73 | #if($hasRight) |
![]() |
1.90 | 74 | #set($form_start = { |
75 | "id": "homeopaths_form", | ||
76 | "product": "homeopath details", | ||
77 | "method": "post", | ||
78 | "url": "", | ||
79 | "use_captcha": "false" | ||
80 | }) | ||
![]() |
1.109 | 81 | #set($submit = { |
82 | "id" : "edit_details", | ||
83 | "button-text" : "Save changes", | ||
84 | "clean": "true", | ||
85 | "help-block" : "" | ||
86 | }) | ||
87 | #set($form_end = { | ||
88 | "use_captcha": "false" | ||
89 | }) | ||
90 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
91 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
92 | <div class="modal-content"> | ||
93 | #createFormStart($form_start) | ||
94 | <div class="modal-header"> | ||
95 | <h3 class="modal-title">Details</h3> | ||
96 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
97 | <span aria-hidden="true">×</span> | ||
98 | </button> | ||
99 | </div> | ||
100 | <div class="modal-body"> | ||
![]() |
3.10 | 101 | <fieldset class="fieldset"> |
![]() |
3.55 | 102 | #createAddress($theClass) |
![]() |
3.10 | 103 | </fieldset> |
![]() |
3.2 | 104 | #set($lastChild = "") |
105 | #foreach($propertyName in $classProperties.keySet()) | ||
106 | #set($item = $classProperties["$propertyName"]) | ||
![]() |
3.68 | 107 | #set($propertyType = $item.type) |
![]() |
3.10 | 108 | #if($item.containsKey("disabled")) |
109 | #else | ||
![]() |
3.61 | 110 | #if($propertyType == "checkbox") |
![]() |
3.70 | 111 | #set($value = "1") |
![]() |
3.61 | 112 | #if($item.containsKey("classless")) |
![]() |
3.71 | 113 | #if(!$item.containsKey("checked")) |
114 | #set($item["checked"] = '0') | ||
115 | #end | ||
![]() |
3.61 | 116 | #else |
![]() |
3.72 | 117 | #set($checkboxPropVal = $theDocObj.getProperty($propertyName).value) |
![]() |
3.76 | 118 | #set($item["checked"] = "${checkboxPropVal}") |
![]() |
3.61 | 119 | #end |
120 | #end | ||
![]() |
3.71 | 121 | #if($theDocObj.getProperty($propertyName) || $propertyType == "address") ## 'address' is not a property in the current class |
122 | #if($propertyType != "checkbox") | ||
123 | #set($value = $theDocObj.getProperty($propertyName).value) | ||
124 | #end | ||
125 | #end | ||
![]() |
3.31 | 126 | #set($propertyChecked = $item.checked) |
![]() |
3.10 | 127 | #set($propertyOpener = $item.opener) |
128 | #set($propertyParent = $item.parent) | ||
129 | #set($extraAttributes = $item.extraAttributes) | ||
130 | #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}")) | ||
![]() |
3.21 | 131 | #if(!$value) |
132 | #set($value = "") | ||
133 | #end | ||
![]() |
3.73 | 134 | $propertyChecked |
![]() |
3.25 | 135 | #if($item.containsKey("classless")) |
136 | #set($newElem = { | ||
137 | "id" : "$propertyName", | ||
138 | "type" : $propertyType, | ||
139 | "required" : "false", | ||
140 | "label" : "$label", | ||
141 | "value" : "$value" | ||
142 | }) | ||
143 | #else | ||
144 | #set($newElem = { | ||
145 | "id" : "$propertyName", | ||
146 | "type" : $propertyType, | ||
147 | "required" : "false", | ||
148 | "label" : "$label", | ||
149 | "data-create-xobj" : "true", | ||
150 | "data-xobj-classname" : $theClass, | ||
151 | "data-xobj-fieldname" : "$propertyName", | ||
152 | "value" : "$value" | ||
153 | }) | ||
154 | #end | ||
![]() |
3.21 | 155 | #if($extraAttributes.keySet().size() > 0) |
156 | #set($attrMap = $extraAttributes) | ||
157 | #foreach($attr in $attrMap.keySet()) | ||
158 | #set($discard = $newElem.put("$attr", $attrMap[$attr])) | ||
![]() |
3.2 | 159 | #end |
160 | #end | ||
![]() |
3.46 | 161 | #if($propertyChecked == '1') |
![]() |
3.47 | 162 | #set($discard = $newElem.put("data-checked", "true")) |
![]() |
3.46 | 163 | #else |
![]() |
3.32 | 164 | #set($discard = $newElem.put("data-checked", "false")) |
![]() |
3.31 | 165 | #end |
![]() |
3.21 | 166 | #if($propertyOpener) |
167 | #set($discard = $newElem.put("data-opener", "true")) | ||
168 | #end | ||
169 | #if($propertyParent) | ||
170 | #set($lastChild = "$key") | ||
171 | #elseif($lastChild != "") | ||
172 | #set($lastChild = "") | ||
173 | #createExpandEnd() | ||
174 | #end | ||
175 | #createFormElement($newElem) | ||
176 | #if($propertyOpener) | ||
177 | #createExpandStart($newElem $value) | ||
178 | #end | ||
![]() |
3.2 | 179 | #end |
180 | #end | ||
![]() |
1.1 | 181 | </div> |
182 | <div class="modal-footer"> | ||
183 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
184 | #createSubmit($submit) | ||
185 | </div> | ||
186 | #createFormEnd($form_end) | ||
187 | </div> | ||
188 | </div> | ||
189 | </div> | ||
190 | #end | ||
![]() |
1.7 | 191 | #else |
![]() |
3.60 | 192 | <p> |
193 | This page can not be viewed in inline mode. | ||
194 | </p> | ||
![]() |
1.1 | 195 | #end |
![]() |
3.2 | 196 | |
![]() |
3.55 | 197 | #macro(createAddress $className) |
198 | #set($docObj = $doc.getObject($className)) | ||
![]() |
3.52 | 199 | <address> |
200 | $doc.getTitle()<br /> | ||
201 | #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry']) | ||
202 | #set($x = {}) | ||
203 | #foreach($datapart in $addressArray) | ||
![]() |
3.55 | 204 | #if($docObj.getProperty($datapart)) |
205 | #set($datapart4Publish = $docObj.getProperty($datapart).value) | ||
![]() |
3.52 | 206 | #if($datapart == 'pmCountry') |
207 | #set($datapart4Publish = $datapart4Publish.toUpperCase()) | ||
208 | #end | ||
209 | #set($discard = $x.put("$datapart", $datapart4Publish)) | ||
210 | #end | ||
211 | #end | ||
212 | $x['pmStreet'] $x['pmHousenumber']<br /> | ||
213 | $x['pmPostcode'] $x['pmCity']<br /> | ||
214 | $x['pmCounty'] $x['pmState']<br /> | ||
215 | $x['pmCountry'] | ||
216 | </address> | ||
217 | #end | ||
![]() |
1.1 | 218 | {{/html}} |
219 | {{/velocity}} |