Исходный код вики homeopathsSheet
Версия 1.60 от Jip-jan Alunkel на марта 08, 00:51
Последние авторы
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 | #set($theClass = "homeopaths.Code.homeopathsClass") | ||
11 | ## Create object (important for sheet binding, do not remove) | ||
12 | #set($theDocObj = $doc.getObject($theClass, true)) | ||
13 | #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin)) | ||
14 | $theDoc.getContent() | ||
15 | {{html wiki="true" clean="false"}} | ||
16 | #if(!$isGuest) | ||
17 | <script> | ||
18 | var pagemakerOffspring = "disable"; | ||
19 | </script> | ||
20 | #end | ||
21 | #if($hasRight) | ||
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> | ||
28 | #end | ||
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> | ||
35 | #set($classProperties = { | ||
36 | 'practiceName': {'type': 'string', 'opener': 0}, | ||
37 | 'pmStreet': {'type': 'string', 'opener': 0}, | ||
38 | 'pmHousenumber': {'type': 'string', 'opener': 0, 'parent': 'certification'}, | ||
39 | 'pmPostcode': {'type': 'string', 'opener': 0}, | ||
40 | 'pmCity': {'type': 'string', 'opener': 0}, | ||
41 | 'pmCounty': {'type': 'string', 'opener': 0, 'parent': 'certification'}, | ||
42 | 'pmState': {'type': 'string', 'opener': 0}, | ||
43 | 'pmCountry': {'type': 'string', 'opener': 0}, | ||
44 | 'certification': {'type': 'bool', 'opener': 1}, | ||
45 | 'certificationFrom': {'type': 'string', 'opener': 0, 'parent': 'certification'} | ||
46 | }) | ||
47 | #foreach($property in $classProperties.keySet()) | ||
48 | #if($theDocObj.getProperty($property)) | ||
49 | <p class="property"> | ||
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. | ||
52 | <span class="property-name">$services.localization.render("homeopaths.classproperty.address")</span> <span class="property-value">$doc.display($property) $doc.display("pmHousenumber")</span> | ||
53 | #else | ||
54 | <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span> | ||
55 | #end | ||
56 | </p> | ||
57 | #end | ||
58 | #end | ||
59 | #end | ||
60 | |||
61 | #if($hasRight) | ||
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> | ||
69 | #if($hasRight) | ||
70 | #set($form_start = { | ||
71 | "id": "homeopaths_form", | ||
72 | "product": "homeopath details", | ||
73 | "method": "post", | ||
74 | "url": "", | ||
75 | "use_captcha": "false" | ||
76 | }) | ||
77 | #set($thisObj = {}) | ||
78 | #set($children = {}) | ||
79 | #foreach($item in $classProperties.keySet()) | ||
80 | #if($classProperties[$item].parent) | ||
81 | #set($parentID = $classProperties[$item].parent) | ||
82 | #if(!$children[$parentID]) | ||
83 | #set($discard = $children.put("$parentID", {})) | ||
84 | #end | ||
85 | #set($discard = $children["$parentID"].put($item, $classProperties[$item])) | ||
86 | #end | ||
87 | #end | ||
88 | #createElementObjects($classProperties) | ||
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"> | ||
109 | #foreach($obj in $thisObj) | ||
110 | #createFormElement($obj) | ||
111 | #end | ||
112 | ## #createFormElement($practiceName) | ||
113 | ## #createFormElement($city) | ||
114 | </div> | ||
115 | <div class="modal-footer"> | ||
116 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> | ||
117 | #createSubmit($submit) | ||
118 | </div> | ||
119 | #createFormEnd($form_end) | ||
120 | </div> | ||
121 | </div> | ||
122 | </div> | ||
123 | #end | ||
124 | #else | ||
125 | This page can not be viewed in inline mode. | ||
126 | #end | ||
127 | |||
128 | #macro(createElementObjects $properties) | ||
129 | #foreach($item in $properties.keySet()) | ||
130 | #set($label = $services.localization.render("homeopaths.classproperty.${item}")) | ||
131 | #if($theDocObj.getProperty($item)) | ||
132 | #set($value = $theDocObj.getProperty($item).value) | ||
133 | #set($newElem = { | ||
134 | "id" : "$item", | ||
135 | "type" : $classProperties[$item].type, | ||
136 | "required" : "false", | ||
137 | "label" : "$label", | ||
138 | "data-create-xobj" : "true", | ||
139 | "data-xobj-classname" : $theClass, | ||
140 | "data-xobj-fieldname" : "$item", | ||
141 | "value" : "$value" | ||
142 | }) | ||
143 | #if($classProperties[$item].opener == 1) | ||
144 | #set($discard = $newElem.put("data-opener", "true")) | ||
145 | #end | ||
146 | #if($classProperties[$item].extraAttributes) | ||
147 | #set($attrMap = $classProperties[$item].extraAttributes) | ||
148 | #foreach($attr in $attrMap.keySet()) | ||
149 | #set($discard = $newElem.put("$attr", $attrMap[$attr])) | ||
150 | #end | ||
151 | #end | ||
152 | #set($thisObj["$item"] = $newElem) | ||
153 | #end | ||
154 | #end | ||
155 | #end | ||
156 | |||
157 | {{/html}} | ||
158 | {{/velocity}} |