Wiki source code of homeopathsSheet

Version 3.54 by Jip-jan Alunkel on março 09, 14:26

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 pagemakerOffspring = "disable";
19 </script>
20 #end
21
22
23 $theDoc
24 $doc
25 #if($hasRight)
26 <p class="buttons text-align-right">
27 <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow">
28 <span class="fa fa-pencil"></span>
29 <span class="btn-label">Edit content</span>
30 </a>
31 </p>
32 #end
33 #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent)
34 #set($spaceTitle = $spaceReference.getName())
35 <div class="clearfix"></div>
36 #if($xcontext.action == "view")
37 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
38 <div id="${spaceTitle}" class="sheet_properties inline-data-summary">
39 #set($xa = {
40 'pmLatlong': '',
41 'pmCountry': '',
42 'pmState': '',
43 'pmCounty': '',
44 'pmPostcode': '',
45 'pmCity': '',
46 'pmStreet': '',
47 'pmHousenumber': ''
48 })
49 #foreach($item in $xa.keySet())
50 #if($theDocObj.getProperty("$item"))
51 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
52 #end
53 #end
54 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
55 #set($certify = $theDocObj.getProperty("certification").value) ## Dit kan beter ergens anders gebeuren
56 #set($cert=$numbertool.toNumber($certify).intValue())
57 #set($classProperties = {
58 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'checked': 0},
59 '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.'}},
60 'practiceName': {'type': 'text', '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.'}},
61 'pmStreet': {'type': 'text', 'disabled': 1},
62 'pmHousenumber': {'type': 'text', 'disabled': 1},
63 'pmPostcode': {'type': 'text', 'disabled': 1},
64 'pmCity': {'type': 'text', 'disabled': 1},
65 'pmCounty': {'type': 'text', 'disabled': 1},
66 'pmState': {'type': 'text', 'disabled': 1},
67 'pmCountry': {'type': 'text', 'disabled': 1},
68 'certification': {'type': 'checkbox', 'opener': 1, 'checked': $cert},
69 'certificationFrom': {'type': 'text', 'parent': 'certification'}
70 })
71 #foreach($property in $classProperties.keySet())
72 #if($theDocObj.getProperty($property))
73 <p class="property">
74 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
75 #if($property == "pmStreet")
76 <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span>
77 #elseif($property == "practiceName") ## Difference, should receive the title from the page.
78 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.getTitle()</span>
79 #else ## Normal situation.
80 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
81 #end
82 </p>
83 #end
84 #end
85 #end
86 #if($hasRight)
87 <p class="buttons text-align-right">
88 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
89 <span class="btn-label">Edit details</span>
90 </a>
91 </p>
92 #end
93 </div>
94 #if($hasRight)
95 #set($form_start = {
96 "id": "homeopaths_form",
97 "product": "homeopath details",
98 "method": "post",
99 "url": "",
100 "use_captcha": "false"
101 })
102 #set($submit = {
103 "id" : "edit_details",
104 "button-text" : "Save changes",
105 "clean": "true",
106 "help-block" : ""
107 })
108 #set($form_end = {
109 "use_captcha": "false"
110 })
111 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
112 <div class="modal-dialog modal-dialog-centered" role="document">
113 <div class="modal-content">
114 #createFormStart($form_start)
115 <div class="modal-header">
116 <h3 class="modal-title">Details</h3>
117 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
118 <span aria-hidden="true">&times;</span>
119 </button>
120 </div>
121 <div class="modal-body">
122 <fieldset class="fieldset">
123 #createAddress()
124 </fieldset>
125 #set($lastChild = "")
126 #foreach($propertyName in $classProperties.keySet())
127 #set($item = $classProperties["$propertyName"])
128 #if($item.containsKey("disabled"))
129 #else
130 #set($propertyType = $item.type)
131 #set($propertyChecked = $item.checked)
132 #set($propertyOpener = $item.opener)
133 #set($propertyParent = $item.parent)
134 #set($extraAttributes = $item.extraAttributes)
135 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
136 #if($propertyType == "checkbox" || $propertyType == "radio")
137 #set($value = "1")
138 #elseif($theDocObj.getProperty($propertyName) || $propertyType == "address") ## 'address' is not a property in the current class
139 #set($value = $theDocObj.getProperty($propertyName).value)
140 #end
141 #if(!$value)
142 #set($value = "")
143 #end
144 #if($item.containsKey("classless"))
145 #set($newElem = {
146 "id" : "$propertyName",
147 "type" : $propertyType,
148 "required" : "false",
149 "label" : "$label",
150 "value" : "$value"
151 })
152 #else
153 #set($newElem = {
154 "id" : "$propertyName",
155 "type" : $propertyType,
156 "required" : "false",
157 "label" : "$label",
158 "data-create-xobj" : "true",
159 "data-xobj-classname" : $theClass,
160 "data-xobj-fieldname" : "$propertyName",
161 "value" : "$value"
162 })
163 #end
164 #if($extraAttributes.keySet().size() > 0)
165 #set($attrMap = $extraAttributes)
166 #foreach($attr in $attrMap.keySet())
167 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
168 #end
169 #end
170 #if($propertyChecked == '1')
171 #set($discard = $newElem.put("data-checked", "true"))
172 #else
173 #set($discard = $newElem.put("data-checked", "false"))
174 #end
175 #if($propertyOpener)
176 #set($discard = $newElem.put("data-opener", "true"))
177 #end
178 #if($propertyParent)
179 #set($lastChild = "$key")
180 #elseif($lastChild != "")
181 #set($lastChild = "")
182 #createExpandEnd()
183 #end
184 #createFormElement($newElem)
185 #if($propertyOpener)
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 #else
201 This page can not be viewed in inline mode.
202 #end
203
204 #macro(createAddress)
205 <address>
206 $doc.getTitle()<br />
207 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
208 #set($x = {})
209 #foreach($datapart in $addressArray)
210 #if($theDocObj.getProperty($datapart))
211 #set($datapart4Publish = $theDocObj.getProperty($datapart).value)
212 #if($datapart == 'pmCountry')
213 #set($datapart4Publish = $datapart4Publish.toUpperCase())
214 #end
215 #set($discard = $x.put("$datapart", $datapart4Publish))
216 #end
217 #end
218 $x['pmStreet'] $x['pmHousenumber']<br />
219 $x['pmPostcode'] $x['pmCity']<br />
220 $x['pmCounty'] $x['pmState']<br />
221 $x['pmCountry']
222 </address>
223 #end
224 {{/html}}
225 {{/velocity}}