Исходный код вики homeopathsSheet

Версия 3.149 от Jip-jan Alunkel на марта 11, 14:34

Последние авторы
1 {{include reference="assets.pagemaker.macros"/}}
2
3 {{velocity}}
4 #set($discard = $services.localization.use('document', 'assets.global.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($subjectReference = $services.model.resolveDocument('', 'default', $doc.documentReference.lastSpaceReference).parent.parent)
10 #set($subjectTitle = $subjectReference.getName())
11
12 ##
13 #set($theClass = "")
14 #set($docObjects = $doc.getxWikiObjects())
15 #foreach($docObjectKey in $docObjects.keySet())
16 #if($docObjectKey.indexOf($subjectTitle) == 0)
17 #set($theDocObj = $docObjects[$docObjectKey][0])
18 #set($theClass = $docObjectKey)
19 #end
20 #end
21 #set($isInline = $xcontext.action == 'edit' && $request.get('editor') == 'inline')
22 ##set($theClass = "homeopaths.Code.homeopathsClass")
23 ## Create object (important for sheet binding, do not remove)
24 ##set($theDocObj = $doc.getObject($theClass, true))
25 #set($hasRight = !$isGuest && ($theDocObj.getProperty('doc_owner').value == $context.getUser() || $hasAdmin))
26 $theDoc.getContent()
27 {{html wiki="true" clean="false"}}
28 #if(!$isGuest)
29 <script>
30 var pmMenuCreate = "disable";
31 </script>
32 #end
33 #if($hasRight)
34 <p class="buttons text-align-right">
35 <a class="btn btn-primary" title="Edit" href="$doc.getURL("edit")?editor=wysiwyg" role="button" rel="nofollow">
36 <span class="fa fa-pencil"></span>
37 <span class="btn-label">Edit content</span>
38 </a>
39 </p>
40 #end
41 <div class="clearfix"></div>
42 #if($xcontext.action == "view")
43 <h2 class="inline-data-summary">$services.localization.render("homeopaths.inlineDataSummary.sheet_properties")</h2>
44 <div id="${subjectTitle}" class="sheet_properties inline-data-summary">
45 ## ADDRESS: Prepare object to provide hidden values to the address input
46 #set($xa = {'pmLatlong': '','pmCountry': '','pmState': '','pmCounty': '','pmPostcode': '','pmCity': '','pmStreet': '','pmHousenumber': ''})
47 #foreach($item in $xa.keySet())
48 #if($theDocObj.getProperty("$item"))
49 #set($xa["$item"] = $theDocObj.getProperty("$item").value)
50 #end
51 #end
52 ## The classProperties Map has to be in the order of how you want the form elements to appear in the form.
53 ## disabled = Will not show up as input/select/textarea in the form.
54 #set($classProperties = {
55 'editAddress': {'type': 'checkbox', 'opener': 1, 'classless': 1, 'extraAttributes': {"data-checked": "false"}},
56 'pmAddress': {'type': 'address', 'parent': 'editAddress', 'extraAttributes': {"aria-label": "Input and select the address of your practice", "placeholder": "$services.localization.render('homeopaths.multiword.address.placeholder')", "pmLatlong": "$xa['pmLatlong']", "pmCountry": "$xa['pmCountry']", "pmState": "$xa['pmState']", "pmCounty": "$xa['pmCounty']", "pmPostcode": "$xa['pmPostcode']", "pmCity": "$xa['pmCity']", "pmStreet": "$xa['pmStreet']", "pmHousenumber": "$xa['pmHousenumber']", "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.'}},
57 'practiceName': {'type': 'text', 'disabled': 1, 'extraAttributes': {"disabled": "disabled", "help-block" : 'The name of your practice is the title of this page. If you want to change it, you should edit the content of this page.'}},
58 'pmStreet': {'type': 'text', 'disabled': 1},
59 'pmHousenumber': {'type': 'text', 'disabled': 1},
60 'pmPostcode': {'type': 'text', 'disabled': 1},
61 'pmCity': {'type': 'text', 'disabled': 1},
62 'pmCounty': {'type': 'text', 'disabled': 1},
63 'pmState': {'type': 'text', 'disabled': 1},
64 'pmCountry': {'type': 'text', 'disabled': 1},
65 'nrOfHomeopaths': {'type': 'number'},
66 'certification': {'type': 'checkbox', 'opener': 1},
67 'certificationFrom': {'type': 'text', 'parent': 'certification'}
68 })
69 #createAddress($theClass 1)
70 #set($properties = ['nrOfHomeopaths','certification','certificationFrom'])
71 #foreach($property in $properties)
72 #if($theDocObj.getProperty($property))
73 <p class="property">
74 <span class="property-name">$services.localization.render("homeopaths.classproperty.${property}")</span> <span class="property-value">$doc.display($property)</span>
75 </p>
76 #end
77 #end
78 #if($hasRight)
79 <p class="buttons text-align-right">
80 <a class="btn btn-secondary" title="Edit" data-toggle="modal" data-target="#detailsModal" role="button" rel="nofollow">
81 <span class="btn-label">Edit details</span>
82 </a>
83 </p>
84 #end
85 </div>
86 #if($hasRight)
87 #set($form_start = {
88 "id": "homeopaths_form",
89 "product": "homeopath details",
90 "method": "post",
91 "url": "",
92 "use_captcha": "false"
93 })
94 #set($submit = {
95 "id" : "edit_details",
96 "button-text" : "Save changes",
97 "clean": "true",
98 "help-block" : ""
99 })
100 #set($form_end = {
101 "use_captcha": "false"
102 })
103 <div class="modal fade" id="detailsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
104 <div class="modal-dialog modal-dialog-centered" role="document">
105 <div class="modal-content">
106 #createFormStart($form_start)
107 <div class="modal-header">
108 <h3 class="modal-title">Details</h3>
109 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
110 <span aria-hidden="true">&times;</span>
111 </button>
112 </div>
113 <div class="modal-body">
114 #createAddress($theClass 1)
115 #set($lastChild = "")
116 #foreach($propertyName in $classProperties.keySet())
117 #set($value = "")
118 #set($item = $classProperties["$propertyName"])
119 #if(!$item.containsKey("disabled"))
120 #set($checkBool = ["false","true"])
121 #if(!$item.containsKey("classless") && $theDocObj.getProperty($propertyName))
122 #set($value = $theDocObj.getProperty($propertyName).value)
123 #if($item.type == "checkbox")
124 #set($item.extraAttributes["data-checked"] = "$checkBool[$value]")
125 #end
126 #else
127 #if($item.type == "checkbox")
128 #set($value = "1")
129 #if(!$item.extraAttributes.containsKey("data-checked"))
130 #set($item.extraAttributes["data-checked"] = "$checkBool[0]")
131 #end
132 #end
133 #end
134 #set($label = $services.localization.render("homeopaths.classproperty.${propertyName}"))
135 #if($item.containsKey("classless"))
136 #set($newElem = {
137 "id" : "$propertyName",
138 "type" : $item.type,
139 "required" : "false",
140 "label" : "$label",
141 "value" : "$value"
142 })
143 #else
144 #set($newElem = {
145 "id" : "$propertyName",
146 "type" : $item.type,
147 "required" : "false",
148 "label" : "$label",
149 "data-create-xobj" : "true",
150 "data-xobj-classname" : $theClass,
151 "data-xobj-fieldname" : "$propertyName",
152 "value" : "$value"
153 })
154 #end
155 #if($item.extraAttributes.keySet().size() > 0)
156 #foreach($attr in $item.extraAttributes.keySet())
157 #set($discard = $newElem.put("$attr", $item.extraAttributes[$attr]))
158 #end
159 #end
160 #if($item.opener)
161 #set($discard = $newElem.put("data-opener", "true"))
162 #end
163 #if($item.parent)
164 #set($lastChild = "$key")
165 #elseif($lastChild != "")
166 #set($lastChild = "")
167 #createExpandEnd()
168 #end
169 #createFormElement($newElem)
170 #if($item.opener)
171 #createExpandStart($newElem $value)
172 #end
173 #end
174 #end
175 </div>
176 <div class="modal-footer">
177 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
178 #createSubmit($submit)
179 </div>
180 #createFormEnd($form_end)
181 </div>
182 </div>
183 </div>
184 #end
185 #else
186 <p>
187 This page can not be viewed in inline mode. [[Back>>$doc.fullName]]
188 </p>
189 #end
190 #macro(createAddress $className $withLabel)
191 #set($docObj = $doc.getObject($className))
192 #set($addressArray = ['pmStreet','pmHousenumber','pmPostcode','pmCity','pmState','pmCounty','pmCountry'])
193 #set($x = {})
194 #foreach($datapart in $addressArray)
195 #if($docObj.getProperty($datapart))
196 #set($datapart4Publish = $docObj.getProperty($datapart).value)
197 #if($datapart == 'pmCountry')
198 #set($datapart4Publish = $datapart4Publish.toUpperCase())
199 #end
200 #set($discard = $x.put("$datapart", $datapart4Publish))
201 #end
202 #end
203 <div class="formElement">
204 #if($withLabel)
205 <label>$services.localization.render("homeopaths.classproperty.pmAddress")</label>
206 #end
207 <address>
208 $doc.getTitle()<br />
209 $x['pmStreet'] $x['pmHousenumber']<br />
210 $x['pmPostcode'] $x['pmCity']<br />
211 $x['pmCounty'] $x['pmState']<br />
212 $x['pmCountry']
213 </address>
214 </div>
215 #end
216
217 {{/html}}
218 {{/velocity}}