Wiki source code of homeopathsSheet

Version 3.103 by Jip-jan Alunkel on March 10, 21:09

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