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

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

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