Codice sorgente Wiki di homeopathsSheet
Version 3.1 by Jip-jan Alunkel on marzo 08, 19:11
Show last authors
author | version | line-number | content |
---|---|---|---|
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'})) | ||
8 | #set($theDoc = $xwiki.getDocument("${doc.fullName}").getTranslatedDocument()) | ||
9 | #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline') | ||
10 | ## Create object (important for sheet binding, do not remove) | ||
11 | #set($theDocObj = $doc.getObject("homeopaths.Code.homeopathsClass", true)) | ||
12 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) | ||
13 | $theDoc.getContent() | ||
14 | {{html wiki="true" clean="false"}} | ||
15 | #if(!$isGuest) | ||
16 | <script> | ||
17 | var pagemakerOffspring = "disable"; | ||
18 | </script> | ||
19 | #end | ||
20 | #if($hasRight) | ||
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> | ||
27 | #end | ||
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> | ||
34 | #set($classProperties = { | ||
35 | 'practiceName': {'type': 'string', 'opener': 0}, | ||
36 | 'pmStreet': {'type': 'string', 'opener': 0}, | ||
37 | 'pmHousenumber': {'type': 'string', 'opener': 0}, | ||
38 | 'pmPostcode': {'type': 'string', 'opener': 0}, | ||
39 | 'pmCity': {'type': 'string', 'opener': 0}, | ||
40 | 'pmCounty': {'type': 'string', 'opener': 0}, | ||
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'} | ||
45 | }) | ||
46 | #foreach($property in $classProperties.keySet()) | ||
47 | #if($theDocObj.getProperty($property)) | ||
48 | <p class="property"> | ||
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. | ||
51 | <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span> | ||
52 | #else | ||
53 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> | ||
54 | #end | ||
55 | </p> | ||
56 | #end | ||
57 | #end | ||
58 | #end | ||
59 | |||
60 | #if($hasRight) | ||
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> | ||
68 | #if($hasRight) | ||
69 | #set($form_start = { | ||
70 | "id": "homeopaths_form", | ||
71 | "product": "homeopath details", | ||
72 | "method": "post", | ||
73 | "url": "", | ||
74 | "use_captcha": "false" | ||
75 | }) | ||
76 | #set($thisObj = {}) | ||
77 | #set($children = {}) | ||
78 | #foreach($item in $classProperties.keySet()) | ||
79 | #if($classProperties[$item].parent) | ||
80 | #set($discard = $children[$classProperties[$item].parent].add($classProperties[$item])) | ||
81 | #end | ||
82 | #end | ||
83 | $children | ||
84 | #foreach($item in $classProperties.keySet()) | ||
85 | #set($label = $services.localization.render("homeopaths.classproperty.${item}")) | ||
86 | #if($theDocObj.getProperty($item)) | ||
87 | #set($value = $theDocObj.getProperty($item).value) | ||
88 | #if($classProperties[$item].type == "bool") | ||
89 | #set($newElem = { | ||
90 | "id" : "$item", | ||
91 | "type" : "checkbox", | ||
92 | "required" : "false", | ||
93 | "label" : "$label", | ||
94 | "value" : "$value", | ||
95 | "data-opener" : "true" | ||
96 | }) | ||
97 | #else | ||
98 | ## #if($classProperties[$item].opener) | ||
99 | #set($newElem = { | ||
100 | "id": "$item", | ||
101 | "type": "text", | ||
102 | "required" : "false", | ||
103 | "label" : "$label", | ||
104 | "data-create-xobj" : "true", | ||
105 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", | ||
106 | "data-xobj-fieldname" : "$item", | ||
107 | "value": "$value" | ||
108 | }) | ||
109 | #end | ||
110 | #set($thisObj["$item"] = $newElem) | ||
111 | #end | ||
112 | #end | ||
113 | #set($practiceName = { | ||
114 | "id": "practiceName", | ||
115 | "type": "text", | ||
116 | "required" : "false", | ||
117 | "label" : "Practice name", | ||
118 | "data-create-xobj" : "true", | ||
119 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", | ||
120 | "data-xobj-fieldname" : "practiceName", | ||
121 | "value": "$doc.getTitle()" | ||
122 | }) | ||
123 | #set($city = { | ||
124 | "id": "city", | ||
125 | "type": "text", | ||
126 | "required" : "false", | ||
127 | "label" : "City", | ||
128 | "data-create-xobj" : "true", | ||
129 | "data-xobj-classname" : "homeopaths.Code.homeopathsClass", | ||
130 | "data-xobj-fieldname" : "pmCity", | ||
131 | "value": "$theDocObj.getProperty('pmCity').value" | ||
132 | }) | ||
133 | #set($submit = { | ||
134 | "id" : "edit_details", | ||
135 | "button-text" : "Save changes", | ||
136 | "clean": "true", | ||
137 | "help-block" : "" | ||
138 | }) | ||
139 | #set($form_end = { | ||
140 | "use_captcha": "false" | ||
141 | }) | ||
142 | <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> | ||
143 | <div class="modal-dialog modal-dialog-centered" role="document"> | ||
144 | <div class="modal-content"> | ||
145 | #createFormStart($form_start) | ||
146 | <div class="modal-header"> | ||
147 | <h3 class="modal-title">Details</h3> | ||
148 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
149 | <span aria-hidden="true">×</span> | ||
150 | </button> | ||
151 | </div> | ||
152 | <div class="modal-body"> | ||
153 | #foreach($obj in $thisObj) | ||
154 | #createFormElement($obj) | ||
155 | #end | ||
156 | #createFormElement($practiceName) | ||
157 | #createFormElement($city) | ||
158 | </div> | ||
159 | <div class="modal-footer"> | ||
160 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
161 | #createSubmit($submit) | ||
162 | </div> | ||
163 | #createFormEnd($form_end) | ||
164 | </div> | ||
165 | </div> | ||
166 | </div> | ||
167 | #end | ||
168 | #else | ||
169 | This page can not be viewed in inline mode. | ||
170 | #end | ||
171 | {{/html}} | ||
172 | {{/velocity}} |