Wiki-Quellcode von homeopathsSheet

Version 3.133 von Jip-jan Alunkel am März 11, 14:11

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