Wiki-Quellcode von homeopathsSheet

Version 3.105 von Jip-jan Alunkel am März 10, 21:13

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($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, 'extraAttributes': {"data-checked": "false"}},
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', '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.'}},
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 'nrOfHomeopaths': {'type': 'number'},
55 'certification': {'type': 'checkbox', 'opener': 1},
56 'certificationFrom': {'type': 'text', 'parent': 'certification'}
57 })
58 #createAddress($theClass 1)
59 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
60 #foreach($property in $properties)
61 #if($theDocObj.getProperty($property))
62 <p class="property">
63 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
64 </p>
65 #end
66 #end
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>
75 #if($hasRight)
76 #set($form_start = {
77 "id": "homeopaths_form",
78 "product": "homeopath details",
79 "method": "post",
80 "url": "",
81 "use_captcha": "false"
82 })
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">
103 #createAddress($theClass 1)
104 #set($lastChild = "")
105 #foreach($propertyName in $classProperties.keySet())
106 #set($item = $classProperties["$propertyName"])
107 #if(!$item.containsKey("disabled"))
108 #set($checkBool = ["false","true"])
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 $value
112 #if($item.type == "checkbox")
113 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]")
114 #end
115 #else
116 #if($item.type == "checkbox")
117 #set($value = "1")
118 #if(!$item.extraAttributes.containsKey("data-checked"))
119 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
120 #end
121 #end
122 #end
123 #if(!$value)
124 #set($value = "")
125 #end
126 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
127 #if($item.containsKey("classless"))
128 #set($newElem = {
129 "id" : "$propertyName",
130 "type" : $item.type,
131 "required" : "false",
132 "label" : "$label",
133 "value" : "$value"
134 })
135 #else
136 #set($newElem = {
137 "id" : "$propertyName",
138 "type" : $item.type,
139 "required" : "false",
140 "label" : "$label",
141 "data-create-xobj" : "true",
142 "data-xobj-classname" : $theClass,
143 "data-xobj-fieldname" : "$propertyName",
144 "value" : "$value"
145 })
146 #end
147 #if($item.extraAttributes.keySet().size() > 0)
148 #foreach($attr in $item.extraAttributes.keySet())
149 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
150 #end
151 #end
152 #if($item.opener)
153 #set($discard = $newElem.put("data-opener", "true"))
154 #end
155 #if($item.parent)
156 #set($lastChild = "$key")
157 #elseif($lastChild != "")
158 #set($lastChild = "")
159 #createExpandEnd()
160 #end
161 #createFormElement($newElem)
162 #if($item.opener)
163 #createExpandStart($newElem $value)
164 #end
165 #end
166 #end
167 </div>
168 <div class="modal-footer">
169 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
170 #createSubmit($submit)
171 </div>
172 #createFormEnd($form_end)
173 </div>
174 </div>
175 </div>
176 #end
177 #else
178 <p>
179 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
180 </p>
181 #end
182 #macro(createAddress $className $withLabel)
183 #set($docObj = $doc.getObject($className))
184 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
185 #set($x = {})
186 #foreach($datapart in $addressArray)
187 #if($docObj.getProperty($datapart))
188 #set($datapart4Publish = $docObj.getProperty($datapart).value)
189 #if($datapart == 'pmCountry')
190 #set($datapart4Publish = $datapart4Publish.toUpperCase())
191 #end
192 #set($discard = $x.put("$datapart", $datapart4Publish))
193 #end
194 #end
195 <div class="formElement">
196 #if($withLabel)
197 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
198 #end
199 <address>
200 $doc.getTitle()<br />
201 $x['pmStreet'] $x['pmHousenumber']<br />
202 $x['pmPostcode'] $x['pmCity']<br />
203 $x['pmCounty'] $x['pmState']<br />
204 $x['pmCountry']
205 </address>
206 </div>
207 #end
208
209 {{/html}}
210 {{/velocity}}