Wiki source code of homeopathsSheet

Version 1.52 by Jip-jan Alunkel on March 07, 23:33

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