Wiki-Quellcode von TemplateProviderMacros
Zuletzt geändert von admin am 2025/02/23 10:10
Verstecke letzte Bearbeiter
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 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 | <a href="#path-delete" class="path-delete">$services.icon.renderHTML('delete')</a> | ||
| 37 | <input type="hidden" name="XWiki.TemplateProviderClass_0_$property" disabled="disabled" /> | ||
| 38 | <ol class="breadcrumb"> | ||
| 39 | <li class="loading"></li> | ||
| 40 | </ol> | ||
| 41 | </li> | ||
| 42 | <li class="path-add"> | ||
| 43 | <input type="hidden" name="XWiki.TemplateProviderClass_0_$property" value="" /> | ||
| 44 | <a href="#path-add">$services.icon.renderHTML('add')</a> | ||
| 45 | </li> | ||
| 46 | #end | ||
| 47 | </ul> | ||
| 48 | #end | ||
| 49 | |||
| 50 | #macro (locationPickerModal) | ||
| 51 | <div class="location-picker modal fade" tabindex="-1" role="dialog" data-backdrop="static"> | ||
| 52 | <div class="modal-dialog" role="document"> | ||
| 53 | <div class="modal-content"> | ||
| 54 | <div class="modal-header"> | ||
| 55 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
| 56 | <span aria-hidden="true">×</span> | ||
| 57 | </button> | ||
| 58 | <div class="modal-title">$services.localization.render('core.documentPicker.title')</div> | ||
| 59 | </div> | ||
| 60 | <div class="modal-body"> | ||
| 61 | #documentTree({ | ||
| 62 | 'class': 'location-tree', | ||
| 63 | 'finder': true, | ||
| 64 | 'showAttachments': false, | ||
| 65 | 'showTerminalDocuments': false, | ||
| 66 | 'showTranslations': false | ||
| 67 | }) | ||
| 68 | </div> | ||
| 69 | <div class="modal-footer"> | ||
| 70 | <button type="button" class="btn btn-default" data-dismiss="modal"> | ||
| 71 | $services.localization.render('core.documentPicker.cancel') | ||
| 72 | </button> | ||
| 73 | <button type="button" class="btn btn-primary" disabled="disabled"> | ||
| 74 | $services.localization.render('core.documentPicker.select') | ||
| 75 | </button> | ||
| 76 | </div> | ||
| 77 | </div> | ||
| 78 | </div> | ||
| 79 | </div> | ||
| 80 | #end | ||
| 81 | {{/velocity}} |