Wiki source code of homeopathsSheet

Version 1.119 by Jip-jan Alunkel on March 08, 15:46

Hide last authors
Jip-jan Alunkel 1.1 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'}))
Jip-jan Alunkel 1.5 8 #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument())
Jip-jan Alunkel 1.1 9 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
Jip-jan Alunkel 1.60 10 #set($theClass = "homeopaths.Code.homeopathsClass")
Jip-jan Alunkel 1.5 11 ## Create object (important for sheet binding, do not remove)
Jip-jan Alunkel 1.60 12 #set($theDocObj = $doc.getObject($theClass, true))
Jip-jan Alunkel 1.7 13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
Jip-jan Alunkel 1.5 14 $theDoc.getContent()
Jip-jan Alunkel 1.4 15 {{html wiki="true" clean="false"}}
Jip-jan Alunkel 1.7 16 #if(!$isGuest)
Jip-jan Alunkel 1.4 17 <script>
18 var pagemakerOffspring = "disable";
19 </script>
Jip-jan Alunkel 1.7 20 #end
21 #if($hasRight)
Jip-jan Alunkel 1.1 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>
Jip-jan Alunkel 1.7 28 #end
Jip-jan Alunkel 1.1 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>
Jip-jan Alunkel 1.70 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 = [
Jip-jan Alunkel 1.82 37 {'practiceName': {'type': 'text'}},
38 {'pmStreet': {'type': 'text'}},
Jip-jan Alunkel 1.115 39 {'pmHousenumber': {'type': 'text'}},
Jip-jan Alunkel 1.82 40 {'pmPostcode': {'type': 'text'}},
41 {'pmCity': {'type': 'text'}},
Jip-jan Alunkel 1.115 42 {'pmCounty': {'type': 'text'}},
Jip-jan Alunkel 1.82 43 {'pmState': {'type': 'text'}},
44 {'pmCountry': {'type': 'text'}},
Jip-jan Alunkel 1.70 45 {'certification': {'type': 'checkbox', 'opener': 1}},
Jip-jan Alunkel 1.82 46 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
Jip-jan Alunkel 1.70 47 ])
Jip-jan Alunkel 1.90 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 *#
Jip-jan Alunkel 1.109 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">
Jip-jan Alunkel 1.85 103 #set($lastChild = "")
Jip-jan Alunkel 1.70 104 #foreach($property in $classProperties)
Jip-jan Alunkel 1.84 105 #foreach($item in $property.keySet())
106 #set($key = $item)
107 #end
Jip-jan Alunkel 1.79 108 #foreach($item in $property.values())
Jip-jan Alunkel 1.81 109 #set($propertyType = $item.type)
110 #set($propertyOpener = $item.opener)
111 #set($propertyParent = $item.parent)
Jip-jan Alunkel 1.85 112 #set($extraAttributes = $item.extraAttributes)
Jip-jan Alunkel 1.74 113 #end
Jip-jan Alunkel 1.85 114 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
115
116 #if($theDocObj.getProperty($key))
Jip-jan Alunkel 1.102 117 #set($value = $theDocObj.getProperty($key).value)
Jip-jan Alunkel 1.107 118 #if(!$value)
Jip-jan Alunkel 1.118 119 #set($value = "1")
Jip-jan Alunkel 1.94 120 #end
Jip-jan Alunkel 1.85 121 #set($newElem = {
122 "id" : "$key",
Jip-jan Alunkel 1.86 123 "type" : $propertyType,
Jip-jan Alunkel 1.85 124 "required" : "false",
125 "label" : "$label",
126 "data-create-xobj" : "true",
127 "data-xobj-classname" : $theClass,
128 "data-xobj-fieldname" : "$key",
129 "value" : "$value"
130 })
131 #if($extraAttributes)
132 #set($attrMap = $extraAttributes)
133 #foreach($attr in $attrMap.keySet())
134 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
135 #end
136 #end
137 #if($propertyOpener)
138 #set($discard = $newElem.put("data-opener", "true"))
139 #end
140 #if($propertyParent)
Jip-jan Alunkel 1.114 141 #set($lastChild = "$key")
Jip-jan Alunkel 1.85 142 #elseif($lastChild != "")
Jip-jan Alunkel 1.110 143 #set($lastChild = "")
Jip-jan Alunkel 1.116 144 #createExpandEnd()
Jip-jan Alunkel 1.85 145 #end
Jip-jan Alunkel 1.109 146 #createFormElement($newElem)
Jip-jan Alunkel 1.85 147 #if($propertyOpener)
Jip-jan Alunkel 1.116 148 #createExpandStart($newElem $newElem["value"])
Jip-jan Alunkel 1.85 149 #end
150 #end
Jip-jan Alunkel 1.12 151 #end
Jip-jan Alunkel 1.1 152 </div>
153 <div class="modal-footer">
154 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
155 #createSubmit($submit)
156 </div>
157 #createFormEnd($form_end)
158 </div>
159 </div>
160 </div>
161 #end
Jip-jan Alunkel 1.7 162 #else
163 This page can not be viewed in inline mode.
Jip-jan Alunkel 1.1 164 #end
Jip-jan Alunkel 1.60 165
Jip-jan Alunkel 1.85 166 #macro(createElementObject $properties)
Jip-jan Alunkel 1.60 167 #foreach($item in $properties.keySet())
168 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
169 #if($theDocObj.getProperty($item))
170 #set($value = $theDocObj.getProperty($item).value)
171 #set($newElem = {
172 "id" : "$item",
173 "type" : $classProperties[$item].type,
174 "required" : "false",
175 "label" : "$label",
176 "data-create-xobj" : "true",
177 "data-xobj-classname" : $theClass,
178 "data-xobj-fieldname" : "$item",
179 "value" : "$value"
180 })
181 #if($classProperties[$item].opener == 1)
182 #set($discard = $newElem.put("data-opener", "true"))
183 #end
184 #if($classProperties[$item].extraAttributes)
185 #set($attrMap = $classProperties[$item].extraAttributes)
186 #foreach($attr in $attrMap.keySet())
187 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
188 #end
189 #end
190 #set($thisObj["$item"] = $newElem)
191 #end
192 #end
193 #end
194
Jip-jan Alunkel 1.1 195 {{/html}}
196 {{/velocity}}