Codice sorgente Wiki di homeopathsSheet

Version 3.188 by Jip-jan Alunkel on marzo 11, 18:20

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