Code source wiki de homeopathsSheet

Version 1.117 par Jip-jan Alunkel le mars 08, 15:44

Afficher les derniers auteurs
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 {'pmStreet': {'type': 'text'}},
39 {'pmHousenumber': {'type': 'text'}},
40 {'pmPostcode': {'type': 'text'}},
41 {'pmCity': {'type': 'text'}},
42 {'pmCounty': {'type': 'text'}},
43 {'pmState': {'type': 'text'}},
44 {'pmCountry': {'type': 'text'}},
45 {'certification': {'type': 'checkbox', 'opener': 1}},
46 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
47 ])
48
49 #if($hasRight)
50 <p class="buttons text-align-right">
51 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
52 <span class="btn-label">Edit details</span>
53 </a>
54 </p>
55 #end
56 </div>
57 #if($hasRight)
58 #set($form_start = {
59 "id": "homeopaths_form",
60 "product": "homeopath details",
61 "method": "post",
62 "url": "",
63 "use_captcha": "false"
64 })
65 #* #set($thisObj = {})
66 #set($children = {})
67 #set($nonChildren = {})
68 #foreach($item in $classProperties.keySet())
69 #if($classProperties[$item].opener == 1)
70 #set($parentID = $classProperties[$item].parent)
71 #if(!$children[$parentID])
72 #set($discard = $children.put("$parentID", {}))
73 #end
74 #set($discard = $children["$parentID"].put($item, $classProperties[$item]))
75 #elseif($classProperties[$item].parent)## ???? Ws fout
76 #else
77 #set($discard = $nonChildren.put($item, $classProperties[$item]))
78 #end
79 #end
80 ## #createElementObjects($nonChildren)
81 *#
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 #set($lastChild = "")
104 #foreach($property in $classProperties)
105 #foreach($item in $property.keySet())
106 #set($key = $item)
107 #end
108 #foreach($item in $property.values())
109 #set($propertyType = $item.type)
110 #set($propertyOpener = $item.opener)
111 #set($propertyParent = $item.parent)
112 #set($extraAttributes = $item.extraAttributes)
113 #end
114 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
115
116 #if($theDocObj.getProperty($key))
117 #set($value = $theDocObj.getProperty($key).value)
118 #if(!$value)
119 #set($value = "")
120 #end
121 ## $key : $value<br />
122 #set($newElem = {
123 "id" : "$key",
124 "type" : $propertyType,
125 "required" : "false",
126 "label" : "$label",
127 "data-create-xobj" : "true",
128 "data-xobj-classname" : $theClass,
129 "data-xobj-fieldname" : "$key",
130 "value" : "$value"
131 })
132 #if($extraAttributes)
133 #set($attrMap = $extraAttributes)
134 #foreach($attr in $attrMap.keySet())
135 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
136 #end
137 #end
138 #if($propertyOpener)
139 #set($discard = $newElem.put("data-opener", "true"))
140 #end
141 #if($propertyParent)
142 #set($lastChild = "$key")
143 #elseif($lastChild != "")
144 #set($lastChild = "")
145 #createExpandEnd()
146 #end
147 #createFormElement($newElem)
148 $lastChild
149 #if($propertyOpener)
150 $newElem["value"]
151 #createExpandStart($newElem $newElem["value"])
152 #end
153 #end
154
155 #*
156 #if($theDocObj.getProperty($property))
157 <p class="property">
158 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
159 #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout.
160 <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span>
161 #else
162 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
163 #end
164 </p>
165 #end
166 #end
167 *#
168
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 This page can not be viewed in inline mode.
182 #end
183
184 #macro(createElementObject $properties)
185 #foreach($item in $properties.keySet())
186 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
187 #if($theDocObj.getProperty($item))
188 #set($value = $theDocObj.getProperty($item).value)
189 #set($newElem = {
190 "id" : "$item",
191 "type" : $classProperties[$item].type,
192 "required" : "false",
193 "label" : "$label",
194 "data-create-xobj" : "true",
195 "data-xobj-classname" : $theClass,
196 "data-xobj-fieldname" : "$item",
197 "value" : "$value"
198 })
199 #if($classProperties[$item].opener == 1)
200 #set($discard = $newElem.put("data-opener", "true"))
201 #end
202 #if($classProperties[$item].extraAttributes)
203 #set($attrMap = $classProperties[$item].extraAttributes)
204 #foreach($attr in $attrMap.keySet())
205 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
206 #end
207 #end
208 #set($thisObj["$item"] = $newElem)
209 #end
210 #end
211 #end
212
213 {{/html}}
214 {{/velocity}}