Wiki source code of Profile of XWikiUserSheet

Last modified by Ludovic Dubost on 2024/07/22 15:51

Show last authors
1 {{velocity}}
2 #########################
3 ## CSS & Javascripts
4 #########################
5 #set($discard = $xwiki.ssx.use("XWiki.XWikiUserSheet"))
6 #set($discard = $xwiki.jsx.use("XWiki.XWikiUserSheet"))
7 #########################
8 ## Setting categories
9 #########################
10 #set($categories = [])
11
12 ## load the user menu from the 'org.xwiki.plaftorm.user.profile.menu' UIXP.
13 #foreach ($uix in $services.uix.getExtensions('org.xwiki.plaftorm.user.profile.menu', {'sortByParameter': 'priority'}))
14 #if(!$uix.parameters.containsKey('isActive') || $uix.parameters.get('isActive') != 'false')
15 #if (!$uix.parameters.containsKey('id'))
16 ## when no id is explicitly provided, we use the id of the UIX.
17 #set ($discard = $uix.parameters.put('id', $uix.id))
18 #end
19 #if ($uix.parameters.containsKey('icon'))
20 #set ($discard = $uix.parameters.put('glyphicon', $uix.parameters.get('icon')))
21 #end
22 #set ($discard = $uix.parameters.put('uix', $uix))
23 #set($discard = $categories.add($uix.parameters))
24 #end
25 #end
26 #########################
27 ## Current category
28 #########################
29 #set($currentCategory = "$!request.category")
30 #if($currentCategory == "")
31 #set($currentCategory = $categories[0].get('id'))
32 #end
33 #########################
34 ## Creating vertical menu
35 #########################
36 #set($userMenu = [{
37 'id' : 'settings',
38 'cssClass' : 'user-menu-title',
39 'children' : $categories
40 }
41 ])
42 ## Setting automaticaly url & css fields of each category
43 #foreach($category in $userMenu)
44 #foreach($subcategory in $category.get('children'))
45 #set($id = $subcategory.get('id'))
46 #set($discard = $subcategory.put('url', "?category=${id}"))
47 #set($discard = $subcategory.put('cssClass', "user-menu-$id category-tab"))
48 #end
49 #end
50 #########################
51 ## Display the left menu
52 #########################
53 (% id="user-menu-col" %)
54 (((
55 ############
56 ## Avatar
57 ############
58 (% id="avatar" %)
59 (((
60 #if($request.xpage == 'edituser')
61 {{html clean="false"}}
62 #resizedUserAvatar($doc.fullName 180)
63 {{/html}}
64 #else
65 ## By specifying the image width we enable server side resizing. The width value we use is greater than the
66 ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the
67 ## image in the available space).
68 {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($hasEdit) savemode="direct" #end defaultValue="XWiki.XWikiUserSheet@noavatar.png" width="180" alternateText="$xwiki.getUserName($doc.fullName, false)" buttontext="$services.localization.render('platform.core.profile.changePhoto')" displayImage="true" filter="png,jpg,jpeg,gif"/}}
69 #end
70 )))
71 ##########
72 ## Menu
73 ##########
74 (% id="user-vertical-menu" %)
75 (((
76 #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'})
77 )))
78 )))
79 #########################
80 ## Display the page content
81 #########################
82 (% id="user-page-content" %)
83 (((
84 #foreach($category in $userMenu)
85 #foreach($subcategory in $category.get('children'))
86 #set($tabKey = $subcategory.get('id'))
87 (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %)
88 (((
89 {{html}}$services.rendering.render($subcategory.uix.execute(), 'html/5.0'){{/html}}
90 )))
91 #end
92 #end
93 )))
94 #########################
95 ## END
96 #########################
97 {{html clean="false"}}
98 #if($xcontext.action == 'edit' || $xcontext.action == 'inline')
99 <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" />
100 #end
101 <div class="clearfloats">&nbsp;</div>
102 {{/html}}
103 {{/velocity}}