Wiki source code of homeopathsSheet
Version 1.63 by Jip-jan Alunkel on March 08, 00:54
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.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.31 | 35 | #set($classProperties = { |
![]() |
1.62 | 36 | 'practiceName': {'type': 'text', 'opener': 0}, |
37 | 'pmStreet': {'type': 'text', 'opener': 0}, | ||
38 | 'pmHousenumber': {'type': 'text', 'opener': 0, 'parent': 'certification'}, | ||
39 | 'pmPostcode': {'type': 'text', 'opener': 0}, | ||
40 | 'pmCity': {'type': 'text', 'opener': 0}, | ||
41 | 'pmCounty': {'type': 'text', 'opener': 0, 'parent': 'certification'}, | ||
42 | 'pmState': {'type': 'text', 'opener': 0}, | ||
43 | 'pmCountry': {'type': 'text', 'opener': 0}, | ||
44 | 'certification': {'type': 'checkbox', 'opener': 1}, | ||
45 | 'certificationFrom': {'type': 'text', 'opener': 0, 'parent': 'certification'} | ||
![]() |
1.31 | 46 | }) |
47 | #foreach($property in $classProperties.keySet()) | ||
48 | #if($theDocObj.getProperty($property)) | ||
![]() |
1.17 | 49 | <p class="property"> |
![]() |
1.31 | 50 | #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout. |
51 | #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout. | ||
![]() |
1.17 | 52 | <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span> |
![]() |
1.31 | 53 | #else |
![]() |
1.17 | 54 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> |
![]() |
1.31 | 55 | #end |
56 | </p> | ||
![]() |
1.16 | 57 | #end |
![]() |
1.13 | 58 | #end |
![]() |
1.12 | 59 | #end |
![]() |
1.11 | 60 | |
![]() |
1.7 | 61 | #if($hasRight) |
![]() |
1.1 | 62 | <p class="buttons text-align-right"> |
63 | <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow"> | ||
64 | <span class="btn-label">Edit details</span> | ||
65 | </a> | ||
66 | </p> | ||
67 | #end | ||
68 | </div> | ||
![]() |
1.23 | 69 | #if($hasRight) |
![]() |
1.1 | 70 | #set($form_start = { |
![]() |
1.5 | 71 | "id": "homeopaths_form", |
72 | "product": "homeopath details", | ||
![]() |
1.1 | 73 | "method": "post", |
74 | "url": "", | ||
75 | "use_captcha": "false" | ||
76 | }) | ||
![]() |
1.23 | 77 | #set($thisObj = {}) |
![]() |
1.32 | 78 | #set($children = {}) |
![]() |
1.37 | 79 | #foreach($item in $classProperties.keySet()) |
![]() |
1.40 | 80 | #if($classProperties[$item].parent) |
![]() |
1.57 | 81 | #set($parentID = $classProperties[$item].parent) |
![]() |
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.60 | 88 | #createElementObjects($classProperties) |
![]() |
1.1 | 89 | #set($submit = { |
90 | "id" : "edit_details", | ||
91 | "button-text" : "Save changes", | ||
92 | "clean": "true", | ||
93 | "help-block" : "" | ||
94 | }) | ||
95 | #set($form_end = { | ||
96 | "use_captcha": "false" | ||
97 | }) | ||
98 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
99 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
100 | <div class="modal-content"> | ||
101 | #createFormStart($form_start) | ||
102 | <div class="modal-header"> | ||
103 | <h3 class="modal-title">Details</h3> | ||
104 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
105 | <span aria-hidden="true">×</span> | ||
106 | </button> | ||
107 | </div> | ||
108 | <div class="modal-body"> | ||
![]() |
1.23 | 109 | #foreach($obj in $thisObj) |
![]() |
1.63 | 110 | ## $obj |
111 | #createFormElement($obj) | ||
![]() |
1.23 | 112 | #end |
![]() |
1.60 | 113 | ## #createFormElement($practiceName) |
114 | ## #createFormElement($city) | ||
![]() |
1.1 | 115 | </div> |
116 | <div class="modal-footer"> | ||
117 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
118 | #createSubmit($submit) | ||
119 | </div> | ||
120 | #createFormEnd($form_end) | ||
121 | </div> | ||
122 | </div> | ||
123 | </div> | ||
124 | #end | ||
![]() |
1.7 | 125 | #else |
126 | This page can not be viewed in inline mode. | ||
![]() |
1.1 | 127 | #end |
![]() |
1.60 | 128 | |
129 | #macro(createElementObjects $properties) | ||
130 | #foreach($item in $properties.keySet()) | ||
131 | #set($label = $services.localization.render("homeopaths.classproperty.${item}")) | ||
132 | #if($theDocObj.getProperty($item)) | ||
133 | #set($value = $theDocObj.getProperty($item).value) | ||
134 | #set($newElem = { | ||
135 | "id" : "$item", | ||
136 | "type" : $classProperties[$item].type, | ||
137 | "required" : "false", | ||
138 | "label" : "$label", | ||
139 | "data-create-xobj" : "true", | ||
140 | "data-xobj-classname" : $theClass, | ||
141 | "data-xobj-fieldname" : "$item", | ||
142 | "value" : "$value" | ||
143 | }) | ||
144 | #if($classProperties[$item].opener == 1) | ||
145 | #set($discard = $newElem.put("data-opener", "true")) | ||
146 | #end | ||
147 | #if($classProperties[$item].extraAttributes) | ||
148 | #set($attrMap = $classProperties[$item].extraAttributes) | ||
149 | #foreach($attr in $attrMap.keySet()) | ||
150 | #set($discard = $newElem.put("$attr", $attrMap[$attr])) | ||
151 | #end | ||
152 | #end | ||
153 | #set($thisObj["$item"] = $newElem) | ||
154 | #end | ||
155 | #end | ||
156 | #end | ||
157 | |||
![]() |
1.1 | 158 | {{/html}} |
159 | {{/velocity}} |