Version 7.1 by Ludovic Dubost on 2018/12/09 12:24
Show last authors
author | version | line-number | content |
---|---|---|---|
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 | #set($discard = $categories.add({'id':'profile', 'sheet':'XWiki.XWikiUserProfileSheet', 'glyphicon': 'user'})) | ||
12 | #set($isMyProfile = ($services.model.resolveDocument($xcontext.user) == $doc.documentReference)) | ||
13 | #if($isMyProfile || $hasAdmin) | ||
14 | #set($discard = $categories.add({'id':'preferences', 'sheet':'XWiki.XWikiUserPreferencesSheet', 'glyphicon': 'wrench'})) | ||
15 | #end | ||
16 | #set($discard = $categories.add({'id':'groups', 'sheet':'XWiki.XWikiUserMembershipSheet', 'glyphicon': 'group'})) | ||
17 | ## TODO: add APIs to be able to display users watchlists to admins | ||
18 | #if($isMyProfile && $hasWatch) | ||
19 | #set($discard = $categories.add({'id':'watchlist', 'sheet':'XWiki.XWikiUserWatchListSheet', 'glyphicon': 'eye'})) | ||
20 | #end | ||
21 | #if($isMyProfile) | ||
22 | #if ("$!services.notification.watch" != '' || $hasWatch) | ||
23 | #set($discard = $categories.add({'id':'network', 'sheet':'XWiki.XWikiUserNetworkSheet', 'glyphicon': 'world'})) | ||
24 | #end | ||
25 | ## TODO: add an enhancement system instead | ||
26 | #set($notificationsSheet = $services.model.createDocumentReference('', ['XWiki', 'Notifications', 'Code'], 'XWikiUserNotificationsSheet')) | ||
27 | #if ($xwiki.exists($notificationsSheet)) | ||
28 | #set($discard = $categories.add({'id':'notifications', 'sheet':'XWiki.Notifications.Code.XWikiUserNotificationsSheet', 'glyphicon': 'bell'})) | ||
29 | #end | ||
30 | #end | ||
31 | #set($userWikiSheet = 'WikiManager.UserWikiSheet') | ||
32 | #if($xcontext.isMainWiki() && $xwiki.exists($userWikiSheet)) | ||
33 | #set($discard = $categories.add({ | ||
34 | 'id': 'wikis', | ||
35 | 'name': $services.localization.render('platform.wiki.menu.userwikis'), | ||
36 | 'sheet': $userWikiSheet, | ||
37 | 'glyphicon': 'list' | ||
38 | })) | ||
39 | #end | ||
40 | #if($isMyProfile && $hasDashboard) | ||
41 | #set($discard = $categories.add({'id':'dashboard', 'sheet':'Dashboard.XWikiUserDashboardSheet', 'glyphicon': 'th'})) | ||
42 | #end | ||
43 | ######################### | ||
44 | ## Current category | ||
45 | ######################### | ||
46 | #set($currentCategory = "$!request.category") | ||
47 | #if($currentCategory == "") | ||
48 | #set($currentCategory = $categories[0].get('id')) | ||
49 | #end | ||
50 | ######################### | ||
51 | ## Creating vertical menu | ||
52 | ######################### | ||
53 | #set($userMenu = [{ | ||
54 | 'id' : 'settings', | ||
55 | 'cssClass' : 'user-menu-title', | ||
56 | 'children' : $categories | ||
57 | } | ||
58 | ]) | ||
59 | ## Setting automaticaly url & css fields of each category | ||
60 | #foreach($category in $userMenu) | ||
61 | #foreach($subcategory in $category.get('children')) | ||
62 | #set($id = $subcategory.get('id')) | ||
63 | #set($discard = $subcategory.put('url', "?category=${id}")) | ||
64 | #set($discard = $subcategory.put('cssClass', "user-menu-$id category-tab")) | ||
65 | #end | ||
66 | #end | ||
67 | ######################### | ||
68 | ## Display the left menu | ||
69 | ######################### | ||
70 | (% id="user-menu-col" %) | ||
71 | ((( | ||
72 | ############ | ||
73 | ## Avatar | ||
74 | ############ | ||
75 | (% id="avatar" %) | ||
76 | ((( | ||
77 | #if($request.xpage == 'edituser') | ||
78 | {{html clean="false"}} | ||
79 | #resizedUserAvatar($doc.fullName 180) | ||
80 | {{/html}} | ||
81 | #else | ||
82 | ## By specifying the image width we enable server side resizing. The width value we use is greater than the | ||
83 | ## available space because we don't want to loose too much of the image quality (we rely on the browser to fit the | ||
84 | ## image in the available space). | ||
85 | {{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"/}} | ||
86 | #end | ||
87 | ))) | ||
88 | ########## | ||
89 | ## Menu | ||
90 | ########## | ||
91 | (% id="user-vertical-menu" %) | ||
92 | ((( | ||
93 | #verticalNavigation($userMenu, {'translationPrefix' : 'platform.core.profile.category.', 'crtItemId' : $currentCategory, 'cssClass' : 'profile-menu'}) | ||
94 | ))) | ||
95 | ))) | ||
96 | ######################### | ||
97 | ## Display the page content | ||
98 | ######################### | ||
99 | (% id="user-page-content" %) | ||
100 | ((( | ||
101 | #foreach($category in $userMenu) | ||
102 | #foreach($subcategory in $category.get('children')) | ||
103 | #set($tabKey = $subcategory.get('id')) | ||
104 | (% id="${tabKey}Pane" class="user-page-pane#if($tabKey != $currentCategory) hidden#end" %) | ||
105 | ((( | ||
106 | #set($tabInclude = $subcategory.get('sheet')) | ||
107 | {{include reference="${tabInclude}" /}} | ||
108 | ))) | ||
109 | #end | ||
110 | #end | ||
111 | ))) | ||
112 | ######################### | ||
113 | ## END | ||
114 | ######################### | ||
115 | {{html clean="false"}} | ||
116 | #if($xcontext.action == 'edit' || $xcontext.action == 'inline') | ||
117 | <input type='hidden' name='category' value="$!{escapetool.xml($currentCategory)}" /> | ||
118 | #end | ||
119 | <div class="clearfloats"> </div> | ||
120 | {{/html}} | ||
121 | {{/velocity}} |