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