Wiki source code of homeopathsSheet

Version 3.98 by Jip-jan Alunkel on March 09, 20:37

Hide last authors
Jip-jan Alunkel 1.1 1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
Jip-jan Alunkel 3.2 4 #set($discard = $services.localization.use('document', 'assets.global.translations'))
Jip-jan Alunkel 1.1 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'}))
Jip-jan Alunkel 1.5 8 #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument())
Jip-jan Alunkel 1.1 9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
Jip-jan Alunkel 3.2 10 #set($theClass = "homeopaths.Code.homeopathsClass")
Jip-jan Alunkel 1.5 11 ## Create object (important for sheet binding, do not remove)
Jip-jan Alunkel 3.2 12 #set($theDocObj = $doc.getObject($theClass, true))
Jip-jan Alunkel 1.7 13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
Jip-jan Alunkel 1.5 14 $theDoc.getContent()
Jip-jan Alunkel 1.4 15 {{html wiki="true" clean="false"}}
Jip-jan Alunkel 1.7 16 #if(!$isGuest)
Jip-jan Alunkel 1.4 17 <script>
Jip-jan Alunkel 3.61 18 var pmMenuCreate = "disable";
Jip-jan Alunkel 1.4 19 </script>
Jip-jan Alunkel 1.7 20 #end
21 #if($hasRight)
Jip-jan Alunkel 1.1 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>
Jip-jan Alunkel 3.9 25 <span class="btn-label">Edit content</span>
Jip-jan Alunkel 1.1 26 </a>
27 </p>
Jip-jan Alunkel 1.7 28 #end
Jip-jan Alunkel 1.1 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")
Jip-jan Alunkel 3.50 33 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
Jip-jan Alunkel 3.51 34 <div id="${spaceTitle}" class="sheet_properties inline-data-summary">
Jip-jan Alunkel 3.78 35 ## ADDRESS: Prepare object to provide hidden values to the address input
Jip-jan Alunkel 3.61 36 #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''})
Jip-jan Alunkel 3.34 37 #foreach($item in $xa.keySet())
38 #if($theDocObj.getProperty("$item"))
Jip-jan Alunkel 3.36 39 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
Jip-jan Alunkel 3.34 40 #end
41 #end
Jip-jan Alunkel 3.2 42 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
Jip-jan Alunkel 3.10 43 #set($classProperties = {
Jip-jan Alunkel 3.96 44 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'checked': 0},
Jip-jan Alunkel 3.49 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.'}},
Jip-jan Alunkel 3.97 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.'}},
Jip-jan Alunkel 3.20 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},
Jip-jan Alunkel 3.98 54 'nrOfHomeopaths': {'type': 'number'},
Jip-jan Alunkel 3.61 55 'certification': {'type': 'checkbox', 'opener': 1},
Jip-jan Alunkel 3.10 56 'certificationFrom': {'type': 'text', 'parent': 'certification'}
57 })
Jip-jan Alunkel 3.94 58 #createAddress($theClass 1)
Jip-jan Alunkel 3.58 59 #set($properties = ['certification','certificationFrom'])
60 #foreach($property in $properties)
Jip-jan Alunkel 3.10 61 #if($theDocObj.getProperty($property))
Jip-jan Alunkel 2.1 62 <p class="property">
63 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
Jip-jan Alunkel 3.10 64 </p>
65 #end
Jip-jan Alunkel 2.1 66 #end
Jip-jan Alunkel 1.90 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>
Jip-jan Alunkel 3.1 75 #if($hasRight)
Jip-jan Alunkel 1.90 76 #set($form_start = {
77 "id": "homeopaths_form",
78 "product": "homeopath details",
79 "method": "post",
80 "url": "",
81 "use_captcha": "false"
82 })
Jip-jan Alunkel 1.109 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">
Jip-jan Alunkel 3.88 103 #createAddress($theClass 1)
Jip-jan Alunkel 3.78 104 #set($lastChild = "")
105 #foreach($propertyName in $classProperties.keySet())
106 #set($item = $classProperties["$propertyName"])
107 #set($propertyType = $item.type)
108 #if($item.containsKey("disabled"))
109 #else
110 #if($propertyType == "checkbox")
111 #set($value = "1")
112 #if($item.containsKey("classless"))
113 #if(!$item.containsKey("checked"))
114 #set($item["checked"] = '0')
115 #end
116 #else
117 #set($checkboxPropVal = $theDocObj.getProperty($propertyName).value)
118 #set($item["checked"] = "$checkboxPropVal")
119 #end
Jip-jan Alunkel 3.71 120 #end
Jip-jan Alunkel 3.78 121 #if($theDocObj.getProperty($propertyName) || $propertyType == "address") ## 'address' is not a property in the current class
122 #if($propertyType != "checkbox")
123 #set($value = $theDocObj.getProperty($propertyName).value)
124 #end
125 #end
126 #set($propertyChecked = $item.checked)
127 #set($propertyOpener = $item.opener)
128 #set($propertyParent = $item.parent)
129 #set($extraAttributes = $item.extraAttributes)
130 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
131 #if(!$value)
132 #set($value = "")
133 #end
134 #if($item.containsKey("classless"))
135 #set($newElem = {
136 "id" : "$propertyName",
137 "type" : $propertyType,
138 "required" : "false",
139 "label" : "$label",
140 "value" : "$value"
141 })
142 #else
143 #set($newElem = {
144 "id" : "$propertyName",
145 "type" : $propertyType,
146 "required" : "false",
147 "label" : "$label",
148 "data-create-xobj" : "true",
149 "data-xobj-classname" : $theClass,
150 "data-xobj-fieldname" : "$propertyName",
151 "value" : "$value"
152 })
153 #end
154 #if($extraAttributes.keySet().size() > 0)
155 #set($attrMap = $extraAttributes)
156 #foreach($attr in $attrMap.keySet())
157 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
158 #end
159 #end
160 #if($propertyChecked == '1')
161 #set($discard = $newElem.put("data-checked", "true"))
162 #else
163 #set($discard = $newElem.put("data-checked", "false"))
164 #end
165 #if($propertyOpener)
166 #set($discard = $newElem.put("data-opener", "true"))
167 #end
168 #if($propertyParent)
169 #set($lastChild = "$key")
170 #elseif($lastChild != "")
171 #set($lastChild = "")
172 #createExpandEnd()
173 #end
174 #createFormElement($newElem)
175 #if($propertyOpener)
176 #createExpandStart($newElem $value)
177 #end
Jip-jan Alunkel 3.61 178 #end
179 #end
Jip-jan Alunkel 1.1 180 </div>
181 <div class="modal-footer">
182 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
Jip-jan Alunkel 3.78 183 #createSubmit($submit)
Jip-jan Alunkel 1.1 184 </div>
185 #createFormEnd($form_end)
186 </div>
187 </div>
188 </div>
189 #end
Jip-jan Alunkel 1.7 190 #else
Jip-jan Alunkel 3.60 191 <p>
Jip-jan Alunkel 3.81 192 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
Jip-jan Alunkel 3.60 193 </p>
Jip-jan Alunkel 1.1 194 #end
Jip-jan Alunkel 3.88 195 #macro(createAddress $className $withLabel)
Jip-jan Alunkel 3.55 196 #set($docObj = $doc.getObject($className))
Jip-jan Alunkel 3.52 197 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
198 #set($x = {})
199 #foreach($datapart in $addressArray)
Jip-jan Alunkel 3.55 200 #if($docObj.getProperty($datapart))
201 #set($datapart4Publish = $docObj.getProperty($datapart).value)
Jip-jan Alunkel 3.52 202 #if($datapart == 'pmCountry')
203 #set($datapart4Publish = $datapart4Publish.toUpperCase())
204 #end
205 #set($discard = $x.put("$datapart", $datapart4Publish))
206 #end
207 #end
Jip-jan Alunkel 3.91 208 <div class="formElement">
Jip-jan Alunkel 3.89 209 #if($withLabel)
210 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
211 #end
Jip-jan Alunkel 3.88 212 <address>
213 $doc.getTitle()<br />
214 $x['pmStreet'] $x['pmHousenumber']<br />
215 $x['pmPostcode'] $x['pmCity']<br />
216 $x['pmCounty'] $x['pmState']<br />
217 $x['pmCountry']
218 </address>
Jip-jan Alunkel 3.91 219 </div>
Jip-jan Alunkel 3.52 220 #end
Jip-jan Alunkel 3.91 221
Jip-jan Alunkel 1.1 222 {{/html}}
223 {{/velocity}}