Afficher les derniers auteurs
1 {{include reference="XWiki.SearchCode" /}}
2
3 {{velocity output="false"}}
4 #macro (displayObjectPropertyValue $propertyName $mode)
5 #set ($output = $doc.display($propertyName, $mode))
6 #set ($output = $stringtool.removeStart($output, '{{html clean="false" wiki="false"}}'))
7 #set ($output = $stringtool.removeEnd($output, '{{/html}}'))
8 $output
9 #end
10
11 #macro (displaySearchSuggestSource $source)
12 #set ($icon = $source.getProperty('icon').value)
13 #if ($icon.startsWith('icon:'))
14 #set ($icon = $xwiki.getSkinFile("icons/silk/${icon.substring(5)}.png"))
15 #else
16 ## Evaluate the Velocity code for backward compatibility.
17 #set ($icon = "#evaluate($icon)")
18 #end
19 #set ($name = $source.getProperty('name').value)
20 #if ($services.localization.get($name))
21 #set ($name = $services.localization.render($name))
22 #else
23 ## Evaluate the Velocity code for backward compatibility.
24 #set ($name = "#evaluate($name)")
25 #end
26 #set ($style = 'source-header')
27 #if ("$source.getProperty('activated').value" == '1')
28 #set ($style = "$style activated")
29 #end
30 #if ("$source.getProperty('highlight').value" == '1')
31 #set ($style = "$style highlighted")
32 #end
33 <li class="source">
34 <div class="$style">
35 <img class="icon" src="$!icon" alt="" />
36 <span class="limit">$!source.getProperty('resultsNumber').value</span>
37 <span class="name">$!name</span>
38 #if ($editing)
39 <div class="actions">
40 <a class="delete" href="$doc.getURL('objectremove', $escapetool.url({
41 'form_token': $services.csrf.token,
42 'classname': $searchSuggestSourceClassName,
43 'classid': $source.number,
44 'xredirect': $doc.getURL('edit')
45 }))">
46 $services.icon.renderHTML('cross')
47 </a>
48 </div>
49 #end
50 </div>
51 <div class="source-body hidden">
52 #set ($object = $source)
53 $sourceSheet.getRenderedContent().replace('{{', '&#123;&#123;')
54 </div>
55 </li>
56 #end
57 {{/velocity}}
58
59 {{velocity}}
60 {{html clean="false"}}
61 #set ($discard = $xwiki.ssx.use('XWiki.SearchSuggestConfigSheet'))
62 #set ($discard = $xwiki.jsx.use('XWiki.SearchSuggestConfigSheet'))
63 #set ($editing = $xcontext.action == 'admin' || $xcontext.action == 'edit' || $xcontext.action == 'inline')
64 #set ($mode = 'view')
65 #if ($editing)
66 #set ($mode = 'edit')
67 #end
68 #set($discard = $doc.use($doc.fullName))
69 <div class="xform">
70 <dl>
71 <dt>
72 <label#if ($editing) for="${doc.fullName}_0_activated"#end>
73 $doc.displayPrettyName('activated', false, false)
74 </label>
75 <span class="xHint">
76 $services.localization.render('XWiki.SearchSuggestConfig_activated.hint')
77 </span>
78 </dt>
79 <dd>#displayObjectPropertyValue('activated' $mode)</dd>
80 <dt>
81 <label>$services.localization.render('platform.search.suggestSources')</label>
82 <span class="xHint">$services.localization.render('platform.search.suggestSources.hint')</span>
83 </dt>
84 <dd>
85 #set ($searchSuggestSourceClassName = 'XWiki.SearchSuggestSourceClass')
86 ## Group sources by search engine.
87 #set ($sources = {})
88 #foreach ($source in $doc.getObjects($searchSuggestSourceClassName))
89 #set ($engine = $source.getProperty('engine').value)
90 #if ("$!engine" == '')
91 #set ($engine = 'solr')
92 #end
93 #set ($sourcesForEngine = $sources.get($engine))
94 #if (!$sourcesForEngine)
95 #set ($sourcesForEngine = [])
96 #set ($discard = $sources.put($engine, $sourcesForEngine))
97 #end
98 #set ($discard = $sourcesForEngine.add($source))
99 #end
100 ## Display the list of search engines.
101 #if ($sources.size() > 0)
102 <ul class="nav nav-tabs searchEngines" role="tablist">
103 #foreach ($engine in $collectiontool.sort($sources.keySet()))
104 <li#if ($engine == $searchEngine) class="active"#end role="presentation">
105 <a href="#${engine}SearchSuggestSources" aria-controls="${engine}SearchSuggestSources"
106 role="tab" data-toggle="tab">$engine</a>
107 </li>
108 #end
109 </ul>
110 #end
111 ## Display sources by search engine.
112 #set ($sourceSheet = $xwiki.getDocument('XWiki.SearchSuggestSourceSheet'))
113 <div class="tab-content">
114 #foreach ($engine in $sources.keySet())
115 ## We can't use the UL element as tab panel because we break the HTML validation tests: "Bad value 'tabpanel' for
116 ## attribute 'role' on element 'ul'". I don't understand the reason as there's no constraint on
117 ## https://www.w3.org/TR/2010/WD-wai-aria-20100916/roles#tabpanel .
118 <div class="tab-pane#if ($engine == $searchEngine) active#end" role="tabpanel" id="${engine}SearchSuggestSources">
119 <ul class="searchSuggestSources">
120 #foreach ($source in $sources.get($engine))
121 #displaySearchSuggestSource($source)
122 #end
123 </ul>
124 </div>
125 #end
126 </div>
127 #if ($editing)
128 <ul class="searchSuggestSourceTemplate hidden">
129 #displaySearchSuggestSource({})
130 </ul>
131 <a class="addSearchSuggestSource" href="$doc.getURL('objectadd', $escapetool.url({
132 'form_token': $services.csrf.token,
133 'classname': $searchSuggestSourceClassName,
134 'xredirect': $xwiki.relativeRequestURL
135 }))">
136 $services.localization.render('platform.search.suggestAddNewSource')
137 </a>
138 #end
139 </dd>## Sources
140 </dl>
141 </div>## xform
142 {{/html}}
143 {{/velocity}}
#getBlogDocument($space $blogDoc)
XWiki Enterprise 14.6 - Documentation