Wiki source code of homeopathsSheet

Version 3.264 by Jip-jan Alunkel on março 16, 01:58

Show last authors
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").value)
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 ## 'opener': 1 --> input functions as an interface control element, it 'opens' an additional block of form inputs. Only for select, input or radio inputs.
32 ## 'classless': 1 --> input is not bound to any XClass or XClass property.
33 ## 'disabled': 1 --> Will not show up in the form at all.
34 ## 'extraAttributes': {"disabled": "disabled"} --> Will show up in the form as a disabled input.
35 #set($classProperties = {
36 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}},
37 '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"}},
38 'practiceName': {'type': 'text', 'disabled': 0, "help-block": 1, 'extraAttributes': {"disabled": "disabled"}},
39 'pmStreet': {'type': 'text', 'disabled': 1},
40 'pmHousenumber': {'type': 'text', 'disabled': 1},
41 'pmPostcode': {'type': 'text', 'disabled': 1},
42 'pmCity': {'type': 'text', 'disabled': 1},
43 'pmCounty': {'type': 'text', 'disabled': 1},
44 'pmState': {'type': 'text', 'disabled': 1},
45 'pmCountry': {'type': 'text', 'disabled': 1},
46 'nrOfHomeopaths': {'type': 'number'},
47 'certification': {'type': 'checkbox', 'opener': 1},
48 'certificationFrom': {'type': 'text', 'parent': 'certification'}
49 })
50 $doc.getTranslatedDocument().getContent()
51
52 {{html wiki="true" clean="false"}}
53 ## Show the content edit button
54 #if($hasRight)
55 <p class="buttons text-align-right">
56 <a class="btn btn-primary" title="Edit" href="$doc.getURL('edit','editor=wysiwyg')" role="button" rel="nofollow">
57 <span class="btn-label">$services.localization.render("global.multiword.edit_content")</span>
58 </a>
59 </p>
60 #end
61 #if(!$isGuest)<p><script>var pmMenuCreate = "disable";</script></p>#end
62 <div class="clearfix"></div>
63
64 ## Show properties from the classProperties Map.
65 #if($xcontext.action == "view")
66 <h2 class="inline-data-summary">$services.localization.render("${subjectTitle}.inlineDataSummary.sheet_properties")</h2>
67 <div id="${subjectTitle}" class="sheet_properties inline-data-summary">
68 ## Show the address
69 #createAddress($theClass 1)
70 ## Set the XClass properties which you would like to be displayed.
71 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
72 ## Show the above chosen properties
73 #foreach($property in $properties)
74 #set($hide = 0)
75 ## All form elements that are hidden in the form should also be hidden in the page.
76 #if($classProperties["$property"].containsKey('parent'))
77 #set($parentKey = $classProperties["$property"].parent)
78 #if((($classProperties["$parentKey"].type == "checkbox" || $classProperties["$parentKey"].type == "radio") && $theDocObj.getProperty($parentKey).value == 0) || !$theDocObj.getProperty($parentKey).value)
79 #set($hide = 1)
80 #end
81 #end
82 #if($hide == 0)
83 <p class="property">
84 ## Show value only if there is a value to show, otherwise set to 'unknown'.
85 <span class="property-name">$services.localization.render("${subjectTitle}.classproperty.${property}.label")</span>#if($theDocObj.getProperty($property).value && $theDocObj.getProperty($property).value != "") <span class="property-value">$doc.display($property)</span>#else <span class="property-value ghost">$services.localization.render("global.word.unknown")</span>#end
86 </p>
87 #end
88 #end
89 #if($hasRight)
90 <p class="buttons text-align-right">
91 <a class="btn btn-secondary" title="$services.localization.render("edit")" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
92 <span class="btn-label">$services.localization.render("global.multiword.edit_content")</span>
93 </a>
94 </p>
95 #end
96 </div>
97
98 ## Show the properties edit form in a modal.
99 #if($hasRight)
100 #set($form_start = {
101 "id": "homeopaths_form",
102 "product": "homeopath details",
103 "method": "post",
104 "url": "",
105 "use_captcha": "false"
106 })
107 #set($submit = {
108 "id" : "edit_details",
109 "button-text" : "Save changes",
110 "clean": "true",
111 "help-block" : ""
112 })
113 #set($form_end = {
114 "use_captcha": "false"
115 })
116 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
117 <div class="modal-dialog modal-dialog-centered" role="document">
118 <div class="modal-content">
119 #createFormStart($form_start)
120 <div class="modal-header">
121 <h3 class="modal-title">$services.localization.render("global.word.details")</h3>
122 <button type="button" class="close" data-dismiss="modal" aria-label="$services.localization.render("close")">
123 <span aria-hidden="true">&times;</span>
124 </button>
125 </div>
126 <div class="modal-body">
127 #createAddress($theClass 1)
128 #set($lastChild = "")
129 #foreach($propertyName in $classProperties.keySet())
130 #set($value = "")
131 #set($item = $classProperties["$propertyName"])
132 #if(!$item.containsKey("disabled") || $item["disabled"] == 0)
133 #if(!$item.extraAttributes)
134 #set($item.extraAttributes = {})
135 #end
136 #set($translatedProperties = {})
137 #set($checkBool = ["false","true"])
138 #set($hasClassObj = !$item.containsKey("classless") && $theDocObj.getProperty($propertyName))
139 #if($item.type == "checkbox" || $item.type == "radio")
140 #if($hasClassObj)
141 #set($item.extraAttributes["data-checked"] = "$checkBool[$theDocObj.getProperty($propertyName).value]")
142 #else
143 #if(!$item.extraAttributes.containsKey("data-checked"))
144 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
145 #end
146 #end
147 #set($value = "1")
148 #else
149 #if($hasClassObj)
150 #if($theDocObj.getProperty($propertyName).value)
151 #set($value = $theDocObj.getProperty($propertyName).value)
152 #end
153 #end
154 #end
155 #if($item.type != "checkbox" && $item.type != "radio" && (!$item.containsKey("disabled") || $item["disabled"] == 0))
156 #set($translatedProperties = {
157 'aria_label': 'data-aria-label',
158 'placeholder': 'placeholder'
159 })
160 #end
161 #set($translatedProperties['label'] = 'label')
162 #if($item['help-block'] == 1)
163 #set($translatedProperties['help_block'] = 'help-block')
164 #end
165 #foreach($key in $translatedProperties.keySet())
166 #set($item.extraAttributes["$translatedProperties[$key]"] = $services.localization.render("homeopaths.classproperty.${propertyName}.${key}"))
167 #end
168 #if($item.containsKey("classless"))
169 #set($newElem = {
170 "id" : "$propertyName",
171 "type" : $item.type,
172 "required" : "false",
173 "label" : "$label",
174 "value" : "$value"
175 })
176 #else
177 #set($newElem = {
178 "id" : "$propertyName",
179 "type" : $item.type,
180 "required" : "false",
181 "label" : "$label",
182 "data-create-xobj" : "true",
183 "data-xobj-classname" : $theClass,
184 "data-xobj-fieldname" : "$propertyName",
185 "value" : "$value"
186 })
187 #end
188 #if($item.extraAttributes.keySet().size() > 0)
189 #foreach($attr in $item.extraAttributes.keySet())
190 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
191 #end
192 #end
193 #if($item.opener)
194 #set($discard = $newElem.put("data-opener", "true"))
195 #end
196 #if($item.parent)
197 #set($lastChild = "$key")
198 #elseif($lastChild != "")
199 #set($lastChild = "")
200 #createExpandEnd()
201 #end
202 #createFormElement($newElem)
203 #if($item.opener)
204 #createExpandStart($newElem $value)
205 #end
206 #end
207 #end
208 </div>
209 <div class="modal-footer">
210 <button type="button" class="btn btn-secondary" title="$services.localization.render("close")" data-dismiss="modal">$services.localization.render("close")</button>
211 #createSubmit($submit)
212 </div>
213 #createFormEnd($form_end)
214 </div>
215 </div>
216 </div>
217 #end
218 #elseif($xcontext.action == 'edit' && ($request.get('editor') == 'inline' || $request.get('section')))
219 <p>$services.localization.render("global.line.inline_noedit")</p>
220 <ul>
221 <li>[[$services.localization.render("global.line.edit_in_full")>>path:$doc.getURL('edit','editor=wysiwyg')]]</li>
222 <li>[[$services.localization.render("back")>>$doc.fullName]]</li>
223 </ul>
224 #end
225 #macro(createAddress $className $withLabel)
226 #set($docObj = $doc.getObject($className))
227 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
228 #set($x = {})
229 #foreach($datapart in $addressArray)
230 #if($docObj.getProperty($datapart))
231 #set($datapart4Publish = $docObj.getProperty($datapart).value)
232 #if($datapart == 'pmCountry')
233 #set($datapart4Publish = $datapart4Publish.toUpperCase())
234 #end
235 #set($discard = $x.put("$datapart", $datapart4Publish))
236 #end
237 #end
238 <div class="formElement">
239 #if($withLabel)
240 <label>$services.localization.render("homeopaths.classproperty.pmAddress.label")</label>
241 #end
242 <address>
243 $doc.getTitle()<br />
244 $x['pmStreet'] $x['pmHousenumber']<br />
245 $x['pmPostcode'] $x['pmCity']<br />
246 $x['pmCounty'] $x['pmState']<br />
247 $x['pmCountry']
248 </address>
249 </div>
250 #end
251 {{/html}}
252 {{/velocity}}