Wiki source code of homeopathsSheet

Version 1.123 by Jip-jan Alunkel on March 08, 18:18

Show last authors
1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
4 #set($discard = $services.localization.use('document', 'homeopaths.Code.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 contents</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'}},
38
39 {'pmAddress': 'type': 'text', '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.'}},
40
41 {'pmStreet': {'type': 'text'}},
42 {'pmHousenumber': {'type': 'text'}},
43 {'pmPostcode': {'type': 'text'}},
44 {'pmCity': {'type': 'text'}},
45 {'pmCounty': {'type': 'text'}},
46 {'pmState': {'type': 'text'}},
47 {'pmCountry': {'type': 'text'}},
48 {'certification': {'type': 'checkbox', 'opener': 1}},
49 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
50 ])
51
52 #if($hasRight)
53 <p class="buttons text-align-right">
54 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
55 <span class="btn-label">Edit details</span>
56 </a>
57 </p>
58 #end
59 </div>
60 #if($hasRight)
61 #set($form_start = {
62 "id": "homeopaths_form",
63 "product": "homeopath details",
64 "method": "post",
65 "url": "",
66 "use_captcha": "false"
67 })
68 #set($submit = {
69 "id" : "edit_details",
70 "button-text" : "Save changes",
71 "clean": "true",
72 "help-block" : ""
73 })
74 #set($form_end = {
75 "use_captcha": "false"
76 })
77 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
78 <div class="modal-dialog modal-dialog-centered" role="document">
79 <div class="modal-content">
80 #createFormStart($form_start)
81 <div class="modal-header">
82 <h3 class="modal-title">Details</h3>
83 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
84 <span aria-hidden="true">&times;</span>
85 </button>
86 </div>
87 <div class="modal-body">
88 #set($lastChild = "")
89 #foreach($property in $classProperties)
90 #foreach($item in $property.keySet())
91 #set($key = $item)
92 #end
93 #foreach($item in $property.values())
94 #set($propertyType = $item.type)
95 #set($propertyOpener = $item.opener)
96 #set($propertyParent = $item.parent)
97 #set($extraAttributes = $item.extraAttributes)
98 #end
99 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
100
101 #if($theDocObj.getProperty($key))
102 #set($value = $theDocObj.getProperty($key).value)
103 #if(!$value)
104 #set($value = "1")
105 #end
106 #set($newElem = {
107 "id" : "$key",
108 "type" : $propertyType,
109 "required" : "false",
110 "label" : "$label",
111 "data-create-xobj" : "true",
112 "data-xobj-classname" : $theClass,
113 "data-xobj-fieldname" : "$key",
114 "value" : "$value"
115 })
116 #if($extraAttributes)
117 #set($attrMap = $extraAttributes)
118 #foreach($attr in $attrMap.keySet())
119 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
120 #end
121 #end
122 #if($propertyOpener)
123 #set($discard = $newElem.put("data-opener", "true"))
124 #end
125 #if($propertyParent)
126 #set($lastChild = "$key")
127 #elseif($lastChild != "")
128 #set($lastChild = "")
129 #createExpandEnd()
130 #end
131 #createFormElement($newElem)
132 #if($propertyOpener)
133 #createExpandStart($newElem $newElem["value"])
134 #end
135 #end
136 #end
137 </div>
138 <div class="modal-footer">
139 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
140 #createSubmit($submit)
141 </div>
142 #createFormEnd($form_end)
143 </div>
144 </div>
145 </div>
146 #end
147 #else
148 This page can not be viewed in inline mode.
149 #end
150
151 #macro(createElementObjects $properties)
152 #foreach($item in $properties.keySet())
153 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
154 #if($theDocObj.getProperty($item))
155 #set($value = $theDocObj.getProperty($item).value)
156 #set($newElem = {
157 "id" : "$item",
158 "type" : $classProperties[$item].type,
159 "required" : "false",
160 "label" : "$label",
161 "data-create-xobj" : "true",
162 "data-xobj-classname" : $theClass,
163 "data-xobj-fieldname" : "$item",
164 "value" : "$value"
165 })
166 #if($classProperties[$item].opener == 1)
167 #set($discard = $newElem.put("data-opener", "true"))
168 #end
169 #if($classProperties[$item].extraAttributes)
170 #set($attrMap = $classProperties[$item].extraAttributes)
171 #foreach($attr in $attrMap.keySet())
172 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
173 #end
174 #end
175 #set($thisObj["$item"] = $newElem)
176 #end
177 #end
178 #end
179
180 {{/html}}
181 {{/velocity}}