Wiki source code of homeopathsSheet

Version 1.72 by Jip-jan Alunkel on March 08, 14:14

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.60 10 #set($theClass = "homeopaths.Code.homeopathsClass")
Jip-jan Alunkel 1.5 11 ## Create object (important for sheet binding, do not remove)
Jip-jan Alunkel 1.60 12 #set($theDocObj = $doc.getObject($theClass, true))
Jip-jan Alunkel 1.7 13 #set($hasRight = !$isGuest && ($theDocObj.getProperty('user').value == $context.getUser() || $hasAdmin))
Jip-jan Alunkel 1.5 14 $theDoc.getContent()
Jip-jan Alunkel 1.4 15 {{html wiki="true" clean="false"}}
Jip-jan Alunkel 1.7 16 #if(!$isGuest)
Jip-jan Alunkel 1.4 17 <script>
18 var pagemakerOffspring = "disable";
19 </script>
Jip-jan Alunkel 1.7 20 #end
21 #if($hasRight)
Jip-jan Alunkel 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>
Jip-jan Alunkel 1.7 28 #end
Jip-jan Alunkel 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>
Jip-jan Alunkel 1.70 35 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
36 #set($classProperties = [
37 {'practiceName': {'type': 'text', 'opener': 0}},
38 {'pmStreet': {'type': 'text', 'opener': 0}},
39 {'pmHousenumber': {'type': 'text', 'opener': 0, 'parent': 'certification'}},
40 {'pmPostcode': {'type': 'text', 'opener': 0}},
41 {'pmCity': {'type': 'text', 'opener': 0}},
42 {'pmCounty': {'type': 'text', 'opener': 0, 'parent': 'certification'}},
43 {'pmState': {'type': 'text', 'opener': 0}},
44 {'pmCountry': {'type': 'text', 'opener': 0}},
45 {'certification': {'type': 'checkbox', 'opener': 1}},
46 {'certificationFrom': {'type': 'text', 'opener': 0, 'parent': 'certification'}}
47 ])
48 #foreach($property in $classProperties)
Jip-jan Alunkel 1.72 49 $property.keySet()
Jip-jan Alunkel 1.70 50 #*
Jip-jan Alunkel 1.31 51 #if($theDocObj.getProperty($property))
Jip-jan Alunkel 1.17 52 <p class="property">
Jip-jan Alunkel 1.31 53 #if($theDocObj.getProperty($property).value != "" && $property != "pmHousenumber") ## Difference with added housenumber because of the streetaddress layout.
54 #if($property == "pmStreet") ## Difference with added housenumber because of the streetaddress layout.
Jip-jan Alunkel 1.17 55 <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 56 #else
Jip-jan Alunkel 1.17 57 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
Jip-jan Alunkel 1.31 58 #end
59 </p>
Jip-jan Alunkel 1.16 60 #end
Jip-jan Alunkel 1.13 61 #end
Jip-jan Alunkel 1.70 62 *#
63
Jip-jan Alunkel 1.12 64 #end
Jip-jan Alunkel 1.11 65
Jip-jan Alunkel 1.7 66 #if($hasRight)
Jip-jan Alunkel 1.1 67 <p class="buttons text-align-right">
68 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
69 <span class="btn-label">Edit details</span>
70 </a>
71 </p>
72 #end
73 </div>
Jip-jan Alunkel 1.23 74 #if($hasRight)
Jip-jan Alunkel 1.1 75 #set($form_start = {
Jip-jan Alunkel 1.5 76 "id": "homeopaths_form",
77 "product": "homeopath details",
Jip-jan Alunkel 1.1 78 "method": "post",
79 "url": "",
80 "use_captcha": "false"
81 })
Jip-jan Alunkel 1.23 82 #set($thisObj = {})
Jip-jan Alunkel 1.32 83 #set($children = {})
Jip-jan Alunkel 1.68 84 #set($nonChildren = {})
Jip-jan Alunkel 1.37 85 #foreach($item in $classProperties.keySet())
Jip-jan Alunkel 1.70 86 #if($classProperties[$item].opener == 1)
Jip-jan Alunkel 1.57 87 #set($parentID = $classProperties[$item].parent)
Jip-jan Alunkel 1.58 88 #if(!$children[$parentID])
Jip-jan Alunkel 1.55 89 #set($discard = $children.put("$parentID", {}))
90 #end
Jip-jan Alunkel 1.53 91 #set($discard = $children["$parentID"].put($item, $classProperties[$item]))
Jip-jan Alunkel 1.69 92 #elseif($classProperties[$item].parent)## ???? Ws fout
Jip-jan Alunkel 1.68 93 #else
94 #set($discard = $nonChildren.put($item, $classProperties[$item]))
Jip-jan Alunkel 1.32 95 #end
96 #end
Jip-jan Alunkel 1.69 97 #createElementObjects($nonChildren)
Jip-jan Alunkel 1.1 98 #set($submit = {
99 "id" : "edit_details",
100 "button-text" : "Save changes",
101 "clean": "true",
102 "help-block" : ""
103 })
104 #set($form_end = {
105 "use_captcha": "false"
106 })
107 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
108 <div class="modal-dialog modal-dialog-centered" role="document">
109 <div class="modal-content">
110 #createFormStart($form_start)
111 <div class="modal-header">
112 <h3 class="modal-title">Details</h3>
113 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
114 <span aria-hidden="true">&times;</span>
115 </button>
116 </div>
117 <div class="modal-body">
Jip-jan Alunkel 1.23 118 #foreach($obj in $thisObj)
Jip-jan Alunkel 1.63 119 #createFormElement($obj)
Jip-jan Alunkel 1.23 120 #end
Jip-jan Alunkel 1.1 121 </div>
122 <div class="modal-footer">
123 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
124 #createSubmit($submit)
125 </div>
126 #createFormEnd($form_end)
127 </div>
128 </div>
129 </div>
130 #end
Jip-jan Alunkel 1.7 131 #else
132 This page can not be viewed in inline mode.
Jip-jan Alunkel 1.1 133 #end
Jip-jan Alunkel 1.60 134
135 #macro(createElementObjects $properties)
136 #foreach($item in $properties.keySet())
137 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
138 #if($theDocObj.getProperty($item))
139 #set($value = $theDocObj.getProperty($item).value)
140 #set($newElem = {
141 "id" : "$item",
142 "type" : $classProperties[$item].type,
143 "required" : "false",
144 "label" : "$label",
145 "data-create-xobj" : "true",
146 "data-xobj-classname" : $theClass,
147 "data-xobj-fieldname" : "$item",
148 "value" : "$value"
149 })
150 #if($classProperties[$item].opener == 1)
151 #set($discard = $newElem.put("data-opener", "true"))
152 #end
153 #if($classProperties[$item].extraAttributes)
154 #set($attrMap = $classProperties[$item].extraAttributes)
155 #foreach($attr in $attrMap.keySet())
156 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
157 #end
158 #end
159 #set($thisObj["$item"] = $newElem)
160 #end
161 #end
162 #end
163
Jip-jan Alunkel 1.1 164 {{/html}}
165 {{/velocity}}