Wiki source code of homeopathsSheet

Version 3.102 by Jip-jan Alunkel on março 10, 20: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, '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 #set($checkBool = ["false","true"])
109 #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName)) ## 'address' is not a property in the current class
110 #set($value = $theDocObj.getProperty($propertyName).value)
111 #if($item.type == "checkbox")
112 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]")
113 #end
114 #else
115 #set($value = "")
116 #if($item.type == "checkbox" && $item.containsKey("extraAttributes") && !$item.extraAttributes.containsKey("data-checked"))
117 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
118 #end
119 #end
120 #if(!$value)
121 #set($value = "")
122 #end
123 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
124 #if($item.containsKey("classless"))
125 #set($newElem = {
126 "id" : "$propertyName",
127 "type" : $item.type,
128 "required" : "false",
129 "label" : "$label",
130 "value" : "$value"
131 })
132 #else
133 #set($newElem = {
134 "id" : "$propertyName",
135 "type" : $item.type,
136 "required" : "false",
137 "label" : "$label",
138 "data-create-xobj" : "true",
139 "data-xobj-classname" : $theClass,
140 "data-xobj-fieldname" : "$propertyName",
141 "value" : "$value"
142 })
143 #end
144 #if($item.extraAttributes.keySet().size() > 0)
145 #foreach($attr in $item.extraAttributes.keySet())
146 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
147 #end
148 #end
149 #if($item.opener)
150 #set($discard = $newElem.put("data-opener", "true"))
151 #end
152 #if($item.parent)
153 #set($lastChild = "$key")
154 #elseif($lastChild != "")
155 #set($lastChild = "")
156 #createExpandEnd()
157 #end
158 #createFormElement($newElem)
159 #if($item.opener)
160 #createExpandStart($newElem $value)
161 #end
162 #end
163 #end
164 </div>
165 <div class="modal-footer">
166 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
167 #createSubmit($submit)
168 </div>
169 #createFormEnd($form_end)
170 </div>
171 </div>
172 </div>
173 #end
174 #else
175 <p>
176 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
177 </p>
178 #end
179 #macro(createAddress $className $withLabel)
180 #set($docObj = $doc.getObject($className))
181 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
182 #set($x = {})
183 #foreach($datapart in $addressArray)
184 #if($docObj.getProperty($datapart))
185 #set($datapart4Publish = $docObj.getProperty($datapart).value)
186 #if($datapart == 'pmCountry')
187 #set($datapart4Publish = $datapart4Publish.toUpperCase())
188 #end
189 #set($discard = $x.put("$datapart", $datapart4Publish))
190 #end
191 #end
192 <div class="formElement">
193 #if($withLabel)
194 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
195 #end
196 <address>
197 $doc.getTitle()<br />
198 $x['pmStreet'] $x['pmHousenumber']<br />
199 $x['pmPostcode'] $x['pmCity']<br />
200 $x['pmCounty'] $x['pmState']<br />
201 $x['pmCountry']
202 </address>
203 </div>
204 #end
205
206 {{/html}}
207 {{/velocity}}