Código fuente wiki de homeopathsSheet
Versión 1.153 por Jip-jan Alunkel el marzo 08, 18:56
Ocultar los últimos autores
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{include reference="assets.pagemaker.macros"/}} |
2 | |||
3 | {{velocity}} | ||
![]() |
1.137 | 4 | #set($discard = $services.localization.use('document', 'assets.global.translations')) |
![]() |
1.1 | 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'})) | ||
![]() |
1.5 | 8 | #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument()) |
![]() |
1.1 | 9 | #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') |
![]() |
1.60 | 10 | #set($theClass = "homeopaths.Code.homeopathsClass") |
![]() |
1.5 | 11 | ## Create object (important for sheet binding, do not remove) |
![]() |
1.60 | 12 | #set($theDocObj = $doc.getObject($theClass, true)) |
![]() |
1.7 | 13 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) |
![]() |
1.5 | 14 | $theDoc.getContent() |
![]() |
1.4 | 15 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 16 | #if(!$isGuest) |
![]() |
1.4 | 17 | <script> |
18 | var pagemakerOffspring = "disable"; | ||
19 | </script> | ||
![]() |
1.7 | 20 | #end |
21 | #if($hasRight) | ||
![]() |
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> | ||
![]() |
1.7 | 28 | #end |
![]() |
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> | ||
![]() |
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 = [ | ||
![]() |
1.82 | 37 | {'practiceName': {'type': 'text'}}, |
![]() |
1.141 | 38 | {'pmAddress': {'type': 'address', '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.'}}}, |
![]() |
1.124 | 39 | {'pmStreet': {'type': 'text'}}, |
![]() |
1.115 | 40 | {'pmHousenumber': {'type': 'text'}}, |
![]() |
1.82 | 41 | {'pmPostcode': {'type': 'text'}}, |
42 | {'pmCity': {'type': 'text'}}, | ||
![]() |
1.115 | 43 | {'pmCounty': {'type': 'text'}}, |
![]() |
1.82 | 44 | {'pmState': {'type': 'text'}}, |
45 | {'pmCountry': {'type': 'text'}}, | ||
![]() |
1.70 | 46 | {'certification': {'type': 'checkbox', 'opener': 1}}, |
![]() |
1.82 | 47 | {'certificationFrom': {'type': 'text', 'parent': 'certification'}} |
![]() |
1.70 | 48 | ]) |
![]() |
1.90 | 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 | }) | ||
![]() |
1.109 | 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">×</span> | ||
83 | </button> | ||
84 | </div> | ||
85 | <div class="modal-body"> | ||
![]() |
1.85 | 86 | #set($lastChild = "") |
![]() |
1.70 | 87 | #foreach($property in $classProperties) |
![]() |
1.84 | 88 | #foreach($item in $property.keySet()) |
89 | #set($key = $item) | ||
90 | #end | ||
![]() |
1.79 | 91 | #foreach($item in $property.values()) |
![]() |
1.81 | 92 | #set($propertyType = $item.type) |
93 | #set($propertyOpener = $item.opener) | ||
94 | #set($propertyParent = $item.parent) | ||
![]() |
1.85 | 95 | #set($extraAttributes = $item.extraAttributes) |
![]() |
1.74 | 96 | #end |
![]() |
1.85 | 97 | #set($label = $services.localization.render("homeopaths.classproperty.${key}")) |
![]() |
1.133 | 98 | #if($theDocObj.getProperty($key) || $propertyType == "address") |
![]() |
1.102 | 99 | #set($value = $theDocObj.getProperty($key).value) |
![]() |
1.144 | 100 | #if(!$value) |
![]() |
1.153 | 101 | $propertyType |
![]() |
1.144 | 102 | #if($propertyType == "checkbox" || $propertyType == "radio") |
![]() |
1.145 | 103 | #set($value = "1") |
![]() |
1.151 | 104 | $propertyType - $value |
![]() |
1.144 | 105 | #else |
106 | #set($value = "") | ||
107 | #end | ||
![]() |
1.94 | 108 | #end |
![]() |
1.85 | 109 | #set($newElem = { |
110 | "id" : "$key", | ||
![]() |
1.86 | 111 | "type" : $propertyType, |
![]() |
1.85 | 112 | "required" : "false", |
113 | "label" : "$label", | ||
114 | "data-create-xobj" : "true", | ||
115 | "data-xobj-classname" : $theClass, | ||
116 | "data-xobj-fieldname" : "$key", | ||
117 | "value" : "$value" | ||
118 | }) | ||
![]() |
1.130 | 119 | #if($extraAttributes.keySet().size() > 0) |
![]() |
1.85 | 120 | #set($attrMap = $extraAttributes) |
121 | #foreach($attr in $attrMap.keySet()) | ||
122 | #set($discard = $newElem.put("$attr", $attrMap[$attr])) | ||
123 | #end | ||
124 | #end | ||
125 | #if($propertyOpener) | ||
126 | #set($discard = $newElem.put("data-opener", "true")) | ||
127 | #end | ||
128 | #if($propertyParent) | ||
![]() |
1.114 | 129 | #set($lastChild = "$key") |
![]() |
1.85 | 130 | #elseif($lastChild != "") |
![]() |
1.110 | 131 | #set($lastChild = "") |
![]() |
1.116 | 132 | #createExpandEnd() |
![]() |
1.85 | 133 | #end |
![]() |
1.109 | 134 | #createFormElement($newElem) |
![]() |
1.85 | 135 | #if($propertyOpener) |
![]() |
1.152 | 136 | ##$value |
![]() |
1.147 | 137 | #createExpandStart($newElem $value) |
![]() |
1.85 | 138 | #end |
139 | #end | ||
![]() |
1.12 | 140 | #end |
![]() |
1.1 | 141 | </div> |
142 | <div class="modal-footer"> | ||
143 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
144 | #createSubmit($submit) | ||
145 | </div> | ||
146 | #createFormEnd($form_end) | ||
147 | </div> | ||
148 | </div> | ||
149 | </div> | ||
150 | #end | ||
![]() |
1.7 | 151 | #else |
152 | This page can not be viewed in inline mode. | ||
![]() |
1.1 | 153 | #end |
![]() |
1.60 | 154 | |
![]() |
1.120 | 155 | #macro(createElementObjects $properties) |
![]() |
1.60 | 156 | #foreach($item in $properties.keySet()) |
157 | #set($label = $services.localization.render("homeopaths.classproperty.${item}")) | ||
158 | #if($theDocObj.getProperty($item)) | ||
159 | #set($value = $theDocObj.getProperty($item).value) | ||
160 | #set($newElem = { | ||
161 | "id" : "$item", | ||
162 | "type" : $classProperties[$item].type, | ||
163 | "required" : "false", | ||
164 | "label" : "$label", | ||
165 | "data-create-xobj" : "true", | ||
166 | "data-xobj-classname" : $theClass, | ||
167 | "data-xobj-fieldname" : "$item", | ||
168 | "value" : "$value" | ||
169 | }) | ||
170 | #if($classProperties[$item].opener == 1) | ||
171 | #set($discard = $newElem.put("data-opener", "true")) | ||
172 | #end | ||
173 | #if($classProperties[$item].extraAttributes) | ||
174 | #set($attrMap = $classProperties[$item].extraAttributes) | ||
175 | #foreach($attr in $attrMap.keySet()) | ||
176 | #set($discard = $newElem.put("$attr", $attrMap[$attr])) | ||
177 | #end | ||
178 | #end | ||
179 | #set($thisObj["$item"] = $newElem) | ||
180 | #end | ||
181 | #end | ||
182 | #end | ||
183 | |||
![]() |
1.1 | 184 | {{/html}} |
185 | {{/velocity}} |