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