From version < 3.1 >
edited by Vincent Massol
on 2014/10/21 16:44
To version 1.1 >
edited by Marius Dumitru Florea
on 2013/07/15 09:44
>
Change comment: Copied from playgroundtemplate:Main.UserDirectory

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.VincentMassol
1 +xwiki:XWiki.mflorea
Content
... ... @@ -9,7 +9,7 @@
9 9  #set ($fakeUser = false)
10 10  ##
11 11  ## Set the fixed columns that we want the user directory to always show.
12 -#set ($columns = ['_avatar', 'doc.name'])
12 +#set ($columns = ['_avatar', 'doc.fullName'])
13 13  ##
14 14  ## The columns that the user directory will default to when no user preferences exist or when the user resets to default.
15 15  #set ($defaultColumns = ['first_name', 'last_name'])
... ... @@ -83,7 +83,7 @@
83 83   {{html clean='false' wiki='true'}}
84 84   <form class='xform half' action="$doc.getURL($xcontext.action, $request.queryString)" method='post'>
85 85   <dl>
86 - <dt>
86 + <dt class='label'>
87 87   <label>{{translation key="xe.userdirectory.customizeAvailableColumnsLabel"/}}</label>
88 88   <span class='xHint'>{{translation key="xe.userdirectory.customizeAvailableColumnsHint"/}}</span>
89 89   </dt>
... ... @@ -150,7 +150,7 @@
150 150   #set ($html = true)
151 151   #set ($sortable = false)
152 152   #set ($link = 'view')
153 - #elseif ($column == 'doc.name')
153 + #elseif ($column == 'doc.fullName')
154 154   #set ($link = 'view')
155 155   #elseif ($classPropertyType.endsWith('ListClass'))
156 156   #set($type = 'list')
... ... @@ -158,8 +158,6 @@
158 158   #set($type = 'number')
159 159   #elseif ($classPropertyType.endsWith('PasswordClass'))
160 160   #set($sortable = false)
161 - #elseif ($classPropertyType.endsWith('TextAreaClass') || $classPropertyType.endsWith('EmailClass'))
162 - #set($html = true)
163 163   #end
164 164   #set ($columnValue = { 'type' : $type, 'link' : $link, 'html' : $html, 'sortable' : $sortable, 'displayName' : $displayName })
165 165   #set ($discard = $columnsProperties.put($column, $columnValue))
... ... @@ -171,46 +171,12 @@
171 171   ## If no override is present, use the default data source.
172 172   #set ($userDirectoryLivetableResultsReference = $services.model.createDocumentReference($xcontext.database, 'XWiki', 'UserDirectoryLivetableResults'))
173 173  #end
174 -## Note that we specify the class name even though we use a custom results page (which hard-codes it) because the class
175 -## name is needed by the live table filters, to have a proper drop down list for Static List fields for instance
176 -## (see XWIKI-9660).
177 177  #set ($options = {
178 - 'className': $services.model.serialize($xwikiUsersClassReference, 'local'),
179 179   'resultPage' : "$services.model.serialize($userDirectoryLivetableResultsReference)",
180 180   'translationPrefix' : 'xe.userdirectory.',
181 181   'tagCloud' : true,
182 182   'rowCount': 10
183 183  })
184 -## Add a filter for subwikis
185 -#if ($xcontext.database != $xcontext.mainWikiName && "$!services.wiki" != '' && "$!services.wiki.user" != '')
186 - #set($userScope = $services.wiki.user.getUserScope($services.wiki.currentWikiId))
187 - #if ($userScope == 'GLOBAL_ONLY')
188 - #set($discard = $options.put('extraParams', 'userScope=global'))
189 - #else
190 - #set($discard = $options.put('extraParams', 'userScope=local'))
191 - #end
192 - #if ($userScope == 'LOCAL_AND_GLOBAL')
193 - #set($discard = $xwiki.jsx.use('Main.UserDirectory'))
194 -
195 - {{html}}
196 - <form class="xform third" action="">
197 - <dl>
198 - <dt>
199 - <label for="userScopeFilter">$services.localization.render('userdirectory.userScopeFilter')</label>
200 - <span class="xHint">$services.localization.render('userdirectory.userScopeFilter.hint')</span>
201 - </dt>
202 - <dd>
203 - <select name="userScope" id="userScopeFilter">
204 - <option value="local">$services.localization.render('userdirectory.userScopeFilter.local')</option>
205 - <option value="global">$services.localization.render('userdirectory.userScopeFilter.global')</option>
206 - </select>
207 - </dd>
208 - </dl>
209 - </form>
210 - {{/html}}
211 -
212 - #end
213 -#end
214 214  #livetable('userdirectory' $columns $columnsProperties $options)
215 215  ##
216 216  ## Clean up any existing fake user from the current in-memory document to avoid side-effects
XWiki.JavaScriptExtension[0]
Caching policy
... ... @@ -1,1 +1,0 @@
1 -long
Code
... ... @@ -1,41 +1,0 @@
1 -(function(){
2 -
3 - /**
4 - * Init
5 - */
6 - function init() {
7 - var userScope = $('userScopeFilter');
8 - if (userScope === null) {
9 - // Nothing to do
10 - return;
11 - }
12 - userScope.observe('change', onUserScopeChange);
13 - }
14 -
15 - function onUserScopeChange(event) {
16 - var value = $('userScopeFilter').value;
17 - var livetable = window["livetable_userdirectory"];
18 - var url = livetable.getUrl;
19 - if (url.search("userScope=") >= 0) {
20 - // Replace the old value
21 - if (value == 'local') {
22 - url = url.replace("userScope=global", "userScope=local");
23 - } else {
24 - url = url.replace("userScope=local", "userScope=global");
25 - }
26 - } else {
27 - url = url + "&userScope=" + value;
28 - }
29 - livetable.getUrl = url;
30 - // Reload the livetable
31 - livetable.clearCache();
32 - livetable.showRows(1, livetable.limit);
33 - }
34 -
35 - /**
36 - * Call Init
37 - */
38 - (XWiki && XWiki.domIsLoaded && init()) || document.observe("xwiki:dom:loaded", init);
39 -
40 -})();
41 -
Name
... ... @@ -1,1 +1,0 @@
1 -Dynamic filter for user scope
Parse content
... ... @@ -1,1 +1,0 @@
1 -0
Use this extension
... ... @@ -1,1 +1,0 @@
1 -onDemand
14.4.6-node2