Wiki broncode van homeopathsSheet

Version 3.83 by Jip-jan Alunkel on maart 09, 18:54

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, 'checked': 0},
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', '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 'certification': {'type': 'checkbox', 'opener': 1},
55 'certificationFrom': {'type': 'text', 'parent': 'certification'}
56 })
57 #createAddress($theClass)
58 #set($properties = ['certification','certificationFrom'])
59 #foreach($property in $properties)
60 #if($theDocObj.getProperty($property))
61 <p class="property">
62 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
63 </p>
64 #end
65 #end
66 #if($hasRight)
67 <p class="buttons text-align-right">
68 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
69 <span class="btn-label">Edit details</span>
70 </a>
71 </p>
72 #end
73 </div>
74 #if($hasRight)
75 #set($form_start = {
76 "id": "homeopaths_form",
77 "product": "homeopath details",
78 "method": "post",
79 "url": "",
80 "use_captcha": "false"
81 })
82 #set($submit = {
83 "id" : "edit_details",
84 "button-text" : "Save changes",
85 "clean": "true",
86 "help-block" : ""
87 })
88 #set($form_end = {
89 "use_captcha": "false"
90 })
91 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
92 <div class="modal-dialog modal-dialog-centered" role="document">
93 <div class="modal-content">
94 #createFormStart($form_start)
95 <div class="modal-header">
96 <h3 class="modal-title">Details</h3>
97 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
98 <span aria-hidden="true">&times;</span>
99 </button>
100 </div>
101 <div class="modal-body">
102 <p>
103 <label>homeopaths.classproperty.pmAddress</label>
104 <fieldset class="fieldset">
105 #createAddress($theClass)
106 </fieldset>
107 </p>
108 #set($lastChild = "")
109 #foreach($propertyName in $classProperties.keySet())
110 #set($item = $classProperties["$propertyName"])
111 #set($propertyType = $item.type)
112 #if($item.containsKey("disabled"))
113 #else
114 #if($propertyType == "checkbox")
115 #set($value = "1")
116 #if($item.containsKey("classless"))
117 #if(!$item.containsKey("checked"))
118 #set($item["checked"] = '0')
119 #end
120 #else
121 #set($checkboxPropVal = $theDocObj.getProperty($propertyName).value)
122 #set($item["checked"] = "$checkboxPropVal")
123 #end
124 #end
125 #if($theDocObj.getProperty($propertyName) || $propertyType == "address") ## 'address' is not a property in the current class
126 #if($propertyType != "checkbox")
127 #set($value = $theDocObj.getProperty($propertyName).value)
128 #end
129 #end
130 #set($propertyChecked = $item.checked)
131 #set($propertyOpener = $item.opener)
132 #set($propertyParent = $item.parent)
133 #set($extraAttributes = $item.extraAttributes)
134 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
135 #if(!$value)
136 #set($value = "")
137 #end
138 #if($item.containsKey("classless"))
139 #set($newElem = {
140 "id" : "$propertyName",
141 "type" : $propertyType,
142 "required" : "false",
143 "label" : "$label",
144 "value" : "$value"
145 })
146 #else
147 #set($newElem = {
148 "id" : "$propertyName",
149 "type" : $propertyType,
150 "required" : "false",
151 "label" : "$label",
152 "data-create-xobj" : "true",
153 "data-xobj-classname" : $theClass,
154 "data-xobj-fieldname" : "$propertyName",
155 "value" : "$value"
156 })
157 #end
158 #if($extraAttributes.keySet().size() > 0)
159 #set($attrMap = $extraAttributes)
160 #foreach($attr in $attrMap.keySet())
161 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
162 #end
163 #end
164 #if($propertyChecked == '1')
165 #set($discard = $newElem.put("data-checked", "true"))
166 #else
167 #set($discard = $newElem.put("data-checked", "false"))
168 #end
169 #if($propertyOpener)
170 #set($discard = $newElem.put("data-opener", "true"))
171 #end
172 #if($propertyParent)
173 #set($lastChild = "$key")
174 #elseif($lastChild != "")
175 #set($lastChild = "")
176 #createExpandEnd()
177 #end
178 #createFormElement($newElem)
179 #if($propertyOpener)
180 #createExpandStart($newElem $value)
181 #end
182 #end
183 #end
184 </div>
185 <div class="modal-footer">
186 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
187 #createSubmit($submit)
188 </div>
189 #createFormEnd($form_end)
190 </div>
191 </div>
192 </div>
193 #end
194 #else
195 <p>
196 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
197 </p>
198 #end
199
200 #macro(createAddress $className)
201 #set($docObj = $doc.getObject($className))
202 <address>
203 $doc.getTitle()<br />
204 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
205 #set($x = {})
206 #foreach($datapart in $addressArray)
207 #if($docObj.getProperty($datapart))
208 #set($datapart4Publish = $docObj.getProperty($datapart).value)
209 #if($datapart == 'pmCountry')
210 #set($datapart4Publish = $datapart4Publish.toUpperCase())
211 #end
212 #set($discard = $x.put("$datapart", $datapart4Publish))
213 #end
214 #end
215 $x['pmStreet'] $x['pmHousenumber']<br />
216 $x['pmPostcode'] $x['pmCity']<br />
217 $x['pmCounty'] $x['pmState']<br />
218 $x['pmCountry']
219 </address>
220 #end
221 {{/html}}
222 {{/velocity}}