Wiki source code of homeopathsSheet
Version 3.142 by Jip-jan Alunkel on March 11, 14:23
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()) |
![]() |
3.126 | 9 | #set($subjectReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent.parent) |
10 | #set($subjectTitle = $subjectReference.getName()) | ||
![]() |
3.141 | 11 | #set($docObjects = $doc.getXObjects()) |
![]() |
3.133 | 12 | #foreach($docObjectKey in $docObjects.keySet()) |
![]() |
3.134 | 13 | #if($docObjectKey.indexOf($subjectTitle) == 0) |
14 | #set($theDocObj = $docObjects[$docObjectKey]) | ||
15 | #end | ||
![]() |
3.133 | 16 | #end |
![]() |
3.142 | 17 | $theDocObj |
![]() |
3.140 | 18 | $theDocObj.getProperty('doc_owner').value |
![]() |
1.1 | 19 | #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') |
![]() |
3.2 | 20 | #set($theClass = "homeopaths.Code.homeopathsClass") |
![]() |
1.5 | 21 | ## Create object (important for sheet binding, do not remove) |
![]() |
3.134 | 22 | ##set($theDocObj = $doc.getObject($theClass, true)) |
![]() |
1.7 | 23 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) |
![]() |
1.5 | 24 | $theDoc.getContent() |
![]() |
1.4 | 25 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 26 | #if(!$isGuest) |
![]() |
1.4 | 27 | <script> |
![]() |
3.61 | 28 | var pmMenuCreate = "disable"; |
![]() |
1.4 | 29 | </script> |
![]() |
1.7 | 30 | #end |
31 | #if($hasRight) | ||
![]() |
1.1 | 32 | <p class="buttons text-align-right"> |
33 | <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow"> | ||
34 | <span class="fa fa-pencil"></span> | ||
![]() |
3.9 | 35 | <span class="btn-label">Edit content</span> |
![]() |
1.1 | 36 | </a> |
37 | </p> | ||
![]() |
1.7 | 38 | #end |
![]() |
1.1 | 39 | <div class="clearfix"></div> |
40 | #if($xcontext.action == "view") | ||
![]() |
3.50 | 41 | <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2> |
![]() |
3.126 | 42 | <div id="${subjectTitle}" class="sheet_properties inline-data-summary"> |
![]() |
3.78 | 43 | ## ADDRESS: Prepare object to provide hidden values to the address input |
![]() |
3.61 | 44 | #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''}) |
![]() |
3.34 | 45 | #foreach($item in $xa.keySet()) |
46 | #if($theDocObj.getProperty("$item")) | ||
![]() |
3.36 | 47 | #set($xa["$item"] = $theDocObj.getProperty("$item").value) |
![]() |
3.34 | 48 | #end |
49 | #end | ||
![]() |
3.2 | 50 | ## The classProperties Map has to be in the order of how you want the form elements to appear in the form. |
![]() |
3.113 | 51 | ## disabled = Will not show up as input/select/textarea in the form. |
![]() |
3.10 | 52 | #set($classProperties = { |
![]() |
3.101 | 53 | 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}}, |
![]() |
3.49 | 54 | '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.114 | 55 | 'practiceName': {'type': 'text', 'disabled': 1, '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 | 56 | 'pmStreet': {'type': 'text', 'disabled': 1}, |
57 | 'pmHousenumber': {'type': 'text', 'disabled': 1}, | ||
58 | 'pmPostcode': {'type': 'text', 'disabled': 1}, | ||
59 | 'pmCity': {'type': 'text', 'disabled': 1}, | ||
60 | 'pmCounty': {'type': 'text', 'disabled': 1}, | ||
61 | 'pmState': {'type': 'text', 'disabled': 1}, | ||
62 | 'pmCountry': {'type': 'text', 'disabled': 1}, | ||
![]() |
3.98 | 63 | 'nrOfHomeopaths': {'type': 'number'}, |
![]() |
3.61 | 64 | 'certification': {'type': 'checkbox', 'opener': 1}, |
![]() |
3.10 | 65 | 'certificationFrom': {'type': 'text', 'parent': 'certification'} |
66 | }) | ||
![]() |
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"> |
72 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</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.100 | 117 | #if(!$item.containsKey("disabled")) |
![]() |
3.102 | 118 | #set($checkBool = ["false","true"]) |
![]() |
3.112 | 119 | #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) |
![]() |
3.100 | 120 | #set($value = $theDocObj.getProperty($propertyName).value) |
121 | #if($item.type == "checkbox") | ||
![]() |
3.102 | 122 | #set($item.extraAttributes["data-checked"] = "$checkBool[$value]") |
![]() |
3.100 | 123 | #end |
![]() |
3.102 | 124 | #else |
![]() |
3.103 | 125 | #if($item.type == "checkbox") |
126 | #set($value = "1") | ||
![]() |
3.104 | 127 | #if(!$item.extraAttributes.containsKey("data-checked")) |
![]() |
3.102 | 128 | #set($item.extraAttributes["data-checked"] = "$checkBool[0]") |
![]() |
3.103 | 129 | #end |
![]() |
3.78 | 130 | #end |
![]() |
3.71 | 131 | #end |
![]() |
3.102 | 132 | #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}")) |
![]() |
3.78 | 133 | #if($item.containsKey("classless")) |
134 | #set($newElem = { | ||
135 | "id" : "$propertyName", | ||
![]() |
3.100 | 136 | "type" : $item.type, |
![]() |
3.78 | 137 | "required" : "false", |
138 | "label" : "$label", | ||
139 | "value" : "$value" | ||
140 | }) | ||
141 | #else | ||
142 | #set($newElem = { | ||
143 | "id" : "$propertyName", | ||
![]() |
3.100 | 144 | "type" : $item.type, |
![]() |
3.78 | 145 | "required" : "false", |
146 | "label" : "$label", | ||
147 | "data-create-xobj" : "true", | ||
148 | "data-xobj-classname" : $theClass, | ||
149 | "data-xobj-fieldname" : "$propertyName", | ||
150 | "value" : "$value" | ||
151 | }) | ||
152 | #end | ||
![]() |
3.102 | 153 | #if($item.extraAttributes.keySet().size() > 0) |
154 | #foreach($attr in $item.extraAttributes.keySet()) | ||
155 | #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr])) | ||
![]() |
3.78 | 156 | #end |
157 | #end | ||
![]() |
3.102 | 158 | #if($item.opener) |
![]() |
3.78 | 159 | #set($discard = $newElem.put("data-opener", "true")) |
160 | #end | ||
![]() |
3.102 | 161 | #if($item.parent) |
![]() |
3.78 | 162 | #set($lastChild = "$key") |
163 | #elseif($lastChild != "") | ||
164 | #set($lastChild = "") | ||
165 | #createExpandEnd() | ||
166 | #end | ||
167 | #createFormElement($newElem) | ||
![]() |
3.102 | 168 | #if($item.opener) |
![]() |
3.78 | 169 | #createExpandStart($newElem $value) |
170 | #end | ||
![]() |
3.61 | 171 | #end |
172 | #end | ||
![]() |
1.1 | 173 | </div> |
174 | <div class="modal-footer"> | ||
175 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
![]() |
3.78 | 176 | #createSubmit($submit) |
![]() |
1.1 | 177 | </div> |
178 | #createFormEnd($form_end) | ||
179 | </div> | ||
180 | </div> | ||
181 | </div> | ||
182 | #end | ||
![]() |
1.7 | 183 | #else |
![]() |
3.60 | 184 | <p> |
![]() |
3.81 | 185 | This page can not be viewed in inline mode. [[Back>>$doc.fullName]] |
![]() |
3.60 | 186 | </p> |
![]() |
1.1 | 187 | #end |
![]() |
3.88 | 188 | #macro(createAddress $className $withLabel) |
![]() |
3.55 | 189 | #set($docObj = $doc.getObject($className)) |
![]() |
3.52 | 190 | #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry']) |
191 | #set($x = {}) | ||
192 | #foreach($datapart in $addressArray) | ||
![]() |
3.55 | 193 | #if($docObj.getProperty($datapart)) |
194 | #set($datapart4Publish = $docObj.getProperty($datapart).value) | ||
![]() |
3.52 | 195 | #if($datapart == 'pmCountry') |
196 | #set($datapart4Publish = $datapart4Publish.toUpperCase()) | ||
197 | #end | ||
198 | #set($discard = $x.put("$datapart", $datapart4Publish)) | ||
199 | #end | ||
200 | #end | ||
![]() |
3.91 | 201 | <div class="formElement"> |
![]() |
3.89 | 202 | #if($withLabel) |
203 | <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label> | ||
204 | #end | ||
![]() |
3.88 | 205 | <address> |
206 | $doc.getTitle()<br /> | ||
207 | $x['pmStreet'] $x['pmHousenumber']<br /> | ||
208 | $x['pmPostcode'] $x['pmCity']<br /> | ||
209 | $x['pmCounty'] $x['pmState']<br /> | ||
210 | $x['pmCountry'] | ||
211 | </address> | ||
![]() |
3.91 | 212 | </div> |
![]() |
3.52 | 213 | #end |
![]() |
3.91 | 214 | |
![]() |
1.1 | 215 | {{/html}} |
216 | {{/velocity}} |