Wiki source code of homeopathsSheet
Version 1.59 by Jip-jan Alunkel on March 07, 23:40
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
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'})) | ||
![]() |
1.5 | 8 | #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument()) |
![]() |
1.1 | 9 | #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') |
![]() |
1.5 | 10 | ## Create object (important for sheet binding, do not remove) |
11 | #set($theDocObj = $doc.getObject("homeopaths.Code.homeopathsClass", true)) | ||
![]() |
1.7 | 12 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) |
![]() |
1.5 | 13 | $theDoc.getContent() |
![]() |
1.4 | 14 | {{html wiki="true" clean="false"}} |
![]() |
1.7 | 15 | #if(!$isGuest) |
![]() |
1.4 | 16 | <script> |
17 | var pagemakerOffspring = "disable"; | ||
18 | </script> | ||
![]() |
1.7 | 19 | #end |
20 | #if($hasRight) | ||
![]() |
1.1 | 21 | <p class="buttons text-align-right"> |
22 | <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow"> | ||
23 | <span class="fa fa-pencil"></span> | ||
24 | <span class="btn-label">Edit contents</span> | ||
25 | </a> | ||
26 | </p> | ||
![]() |
1.7 | 27 | #end |
![]() |
1.1 | 28 | #set($spaceReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent) |
29 | #set($spaceTitle = $spaceReference.getName()) | ||
30 | <div class="clearfix"></div> | ||
31 | #if($xcontext.action == "view") | ||
32 | <div id="${spaceTitle}" class="box sheet_properties"> | ||
33 | <h2>Details</h2> | ||
![]() |
1.31 | 34 | #set($classProperties = { |
![]() |
1.32 | 35 | 'practiceName': {'type': 'string', 'opener': 0}, |
36 | 'pmStreet': {'type': 'string', 'opener': 0}, | ||
![]() |
1.49 | 37 | 'pmHousenumber': {'type': 'string', 'opener': 0, 'parent': 'certification'}, |
![]() |
1.32 | 38 | 'pmPostcode': {'type': 'string', 'opener': 0}, |
39 | 'pmCity': {'type': 'string', 'opener': 0}, | ||
![]() |
1.45 | 40 | 'pmCounty': {'type': 'string', 'opener': 0, 'parent': 'certification'}, |
![]() |
1.32 | 41 | 'pmState': {'type': 'string', 'opener': 0}, |
42 | 'pmCountry': {'type': 'string', 'opener': 0}, | ||
43 | 'certification': {'type': 'bool', 'opener': 1}, | ||
44 | 'certificationFrom': {'type': 'string', 'opener': 0, 'parent': 'certification'} | ||
![]() |
1.31 | 45 | }) |
46 | #foreach($property in $classProperties.keySet()) | ||
47 | #if($theDocObj.getProperty($property)) | ||
![]() |
1.17 | 48 | <p class="property"> |
![]() |
1.31 | 49 | #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout. |
50 | #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout. | ||
![]() |
1.17 | 51 | <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span> |
![]() |
1.31 | 52 | #else |
![]() |
1.17 | 53 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> |
![]() |
1.31 | 54 | #end |
55 | </p> | ||
![]() |
1.16 | 56 | #end |
![]() |
1.13 | 57 | #end |
![]() |
1.12 | 58 | #end |
![]() |
1.11 | 59 | |
![]() |
1.7 | 60 | #if($hasRight) |
![]() |
1.1 | 61 | <p class="buttons text-align-right"> |
62 | <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow"> | ||
63 | <span class="btn-label">Edit details</span> | ||
64 | </a> | ||
65 | </p> | ||
66 | #end | ||
67 | </div> | ||
![]() |
1.23 | 68 | #if($hasRight) |
![]() |
1.1 | 69 | #set($form_start = { |
![]() |
1.5 | 70 | "id": "homeopaths_form", |
71 | "product": "homeopath details", | ||
![]() |
1.1 | 72 | "method": "post", |
73 | "url": "", | ||
74 | "use_captcha": "false" | ||
75 | }) | ||
![]() |
1.23 | 76 | #set($thisObj = {}) |
![]() |
1.32 | 77 | #set($children = {}) |
![]() |
1.37 | 78 | #foreach($item in $classProperties.keySet()) |
![]() |
1.40 | 79 | #if($classProperties[$item].parent) |
![]() |
1.57 | 80 | #set($parentID = $classProperties[$item].parent) |
![]() |
1.59 | 81 | ##$children[$parentID] |
![]() |
1.58 | 82 | #if(!$children[$parentID]) |
![]() |
1.55 | 83 | #set($discard = $children.put("$parentID", {})) |
84 | #end | ||
![]() |
1.53 | 85 | #set($discard = $children["$parentID"].put($item, $classProperties[$item])) |
![]() |
1.32 | 86 | #end |
87 | #end | ||
![]() |
1.33 | 88 | $children |
![]() |
1.31 | 89 | #foreach($item in $classProperties.keySet()) |
![]() |
1.26 | 90 | #set($label = $services.localization.render("homeopaths.classproperty.${item}")) |
![]() |
1.30 | 91 | #if($theDocObj.getProperty($item)) |
92 | #set($value = $theDocObj.getProperty($item).value) | ||
![]() |
1.32 | 93 | #if($classProperties[$item].type == "bool") |
94 | #set($newElem = { | ||
95 | "id" : "$item", | ||
96 | "type" : "checkbox", | ||
97 | "required" : "false", | ||
98 | "label" : "$label", | ||
99 | "value" : "$value", | ||
100 | "data-opener" : "true" | ||
101 | }) | ||
102 | #else | ||
103 | ## #if($classProperties[$item].opener) | ||
104 | #set($newElem = { | ||
105 | "id": "$item", | ||
106 | "type": "text", | ||
107 | "required" : "false", | ||
108 | "label" : "$label", | ||
109 | "data-create-xobj" : "true", | ||
110 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", | ||
111 | "data-xobj-fieldname" : "$item", | ||
112 | "value": "$value" | ||
113 | }) | ||
114 | #end | ||
115 | #set($thisObj["$item"] = $newElem) | ||
![]() |
1.30 | 116 | #end |
![]() |
1.23 | 117 | #end |
![]() |
1.19 | 118 | #set($practiceName = { |
![]() |
1.18 | 119 | "id": "practiceName", |
120 | "type": "text", | ||
121 | "required" : "false", | ||
![]() |
1.19 | 122 | "label" : "Practice name", |
![]() |
1.18 | 123 | "data-create-xobj" : "true", |
124 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", | ||
![]() |
1.19 | 125 | "data-xobj-fieldname" : "practiceName", |
![]() |
1.22 | 126 | "value": "$doc.getTitle()" |
![]() |
1.18 | 127 | }) |
![]() |
1.20 | 128 | #set($city = { |
![]() |
1.5 | 129 | "id": "city", |
130 | "type": "text", | ||
![]() |
1.1 | 131 | "required" : "false", |
![]() |
1.5 | 132 | "label" : "City", |
![]() |
1.1 | 133 | "data-create-xobj" : "true", |
![]() |
1.5 | 134 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", |
![]() |
1.10 | 135 | "data-xobj-fieldname" : "pmCity", |
136 | "value": "$theDocObj.getProperty('pmCity').value" | ||
137 | }) | ||
138 | #set($submit = { | ||
139 | "id" : "edit_details", | ||
140 | "button-text" : "Save changes", | ||
141 | "clean": "true", | ||
142 | "help-block" : "" | ||
143 | }) | ||
144 | #set($form_end = { | ||
145 | "use_captcha": "false" | ||
146 | }) | ||
147 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
148 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
149 | <div class="modal-content"> | ||
150 | #createFormStart($form_start) | ||
151 | <div class="modal-header"> | ||
152 | <h3 class="modal-title">Details</h3> | ||
153 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
154 | <span aria-hidden="true">×</span> | ||
155 | </button> | ||
156 | </div> | ||
157 | <div class="modal-body"> | ||
![]() |
1.23 | 158 | #foreach($obj in $thisObj) |
159 | #createFormElement($obj) | ||
160 | #end | ||
![]() |
1.21 | 161 | #createFormElement($practiceName) |
![]() |
1.5 | 162 | #createFormElement($city) |
![]() |
1.1 | 163 | </div> |
164 | <div class="modal-footer"> | ||
165 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
166 | #createSubmit($submit) | ||
167 | </div> | ||
168 | #createFormEnd($form_end) | ||
169 | </div> | ||
170 | </div> | ||
171 | </div> | ||
172 | #end | ||
![]() |
1.7 | 173 | #else |
174 | This page can not be viewed in inline mode. | ||
![]() |
1.1 | 175 | #end |
176 | {{/html}} | ||
177 | {{/velocity}} |