Wiki source code of homeopathsSheet

Version 3.101 by Jip-jan Alunkel on março 10, 20:30

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($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument())
9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
10 #set($theClass = "homeopaths.Code.homeopathsClass")
11 ## Create object (important for sheet binding, do not remove)
12 #set($theDocObj = $doc.getObject($theClass, true))
13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
14 $theDoc.getContent()
15 {{html wiki="true" clean="false"}}
16 #if(!$isGuest)
17 <script>
18 var pmMenuCreate = "disable";
19 </script>
20 #end
21 #if($hasRight)
22 <p class="buttons text-align-right">
23 <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow">
24 <span class="fa fa-pencil"></span>
25 <span class="btn-label">Edit content</span>
26 </a>
27 </p>
28 #end
29 #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent)
30 #set($spaceTitle = $spaceReference.getName())
31 <div class="clearfix"></div>
32 #if($xcontext.action == "view")
33 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
34 <div id="${spaceTitle}" class="sheet_properties inline-data-summary">
35 ## ADDRESS: Prepare object to provide hidden values to the address input
36 #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''})
37 #foreach($item in $xa.keySet())
38 #if($theDocObj.getProperty("$item"))
39 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
40 #end
41 #end
42 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
43 #set($classProperties = {
44 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}},
45 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "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", "help-block" : 'Input street and number, then select the address of your practice.'}},
46 'practiceName': {'type': 'text', 'disabled': 1, 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}},
47 'pmStreet': {'type': 'text', 'disabled': 1},
48 'pmHousenumber': {'type': 'text', 'disabled': 1},
49 'pmPostcode': {'type': 'text', 'disabled': 1},
50 'pmCity': {'type': 'text', 'disabled': 1},
51 'pmCounty': {'type': 'text', 'disabled': 1},
52 'pmState': {'type': 'text', 'disabled': 1},
53 'pmCountry': {'type': 'text', 'disabled': 1},
54 'nrOfHomeopaths': {'type': 'number'},
55 'certification': {'type': 'checkbox', 'opener': 1},
56 'certificationFrom': {'type': 'text', 'parent': 'certification'}
57 })
58 #createAddress($theClass 1)
59 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
60 #foreach($property in $properties)
61 #if($theDocObj.getProperty($property))
62 <p class="property">
63 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
64 </p>
65 #end
66 #end
67 #if($hasRight)
68 <p class="buttons text-align-right">
69 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
70 <span class="btn-label">Edit details</span>
71 </a>
72 </p>
73 #end
74 </div>
75 #if($hasRight)
76 #set($form_start = {
77 "id": "homeopaths_form",
78 "product": "homeopath details",
79 "method": "post",
80 "url": "",
81 "use_captcha": "false"
82 })
83 #set($submit = {
84 "id" : "edit_details",
85 "button-text" : "Save changes",
86 "clean": "true",
87 "help-block" : ""
88 })
89 #set($form_end = {
90 "use_captcha": "false"
91 })
92 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
93 <div class="modal-dialog modal-dialog-centered" role="document">
94 <div class="modal-content">
95 #createFormStart($form_start)
96 <div class="modal-header">
97 <h3 class="modal-title">Details</h3>
98 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
99 <span aria-hidden="true">&times;</span>
100 </button>
101 </div>
102 <div class="modal-body">
103 #createAddress($theClass 1)
104 #set($lastChild = "")
105 #foreach($propertyName in $classProperties.keySet())
106 #set($item = $classProperties["$propertyName"])
107 #if(!$item.containsKey("disabled"))
108 #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) ## 'address' is not a property in the current class
109 #set($value = $theDocObj.getProperty($propertyName).value)
110 #if($item.type == "checkbox")
111 #set($checkBool = ["false","true"])
112 $checkBool[$value]
113 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]")
114 #else
115
116 #end
117 #end
118 #if($item.type == "checkbox")
119 #set($value = "1")
120 #if($item.containsKey("classless"))
121 #if(!$item.containsKey("checked"))
122 #set($item["checked"] = '0')
123 #end
124 #else
125 #set($checkboxPropVal = $theDocObj.getProperty($propertyName).value)
126 #set($item["checked"] = "$checkboxPropVal")
127 #end
128 #end
129 #set($propertyChecked = $item.checked)
130 #set($propertyOpener = $item.opener)
131 #set($propertyParent = $item.parent)
132 #set($extraAttributes = $item.extraAttributes)
133 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
134 #if(!$value)
135 #set($value = "")
136 #end
137 #if($item.containsKey("classless"))
138 #set($newElem = {
139 "id" : "$propertyName",
140 "type" : $item.type,
141 "required" : "false",
142 "label" : "$label",
143 "value" : "$value"
144 })
145 #else
146 #set($newElem = {
147 "id" : "$propertyName",
148 "type" : $item.type,
149 "required" : "false",
150 "label" : "$label",
151 "data-create-xobj" : "true",
152 "data-xobj-classname" : $theClass,
153 "data-xobj-fieldname" : "$propertyName",
154 "value" : "$value"
155 })
156 #end
157 #if($extraAttributes.keySet().size() > 0)
158 #foreach($attr in $extraAttributes.keySet())
159 #set($discard = $newElem.put("$attr", $extraAttributes[$attr]))
160 #end
161 #end
162 #if($propertyChecked == '1')
163 #set($discard = $newElem.put("data-checked", "true"))
164 #else
165 #set($discard = $newElem.put("data-checked", "false"))
166 #end
167 #if($propertyOpener)
168 #set($discard = $newElem.put("data-opener", "true"))
169 #end
170 #if($propertyParent)
171 #set($lastChild = "$key")
172 #elseif($lastChild != "")
173 #set($lastChild = "")
174 #createExpandEnd()
175 #end
176 #createFormElement($newElem)
177 #if($propertyOpener)
178 #createExpandStart($newElem $value)
179 #end
180 #end
181 #end
182 </div>
183 <div class="modal-footer">
184 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
185 #createSubmit($submit)
186 </div>
187 #createFormEnd($form_end)
188 </div>
189 </div>
190 </div>
191 #end
192 #else
193 <p>
194 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
195 </p>
196 #end
197 #macro(createAddress $className $withLabel)
198 #set($docObj = $doc.getObject($className))
199 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
200 #set($x = {})
201 #foreach($datapart in $addressArray)
202 #if($docObj.getProperty($datapart))
203 #set($datapart4Publish = $docObj.getProperty($datapart).value)
204 #if($datapart == 'pmCountry')
205 #set($datapart4Publish = $datapart4Publish.toUpperCase())
206 #end
207 #set($discard = $x.put("$datapart", $datapart4Publish))
208 #end
209 #end
210 <div class="formElement">
211 #if($withLabel)
212 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
213 #end
214 <address>
215 $doc.getTitle()<br />
216 $x['pmStreet'] $x['pmHousenumber']<br />
217 $x['pmPostcode'] $x['pmCity']<br />
218 $x['pmCounty'] $x['pmState']<br />
219 $x['pmCountry']
220 </address>
221 </div>
222 #end
223
224 {{/html}}
225 {{/velocity}}