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

Редактировал(а) Alexey Semenihin 23.10.2026, 15:12

Последние авторы
1 {{template name="hierarchy_macros.vm" /}}
2
3 {{velocity output="false"}}
4 #set ($isEditing = $xcontext.action == 'edit')
5
6 #macro (displayPropertyValue $property $action)
7 #if ($action)
8 #set ($output = $doc.display($property, $action))
9 #else
10 #set ($output = $doc.display($property))
11 #end
12 #unwrapXPropertyDisplay($output)
13 #end
14
15 #macro (displayPathsPropertyValue $property)
16 <ul class="paths">
17 #set ($hierarchyOptions = {
18 'local': true,
19 'selfIsActive': false
20 })
21 #set ($paths = $doc.getValue($property))
22 #foreach ($path in $paths)
23 <li class="path">
24 #if ($isEditing)
25 <a href="#path-delete" class="path-delete">$services.icon.renderHTML('delete')</a>
26 <input type="hidden" name="XWiki.TemplateProviderClass_0_$property"
27 value="$escapetool.xml($path)" />
28 #end
29 #set ($spaceReference = $services.model.resolveSpace($path))
30 #hierarchy($spaceReference $hierarchyOptions)
31 </li>
32 #end
33 #if ($isEditing)
34 ## This is used as a template on the client side when a new path is added.
35 <li class="path hidden">
36 #set ($label = $escapetool.xml($services.localization.render("administration.templateProvider.${property}.remove")))
37 <button type="button" class="btn btn-xs btn-link path-delete" title="$label"
38 ><span class="sr-only">$label</span
39 >$services.icon.renderHTML('delete')</button>
40 <input type="hidden" name="XWiki.TemplateProviderClass_0_$property" disabled="disabled" />
41 <ol class="breadcrumb">
42 <li class="loading"></li>
43 </ol>
44 </li>
45 <li class="path-add">
46 <input type="hidden" name="XWiki.TemplateProviderClass_0_$property" value="" />
47 #set ($label = $escapetool.xml($services.localization.render("administration.templateProvider.${property}.add")))
48 <button type="button" class="btn btn-xs btn-link path-add" title="$label"
49 ><span class="sr-only">$label</span
50 >$services.icon.renderHTML('add')</button>
51 </li>
52 #end
53 </ul>
54 #end
55
56 #macro (locationPickerModal)
57 <div class="location-picker modal fade" tabindex="-1" role="dialog" data-backdrop="static">
58 <div class="modal-dialog" role="document">
59 <div class="modal-content">
60 <div class="modal-header">
61 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
62 <span aria-hidden="true">&times;</span>
63 </button>
64 <div class="modal-title">$services.localization.render('core.documentPicker.title')</div>
65 </div>
66 <div class="modal-body">
67 #documentTree({
68 'class': 'location-tree',
69 'finder': true,
70 'showAttachments': false,
71 'showTerminalDocuments': false,
72 'showTranslations': false
73 })
74 </div>
75 <div class="modal-footer">
76 <button type="button" class="btn btn-default" data-dismiss="modal">
77 $services.localization.render('core.documentPicker.cancel')
78 </button>
79 <button type="button" class="btn btn-primary" disabled="disabled">
80 $services.localization.render('core.documentPicker.select')
81 </button>
82 </div>
83 </div>
84 </div>
85 </div>
86 #end
87 {{/velocity}}