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