Wiki source code of homeopathsSheet
Version 3.243 by Jip-jan Alunkel on março 14, 17:08
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.239 | 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.186 | 35 | '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"}}, |
![]() |
3.184 | 36 | 'practiceName': {'type': 'text', 'disabled': 0, "help-block": 1, 'extraAttributes': {"disabled": "disabled"}}, |
![]() |
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.231 | 48 | $doc.getTranslatedDocument().getContent() |
![]() |
3.234 | 49 | |
![]() |
3.240 | 50 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 51 | #if($hasRight) |
![]() |
1.1 | 52 | <p class="buttons text-align-right"> |
![]() |
3.233 | 53 | <a class="btn btn-primary" title="Edit" href="$doc.getURL('edit','editor=wysiwyg')" role="button" rel="nofollow"> |
![]() |
3.9 | 54 | <span class="btn-label">Edit content</span> |
![]() |
1.1 | 55 | </a> |
56 | </p> | ||
![]() |
1.7 | 57 | #end |
![]() |
3.237 | 58 | #if(!$isGuest)<p><script>var pmMenuCreate = "disable";</script></p>#end |
![]() |
1.1 | 59 | <div class="clearfix"></div> |
60 | #if($xcontext.action == "view") | ||
![]() |
3.50 | 61 | <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2> |
![]() |
3.126 | 62 | <div id="${subjectTitle}" class="sheet_properties inline-data-summary"> |
![]() |
3.94 | 63 | #createAddress($theClass 1) |
![]() |
3.99 | 64 | #set($properties = ['nrOfHomeopaths','certification','certificationFrom']) |
![]() |
3.58 | 65 | #foreach($property in $properties) |
![]() |
3.10 | 66 | #if($theDocObj.getProperty($property)) |
![]() |
2.1 | 67 | <p class="property"> |
![]() |
3.241 | 68 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> |
![]() |
3.10 | 69 | </p> |
70 | #end | ||
![]() |
2.1 | 71 | #end |
![]() |
1.90 | 72 | #if($hasRight) |
73 | <p class="buttons text-align-right"> | ||
74 | <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow"> | ||
75 | <span class="btn-label">Edit details</span> | ||
76 | </a> | ||
77 | </p> | ||
78 | #end | ||
79 | </div> | ||
![]() |
3.1 | 80 | #if($hasRight) |
![]() |
1.90 | 81 | #set($form_start = { |
82 | "id": "homeopaths_form", | ||
83 | "product": "homeopath details", | ||
84 | "method": "post", | ||
85 | "url": "", | ||
86 | "use_captcha": "false" | ||
87 | }) | ||
![]() |
1.109 | 88 | #set($submit = { |
89 | "id" : "edit_details", | ||
90 | "button-text" : "Save changes", | ||
91 | "clean": "true", | ||
92 | "help-block" : "" | ||
93 | }) | ||
94 | #set($form_end = { | ||
95 | "use_captcha": "false" | ||
96 | }) | ||
97 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
98 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
99 | <div class="modal-content"> | ||
100 | #createFormStart($form_start) | ||
101 | <div class="modal-header"> | ||
102 | <h3 class="modal-title">Details</h3> | ||
103 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
104 | <span aria-hidden="true">×</span> | ||
105 | </button> | ||
106 | </div> | ||
107 | <div class="modal-body"> | ||
![]() |
3.88 | 108 | #createAddress($theClass 1) |
![]() |
3.78 | 109 | #set($lastChild = "") |
110 | #foreach($propertyName in $classProperties.keySet()) | ||
![]() |
3.110 | 111 | #set($value = "") |
![]() |
3.78 | 112 | #set($item = $classProperties["$propertyName"]) |
![]() |
3.179 | 113 | #if(!$item.containsKey("disabled") || $item["disabled"] == 0) |
![]() |
3.174 | 114 | #if(!$item.extraAttributes) |
115 | #set($item.extraAttributes = {}) | ||
116 | #end | ||
![]() |
3.170 | 117 | #set($translatedProperties = {}) |
![]() |
3.187 | 118 | #set($checkBool = ["false","true"]) |
![]() |
3.202 | 119 | #set($hasClassObj = !$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) |
![]() |
3.188 | 120 | #if($item.type == "checkbox" || $item.type == "radio") |
![]() |
3.192 | 121 | #if($hasClassObj) |
![]() |
3.189 | 122 | #set($item.extraAttributes["data-checked"] = "$checkBool[$theDocObj.getProperty($propertyName).value]") |
![]() |
3.188 | 123 | #else |
124 | #if(!$item.extraAttributes.containsKey("data-checked")) | ||
125 | #set($item.extraAttributes["data-checked"] = "$checkBool[0]") | ||
126 | #end | ||
127 | #end | ||
![]() |
3.189 | 128 | #set($value = "1") |
![]() |
3.188 | 129 | #else |
![]() |
3.192 | 130 | #if($hasClassObj) |
![]() |
3.188 | 131 | #if($theDocObj.getProperty($propertyName).value) |
132 | #set($value = $theDocObj.getProperty($propertyName).value) | ||
133 | #end | ||
134 | #end | ||
135 | #end | ||
![]() |
3.199 | 136 | #if($item.type != "checkbox" && $item.type != "radio" && (!$item.containsKey("disabled") || $item["disabled"] == 0)) |
![]() |
3.166 | 137 | #set($translatedProperties = { |
138 | 'aria_label': 'data-aria-label', | ||
![]() |
3.173 | 139 | 'placeholder': 'placeholder' |
![]() |
3.166 | 140 | }) |
141 | #end | ||
142 | #set($translatedProperties['label'] = 'label') | ||
![]() |
3.184 | 143 | #if($item['help-block'] == 1) |
![]() |
3.183 | 144 | #set($translatedProperties['help_block'] = 'help-block') |
145 | #end | ||
![]() |
3.176 | 146 | #foreach($key in $translatedProperties.keySet()) |
147 | #set($item.extraAttributes["$translatedProperties[$key]"] = $services.localization.render("homeopaths.classproperty.${propertyName}.${key}")) | ||
![]() |
3.166 | 148 | #end |
![]() |
3.78 | 149 | #if($item.containsKey("classless")) |
150 | #set($newElem = { | ||
151 | "id" : "$propertyName", | ||
![]() |
3.100 | 152 | "type" : $item.type, |
![]() |
3.78 | 153 | "required" : "false", |
154 | "label" : "$label", | ||
155 | "value" : "$value" | ||
156 | }) | ||
157 | #else | ||
158 | #set($newElem = { | ||
159 | "id" : "$propertyName", | ||
![]() |
3.100 | 160 | "type" : $item.type, |
![]() |
3.78 | 161 | "required" : "false", |
162 | "label" : "$label", | ||
163 | "data-create-xobj" : "true", | ||
164 | "data-xobj-classname" : $theClass, | ||
165 | "data-xobj-fieldname" : "$propertyName", | ||
166 | "value" : "$value" | ||
167 | }) | ||
168 | #end | ||
![]() |
3.102 | 169 | #if($item.extraAttributes.keySet().size() > 0) |
170 | #foreach($attr in $item.extraAttributes.keySet()) | ||
171 | #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr])) | ||
![]() |
3.78 | 172 | #end |
173 | #end | ||
![]() |
3.102 | 174 | #if($item.opener) |
![]() |
3.78 | 175 | #set($discard = $newElem.put("data-opener", "true")) |
176 | #end | ||
![]() |
3.102 | 177 | #if($item.parent) |
![]() |
3.78 | 178 | #set($lastChild = "$key") |
179 | #elseif($lastChild != "") | ||
180 | #set($lastChild = "") | ||
181 | #createExpandEnd() | ||
182 | #end | ||
183 | #createFormElement($newElem) | ||
![]() |
3.102 | 184 | #if($item.opener) |
![]() |
3.78 | 185 | #createExpandStart($newElem $value) |
186 | #end | ||
![]() |
3.61 | 187 | #end |
188 | #end | ||
![]() |
1.1 | 189 | </div> |
190 | <div class="modal-footer"> | ||
191 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
![]() |
3.78 | 192 | #createSubmit($submit) |
![]() |
1.1 | 193 | </div> |
194 | #createFormEnd($form_end) | ||
195 | </div> | ||
196 | </div> | ||
197 | </div> | ||
198 | #end | ||
![]() |
3.206 | 199 | #elseif($xcontext.action == 'edit' && ($request.get('editor') == 'inline' || $request.get('section'))) |
![]() |
3.229 | 200 | <p>This page can not be edited in inline mode.</p> |
![]() |
3.207 | 201 | <ul> |
![]() |
3.215 | 202 | <li>[[Edit this page in full edit mode>>path:$doc.getURL('edit','editor=wysiwyg')]], or</li> |
![]() |
3.207 | 203 | <li>[[View this page>>$doc.fullName]]</li> |
204 | </ul> | ||
![]() |
1.1 | 205 | #end |
![]() |
3.88 | 206 | #macro(createAddress $className $withLabel) |
![]() |
3.55 | 207 | #set($docObj = $doc.getObject($className)) |
![]() |
3.52 | 208 | #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry']) |
209 | #set($x = {}) | ||
210 | #foreach($datapart in $addressArray) | ||
![]() |
3.55 | 211 | #if($docObj.getProperty($datapart)) |
212 | #set($datapart4Publish = $docObj.getProperty($datapart).value) | ||
![]() |
3.52 | 213 | #if($datapart == 'pmCountry') |
214 | #set($datapart4Publish = $datapart4Publish.toUpperCase()) | ||
215 | #end | ||
216 | #set($discard = $x.put("$datapart", $datapart4Publish)) | ||
217 | #end | ||
218 | #end | ||
![]() |
3.91 | 219 | <div class="formElement"> |
![]() |
3.89 | 220 | #if($withLabel) |
![]() |
3.241 | 221 | <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label> |
![]() |
3.89 | 222 | #end |
![]() |
3.88 | 223 | <address> |
224 | $doc.getTitle()<br /> | ||
225 | $x['pmStreet'] $x['pmHousenumber']<br /> | ||
226 | $x['pmPostcode'] $x['pmCity']<br /> | ||
227 | $x['pmCounty'] $x['pmState']<br /> | ||
228 | $x['pmCountry'] | ||
229 | </address> | ||
![]() |
3.91 | 230 | </div> |
![]() |
3.52 | 231 | #end |
![]() |
1.1 | 232 | {{/html}} |
233 | {{/velocity}} |