Wiki source code of homeopathsSheet

Version 1.120 by Jip-jan Alunkel on março 08, 18:16

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