Wiki broncode van homeopathsSheet

Version 3.16 by Jip-jan Alunkel on maart 09, 00:46

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($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 pagemakerOffspring = "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 <div id="${spaceTitle}" class="box sheet_properties">
34 <h2>Details</h2>
35 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
36 #set($classProperties = {
37 '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.'}},
38 'pmAddress': {'type': 'address', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "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.'}},
39 'pmStreet': {'type': 'text'},
40 'pmHousenumber': {'type': 'text'},
41 'pmPostcode': {'type': 'text'},
42 'pmCity': {'type': 'text'},
43 'pmCounty': {'type': 'text'},
44 'pmState': {'type': 'text'},
45 'pmCountry': {'type': 'text'},
46 'certification': {'type': 'checkbox', 'opener': 1},
47 'certificationFrom': {'type': 'text', 'parent': 'certification'}
48 })
49 #foreach($property in $classProperties.keySet())
50 #if($theDocObj.getProperty($property))
51 <p class="property">
52 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
53 #if($property == "pmStreet")
54 <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span>
55 #elseif($property == "practiceName") ## Difference, should receive the title from the page.
56 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.getTitle()</span>
57 #else ## Normal situation.
58 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
59 #end
60 </p>
61 #end
62 #end
63 #end
64
65 #if($hasRight)
66 <p class="buttons text-align-right">
67 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
68 <span class="btn-label">Edit details</span>
69 </a>
70 </p>
71 #end
72 </div>
73 #if($hasRight)
74 #set($form_start = {
75 "id": "homeopaths_form",
76 "product": "homeopath details",
77 "method": "post",
78 "url": "",
79 "use_captcha": "false"
80 })
81 #set($submit = {
82 "id" : "edit_details",
83 "button-text" : "Save changes",
84 "clean": "true",
85 "help-block" : ""
86 })
87 #set($form_end = {
88 "use_captcha": "false"
89 })
90 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
91 <div class="modal-dialog modal-dialog-centered" role="document">
92 <div class="modal-content">
93 #createFormStart($form_start)
94 <div class="modal-header">
95 <h3 class="modal-title">Details</h3>
96 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
97 <span aria-hidden="true">&times;</span>
98 </button>
99 </div>
100 <div class="modal-body">
101 <fieldset class="fieldset">
102 <address>
103 $doc.getTitle()<br />
104 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
105 #set($x = {})
106 #foreach($datapart in $addressArray)
107 #if($theDocObj.getProperty($datapart))
108 #set($datapart4Publish = $theDocObj.getProperty($datapart).value)
109 #if($datapart == 'pmCountry')
110 #set($datapart4Publish = $datapart4Publish.toUpperCase())
111 #end
112 #set($discard = $x.put("$datapart", $datapart4Publish))
113 #end
114 #end
115 $x['pmStreet'] $x['pmHousenumber']<br />
116 $x['pmPostcode'] $x['pmCity']<br />
117 $x['pmCounty'] $x['pmState']<br />
118 $x['pmCountry']
119 </address>
120 </fieldset>
121 #set($lastChild = "")
122 #foreach($propertyName in $classProperties.keySet())
123 #set($item = $classProperties["$propertyName"])
124 #if($item.containsKey("disabled"))
125 #else
126 #set($propertyType = $item.type)
127 #set($propertyOpener = $item.opener)
128 #set($propertyParent = $item.parent)
129 #set($extraAttributes = $item.extraAttributes)
130 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
131 #if($theDocObj.getProperty($propertyName) || $propertyType == "address")
132 #set($value = $theDocObj.getProperty($propertyName).value)
133 #if($propertyType == "checkbox" || $propertyType == "radio")
134 #set($value = "1")
135 #end
136 #if(!$value)
137 #set($value = "")
138 #end
139 #set($newElem = {
140 "id" : "$propertyName",
141 "type" : $propertyType,
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 #if($extraAttributes.keySet().size() > 0)
150 #set($attrMap = $extraAttributes)
151 #foreach($attr in $attrMap.keySet())
152 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
153 #end
154 #end
155 #if($propertyOpener)
156 #set($discard = $newElem.put("data-opener", "true"))
157 #end
158 #if($propertyParent)
159 #set($lastChild = "$key")
160 #elseif($lastChild != "")
161 #set($lastChild = "")
162 #createExpandEnd()
163 #end
164 #createFormElement($newElem)
165 #if($propertyOpener)
166 #createExpandStart($newElem $value)
167 #end
168 #end
169 #end
170 #end
171 </div>
172 <div class="modal-footer">
173 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
174 #createSubmit($submit)
175 </div>
176 #createFormEnd($form_end)
177 </div>
178 </div>
179 </div>
180 #end
181 #else
182 This page can not be viewed in inline mode.
183 #end
184
185 #macro(createElementObjects $properties)
186 #foreach($item in $properties.keySet())
187 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
188 #if($theDocObj.getProperty($item))
189 #set($value = $theDocObj.getProperty($item).value)
190 #set($newElem = {
191 "id" : "$item",
192 "type" : $classProperties[$item].type,
193 "required" : "false",
194 "label" : "$label",
195 "data-create-xobj" : "true",
196 "data-xobj-classname" : $theClass,
197 "data-xobj-fieldname" : "$item",
198 "value" : "$value"
199 })
200 #if($classProperties[$item].opener == 1)
201 #set($discard = $newElem.put("data-opener", "true"))
202 #end
203 #if($classProperties[$item].extraAttributes)
204 #set($attrMap = $classProperties[$item].extraAttributes)
205 #foreach($attr in $attrMap.keySet())
206 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
207 #end
208 #end
209 #set($thisObj["$item"] = $newElem)
210 #end
211 #end
212 #end
213
214 {{/html}}
215 {{/velocity}}