Wiki source code of homeopathsSheet

Version 3.148 by Jip-jan Alunkel on March 11, 14:29

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