Code source wiki de homeopathsSheet

Version 3.147 par Jip-jan Alunkel le mars 11, 14:27

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