Wiki source code of SearchSuggestSourceSheet
Last modified by admin admin on 2024/07/23 01:12
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{velocity}} |
| 2 | #set ($className = 'XWiki.SearchSuggestSourceClass') | ||
| 3 | #set ($class = $xwiki.getDocument($className).xWikiClass) | ||
| 4 | #if (!$object && "$!request.xobjectNumber" != '') | ||
| 5 | #set ($object = $doc.getObject($className, $numbertool.toNumber($request.xobjectNumber).intValue())) | ||
| 6 | #end | ||
| 7 | #if (!$object) | ||
| 8 | #set ($object = $doc.getObject($className, true)) | ||
| 9 | #end | ||
| 10 | #set ($discard = $doc.use($object)) | ||
| 11 | #set ($prefix = "${className}_${object.number}_") | ||
| 12 | ## We include the 'get' action because we use it when adding a new search suggest source through AJAX. | ||
| 13 | #set ($editing = $xcontext.action == 'admin' || $xcontext.action == 'edit' || $xcontext.action == 'inline' || $xcontext.action == 'get') | ||
| 14 | (% class="xform" %)((( | ||
| 15 | #foreach ($property in $class.properties) | ||
| 16 | #set ($displayFormType = $property.getProperty('displayFormType')) | ||
| 17 | #set ($isCheckbox = $editing && $property.classType == 'Boolean' && (!$displayFormType || $displayFormType.value == 'checkbox')) | ||
| 18 | ; {{html wiki="true"}} | ||
| 19 | #if ($isCheckbox) | ||
| 20 | $doc.display($property.name, 'edit', $object) | ||
| 21 | #end | ||
| 22 | ## $object is not hard typed to be an object, it's also sometimes a map, henceforth the weird looking condition on | ||
| 23 | ## this next line. Detailed explanations => https://github.com/xwiki/xwiki-platform/pull/2816#discussion_r1489621617 | ||
| 24 | <label#if ($editing && $object!={}) for="${prefix}$property.name"#end> | ||
| 25 | $property.translatedPrettyName | ||
| 26 | </label> | ||
| 27 | {{/html}}## | ||
| 28 | #set ($hintKey = "${className}_${property.name}.hint") | ||
| 29 | #if ($services.localization.get($hintKey)) | ||
| 30 | (% class="xHint" %){{translation key="$hintKey"/}}## | ||
| 31 | #end | ||
| 32 | |||
| 33 | #if (!$isCheckbox) | ||
| 34 | : #if ($editing) | ||
| 35 | $doc.display($property.name, 'edit') | ||
| 36 | #else | ||
| 37 | $services.rendering.escape($!object.getProperty($property.name).value, 'xwiki/2.1') | ||
| 38 | #end | ||
| 39 | #else | ||
| 40 | : (% class='hidden' %) | ||
| 41 | #end | ||
| 42 | #end | ||
| 43 | ))) | ||
| 44 | {{/velocity}} |