Codice sorgente Wiki di homeopathsSheet

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

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($subjectReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent.parent)
10 #set($subjectTitle = $subjectReference.getName())
11
12 ##
13 #set($theClass = "")
14 #set($docObjects = $doc.getxWikiObjects())
15 #foreach($docObjectKey in $docObjects.keySet())
16 #if($docObjectKey.indexOf($subjectTitle) == 0)
17 #set($theDocObj = $docObjects[$docObjectKey][0])
18 #set($theClass = $docObjectKey)
19 #end
20 #end
21 $theDocObj.getProperty('doc_owner').value
22 $theClass
23 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
24 ##set($theClass = "homeopaths.Code.homeopathsClass")
25 ## Create object (important for sheet binding, do not remove)
26 ##set($theDocObj = $doc.getObject($theClass, true))
27 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
28 $theDoc.getContent()
29 {{html wiki="true" clean="false"}}
30 #if(!$isGuest)
31 <script>
32 var pmMenuCreate = "disable";
33 </script>
34 #end
35 #if($hasRight)
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>
39 <span class="btn-label">Edit content</span>
40 </a>
41 </p>
42 #end
43 <div class="clearfix"></div>
44 #if($xcontext.action == "view")
45 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
46 <div id="${subjectTitle}" class="sheet_properties inline-data-summary">
47 ## ADDRESS: Prepare object to provide hidden values to the address input
48 #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''})
49 #foreach($item in $xa.keySet())
50 #if($theDocObj.getProperty("$item"))
51 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
52 #end
53 #end
54 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
55 ## disabled = Will not show up as input/select/textarea in the form.
56 #set($classProperties = {
57 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}},
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.'}},
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.'}},
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},
67 'nrOfHomeopaths': {'type': 'number'},
68 'certification': {'type': 'checkbox', 'opener': 1},
69 'certificationFrom': {'type': 'text', 'parent': 'certification'}
70 })
71 #createAddress($theClass 1)
72 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
73 #foreach($property in $properties)
74 #if($theDocObj.getProperty($property))
75 <p class="property">
76 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
77 </p>
78 #end
79 #end
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>
88 #if($hasRight)
89 #set($form_start = {
90 "id": "homeopaths_form",
91 "product": "homeopath details",
92 "method": "post",
93 "url": "",
94 "use_captcha": "false"
95 })
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">
116 #createAddress($theClass 1)
117 #set($lastChild = "")
118 #foreach($propertyName in $classProperties.keySet())
119 #set($value = "")
120 #set($item = $classProperties["$propertyName"])
121 #if(!$item.containsKey("disabled"))
122 #set($checkBool = ["false","true"])
123 #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName))
124 #set($value = $theDocObj.getProperty($propertyName).value)
125 #if($item.type == "checkbox")
126 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]")
127 #end
128 #else
129 #if($item.type == "checkbox")
130 #set($value = "1")
131 #if(!$item.extraAttributes.containsKey("data-checked"))
132 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
133 #end
134 #end
135 #end
136 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
137 #if($item.containsKey("classless"))
138 #set($newElem = {
139 "id" : "$propertyName",
140 "type" : $item.type,
141 "required" : "false",
142 "label" : "$label",
143 "value" : "$value"
144 })
145 #else
146 #set($newElem = {
147 "id" : "$propertyName",
148 "type" : $item.type,
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
157 #if($item.extraAttributes.keySet().size() > 0)
158 #foreach($attr in $item.extraAttributes.keySet())
159 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
160 #end
161 #end
162 #if($item.opener)
163 #set($discard = $newElem.put("data-opener", "true"))
164 #end
165 #if($item.parent)
166 #set($lastChild = "$key")
167 #elseif($lastChild != "")
168 #set($lastChild = "")
169 #createExpandEnd()
170 #end
171 #createFormElement($newElem)
172 #if($item.opener)
173 #createExpandStart($newElem $value)
174 #end
175 #end
176 #end
177 </div>
178 <div class="modal-footer">
179 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
180 #createSubmit($submit)
181 </div>
182 #createFormEnd($form_end)
183 </div>
184 </div>
185 </div>
186 #end
187 #else
188 <p>
189 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
190 </p>
191 #end
192 #macro(createAddress $className $withLabel)
193 #set($docObj = $doc.getObject($className))
194 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
195 #set($x = {})
196 #foreach($datapart in $addressArray)
197 #if($docObj.getProperty($datapart))
198 #set($datapart4Publish = $docObj.getProperty($datapart).value)
199 #if($datapart == 'pmCountry')
200 #set($datapart4Publish = $datapart4Publish.toUpperCase())
201 #end
202 #set($discard = $x.put("$datapart", $datapart4Publish))
203 #end
204 #end
205 <div class="formElement">
206 #if($withLabel)
207 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
208 #end
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>
216 </div>
217 #end
218
219 {{/html}}
220 {{/velocity}}