Wiki-Quellcode von homeopathsSheet

Version 3.249 von Jip-jan Alunkel am März 14, 20:36

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