Codice sorgente Wiki di homeopathsSheet

Version 3.53 by Jip-jan Alunkel on marzo 09, 14:22

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