Wiki source code of homeopathsSheet

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

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'}},
Jip-jan Alunkel 1.122 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.'}},
Jip-jan Alunkel 1.123 40
41 {'pmStreet': {'type': 'text'}},
Jip-jan Alunkel 1.115 42 {'pmHousenumber': {'type': 'text'}},
Jip-jan Alunkel 1.82 43 {'pmPostcode': {'type': 'text'}},
44 {'pmCity': {'type': 'text'}},
Jip-jan Alunkel 1.115 45 {'pmCounty': {'type': 'text'}},
Jip-jan Alunkel 1.82 46 {'pmState': {'type': 'text'}},
47 {'pmCountry': {'type': 'text'}},
Jip-jan Alunkel 1.70 48 {'certification': {'type': 'checkbox', 'opener': 1}},
Jip-jan Alunkel 1.82 49 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
Jip-jan Alunkel 1.70 50 ])
Jip-jan Alunkel 1.90 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 })
Jip-jan Alunkel 1.109 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">
Jip-jan Alunkel 1.85 88 #set($lastChild = "")
Jip-jan Alunkel 1.70 89 #foreach($property in $classProperties)
Jip-jan Alunkel 1.84 90 #foreach($item in $property.keySet())
91 #set($key = $item)
92 #end
Jip-jan Alunkel 1.79 93 #foreach($item in $property.values())
Jip-jan Alunkel 1.81 94 #set($propertyType = $item.type)
95 #set($propertyOpener = $item.opener)
96 #set($propertyParent = $item.parent)
Jip-jan Alunkel 1.85 97 #set($extraAttributes = $item.extraAttributes)
Jip-jan Alunkel 1.74 98 #end
Jip-jan Alunkel 1.85 99 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
100
101 #if($theDocObj.getProperty($key))
Jip-jan Alunkel 1.102 102 #set($value = $theDocObj.getProperty($key).value)
Jip-jan Alunkel 1.107 103 #if(!$value)
Jip-jan Alunkel 1.118 104 #set($value = "1")
Jip-jan Alunkel 1.94 105 #end
Jip-jan Alunkel 1.85 106 #set($newElem = {
107 "id" : "$key",
Jip-jan Alunkel 1.86 108 "type" : $propertyType,
Jip-jan Alunkel 1.85 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)
Jip-jan Alunkel 1.114 126 #set($lastChild = "$key")
Jip-jan Alunkel 1.85 127 #elseif($lastChild != "")
Jip-jan Alunkel 1.110 128 #set($lastChild = "")
Jip-jan Alunkel 1.116 129 #createExpandEnd()
Jip-jan Alunkel 1.85 130 #end
Jip-jan Alunkel 1.109 131 #createFormElement($newElem)
Jip-jan Alunkel 1.85 132 #if($propertyOpener)
Jip-jan Alunkel 1.116 133 #createExpandStart($newElem $newElem["value"])
Jip-jan Alunkel 1.85 134 #end
135 #end
Jip-jan Alunkel 1.12 136 #end
Jip-jan Alunkel 1.1 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
Jip-jan Alunkel 1.7 147 #else
148 This page can not be viewed in inline mode.
Jip-jan Alunkel 1.1 149 #end
Jip-jan Alunkel 1.60 150
Jip-jan Alunkel 1.120 151 #macro(createElementObjects $properties)
Jip-jan Alunkel 1.60 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
Jip-jan Alunkel 1.1 180 {{/html}}
181 {{/velocity}}