Wiki source code of homeopathsSheet

Version 3.153 by Jip-jan Alunkel on March 11, 14:55

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