Wiki source code of homeopathsSheet

Version 3.134 by Jip-jan Alunkel on março 11, 14:15

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