Código fuente wiki de homeopathsSheet

Versión 1.153 por Jip-jan Alunkel el marzo 08, 18:56

Ocultar los últimos autores
Jip-jan Alunkel 1.1 1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
Jip-jan Alunkel 1.137 4 #set($discard = $services.localization.use('document', 'assets.global.translations'))
Jip-jan Alunkel 1.1 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 = [
Jip-jan Alunkel 1.82 37 {'practiceName': {'type': 'text'}},
Jip-jan Alunkel 1.141 38 {'pmAddress': {'type': 'address', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "data-auto-first-capital": "true", "data-query-type": "address", "data-query-reference": "", "data-query-list-type": "suggest-select", "data-query-list-header": "$services.localization.render('pagemaker.line.suggest_select_list')", "data-query-list-contents": "value/key", "data-query-list-editable": "false", "data-create-xobj": "true", "data-xobj-classname": "homeopaths.Code.homeopathsClass", "help-block" : 'Input street and number, then select the address of your practice.'}}},
Jip-jan Alunkel 1.124 39 {'pmStreet': {'type': 'text'}},
Jip-jan Alunkel 1.115 40 {'pmHousenumber': {'type': 'text'}},
Jip-jan Alunkel 1.82 41 {'pmPostcode': {'type': 'text'}},
42 {'pmCity': {'type': 'text'}},
Jip-jan Alunkel 1.115 43 {'pmCounty': {'type': 'text'}},
Jip-jan Alunkel 1.82 44 {'pmState': {'type': 'text'}},
45 {'pmCountry': {'type': 'text'}},
Jip-jan Alunkel 1.70 46 {'certification': {'type': 'checkbox', 'opener': 1}},
Jip-jan Alunkel 1.82 47 {'certificationFrom': {'type': 'text', 'parent': 'certification'}}
Jip-jan Alunkel 1.70 48 ])
Jip-jan Alunkel 1.90 49
50 #if($hasRight)
51 <p class="buttons text-align-right">
52 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
53 <span class="btn-label">Edit details</span>
54 </a>
55 </p>
56 #end
57 </div>
58 #if($hasRight)
59 #set($form_start = {
60 "id": "homeopaths_form",
61 "product": "homeopath details",
62 "method": "post",
63 "url": "",
64 "use_captcha": "false"
65 })
Jip-jan Alunkel 1.109 66 #set($submit = {
67 "id" : "edit_details",
68 "button-text" : "Save changes",
69 "clean": "true",
70 "help-block" : ""
71 })
72 #set($form_end = {
73 "use_captcha": "false"
74 })
75 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
76 <div class="modal-dialog modal-dialog-centered" role="document">
77 <div class="modal-content">
78 #createFormStart($form_start)
79 <div class="modal-header">
80 <h3 class="modal-title">Details</h3>
81 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
82 <span aria-hidden="true">&times;</span>
83 </button>
84 </div>
85 <div class="modal-body">
Jip-jan Alunkel 1.85 86 #set($lastChild = "")
Jip-jan Alunkel 1.70 87 #foreach($property in $classProperties)
Jip-jan Alunkel 1.84 88 #foreach($item in $property.keySet())
89 #set($key = $item)
90 #end
Jip-jan Alunkel 1.79 91 #foreach($item in $property.values())
Jip-jan Alunkel 1.81 92 #set($propertyType = $item.type)
93 #set($propertyOpener = $item.opener)
94 #set($propertyParent = $item.parent)
Jip-jan Alunkel 1.85 95 #set($extraAttributes = $item.extraAttributes)
Jip-jan Alunkel 1.74 96 #end
Jip-jan Alunkel 1.85 97 #set($label = $services.localization.render("homeopaths.classproperty.${key}"))
Jip-jan Alunkel 1.133 98 #if($theDocObj.getProperty($key) || $propertyType == "address")
Jip-jan Alunkel 1.102 99 #set($value = $theDocObj.getProperty($key).value)
Jip-jan Alunkel 1.144 100 #if(!$value)
Jip-jan Alunkel 1.153 101 $propertyType
Jip-jan Alunkel 1.144 102 #if($propertyType == "checkbox" || $propertyType == "radio")
Jip-jan Alunkel 1.145 103 #set($value = "1")
Jip-jan Alunkel 1.151 104 $propertyType - $value
Jip-jan Alunkel 1.144 105 #else
106 #set($value = "")
107 #end
Jip-jan Alunkel 1.94 108 #end
Jip-jan Alunkel 1.85 109 #set($newElem = {
110 "id" : "$key",
Jip-jan Alunkel 1.86 111 "type" : $propertyType,
Jip-jan Alunkel 1.85 112 "required" : "false",
113 "label" : "$label",
114 "data-create-xobj" : "true",
115 "data-xobj-classname" : $theClass,
116 "data-xobj-fieldname" : "$key",
117 "value" : "$value"
118 })
Jip-jan Alunkel 1.130 119 #if($extraAttributes.keySet().size() > 0)
Jip-jan Alunkel 1.85 120 #set($attrMap = $extraAttributes)
121 #foreach($attr in $attrMap.keySet())
122 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
123 #end
124 #end
125 #if($propertyOpener)
126 #set($discard = $newElem.put("data-opener", "true"))
127 #end
128 #if($propertyParent)
Jip-jan Alunkel 1.114 129 #set($lastChild = "$key")
Jip-jan Alunkel 1.85 130 #elseif($lastChild != "")
Jip-jan Alunkel 1.110 131 #set($lastChild = "")
Jip-jan Alunkel 1.116 132 #createExpandEnd()
Jip-jan Alunkel 1.85 133 #end
Jip-jan Alunkel 1.109 134 #createFormElement($newElem)
Jip-jan Alunkel 1.85 135 #if($propertyOpener)
Jip-jan Alunkel 1.152 136 ##$value
Jip-jan Alunkel 1.147 137 #createExpandStart($newElem $value)
Jip-jan Alunkel 1.85 138 #end
139 #end
Jip-jan Alunkel 1.12 140 #end
Jip-jan Alunkel 1.1 141 </div>
142 <div class="modal-footer">
143 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
144 #createSubmit($submit)
145 </div>
146 #createFormEnd($form_end)
147 </div>
148 </div>
149 </div>
150 #end
Jip-jan Alunkel 1.7 151 #else
152 This page can not be viewed in inline mode.
Jip-jan Alunkel 1.1 153 #end
Jip-jan Alunkel 1.60 154
Jip-jan Alunkel 1.120 155 #macro(createElementObjects $properties)
Jip-jan Alunkel 1.60 156 #foreach($item in $properties.keySet())
157 #set($label = $services.localization.render("homeopaths.classproperty.${item}"))
158 #if($theDocObj.getProperty($item))
159 #set($value = $theDocObj.getProperty($item).value)
160 #set($newElem = {
161 "id" : "$item",
162 "type" : $classProperties[$item].type,
163 "required" : "false",
164 "label" : "$label",
165 "data-create-xobj" : "true",
166 "data-xobj-classname" : $theClass,
167 "data-xobj-fieldname" : "$item",
168 "value" : "$value"
169 })
170 #if($classProperties[$item].opener == 1)
171 #set($discard = $newElem.put("data-opener", "true"))
172 #end
173 #if($classProperties[$item].extraAttributes)
174 #set($attrMap = $classProperties[$item].extraAttributes)
175 #foreach($attr in $attrMap.keySet())
176 #set($discard = $newElem.put("$attr", $attrMap[$attr]))
177 #end
178 #end
179 #set($thisObj["$item"] = $newElem)
180 #end
181 #end
182 #end
183
Jip-jan Alunkel 1.1 184 {{/html}}
185 {{/velocity}}