Wiki source code of Profile of XWikiUserSheet

Last modified by Vincent Massol on 2024/03/09 19:11

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 #set($isMyProfile = ($services.model.resolveDocument($xcontext.user) == $doc.documentReference))
69 {{attachmentSelector classname="XWiki.XWikiUsers" object="$obj.number" property="avatar" #if ($isMyProfile) 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"/}}
70 #end
71 )))
72 ##########
73 ## Menu
74 ##########
75 (% id="user-vertical-menu" %)
76 (((
77 #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'})
78 )))
79 )))
80 #########################
81 ## Display the page content
82 #########################
83 (% id="user-page-content" %)
84 (((
85 #foreach($category in $userMenu)
86 #foreach($subcategory in $category.get('children'))
87 #set($tabKey = $subcategory.get('id'))
88 (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %)
89 (((
90 {{html}}$services.rendering.render($subcategory.uix.execute(), 'html/5.0'){{/html}}
91 )))
92 #end
93 #end
94 )))
95 #########################
96 ## END
97 #########################
98 {{html clean="false"}}
99 #if($xcontext.action == 'edit' || $xcontext.action == 'inline')
100 <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" />
101 #end
102 <div class="clearfloats">&nbsp;</div>
103 {{/html}}
104 {{/velocity}}